diff --git a/src/barplot.cpp b/src/barplot.cpp --- a/src/barplot.cpp +++ b/src/barplot.cpp @@ -20,26 +20,14 @@ #include "barplot.h" BarPlot::BarPlot(ChannelManager* channelMan, QWidget* parent) : - QwtPlot(parent) + QwtPlot(parent), barChart(channelMan) { _channelMan = channelMan; barChart.attach(this); connect(_channelMan, &ChannelManager::dataAdded, [this]() { - barChart.setSamples(chartData()); + barChart.resample(); replot(); }); } - -QVector BarPlot::chartData() const -{ - unsigned numChannels = _channelMan->numOfChannels(); - unsigned numOfSamples = _channelMan->numOfSamples(); - QVector data(numChannels); - for (int i = 0; i < numChannels; i++) - { - data[i] = _channelMan->channelBuffer(i)->sample(numOfSamples-1); - } - return data; -}