Skip to content

Commit

Permalink
Added a clear() function to Lua timeseries. (#898)
Browse files Browse the repository at this point in the history
Co-authored-by: Marcus Andersson <maran@kornet1.se>
  • Loading branch information
TheOtherMarcus and Marcus Andersson authored Jan 9, 2024
1 parent 0068917 commit c6b3af1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plotjuggler_base/include/PlotJuggler/reactive_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ struct TimeseriesRef

unsigned size() const;

void clear() const;

PJ::PlotData* _plot_data = nullptr;
};

Expand Down
6 changes: 6 additions & 0 deletions plotjuggler_base/src/reactive_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void ReactiveLuaFunction::prepareLua()
_timeseries_ref["at"] = &TimeseriesRef::at;
_timeseries_ref["set"] = &TimeseriesRef::set;
_timeseries_ref["atTime"] = &TimeseriesRef::atTime;
_timeseries_ref["clear"] = &TimeseriesRef::clear;

//---------------------------------------
_created_timeseries = _lua_engine.new_usertype<CreatedSeriesTime>("Timeseries");
Expand Down Expand Up @@ -194,6 +195,11 @@ unsigned TimeseriesRef::size() const
return _plot_data->size();
}

void TimeseriesRef::clear() const
{
_plot_data->clear();
}

CreatedSeriesBase::CreatedSeriesBase(PlotDataMapRef* data_map, const std::string& name,
bool timeseries)
{
Expand Down

0 comments on commit c6b3af1

Please sign in to comment.