diff --git a/src/barplot.cpp b/src/barplot.cpp --- a/src/barplot.cpp +++ b/src/barplot.cpp @@ -25,9 +25,12 @@ BarPlot::BarPlot(ChannelManager* channel _channelMan = channelMan; barChart.attach(this); - connect(_channelMan, &ChannelManager::dataAdded, [this]() - { - barChart.resample(); - replot(); - }); + connect(_channelMan, &ChannelManager::dataAdded, this, &BarPlot::update); + connect(_channelMan, &ChannelManager::numOfChannelsChanged, this, &BarPlot::update); } + +void BarPlot::update() +{ + barChart.resample(); + replot(); +} diff --git a/src/barplot.h b/src/barplot.h --- a/src/barplot.h +++ b/src/barplot.h @@ -37,6 +37,9 @@ private: BarChart barChart; QVector chartData() const; + +private slots: + void update(); }; #endif // BARPLOT_H