diff --git a/src/barplot.cpp b/src/barplot.cpp --- a/src/barplot.cpp +++ b/src/barplot.cpp @@ -18,19 +18,26 @@ */ #include "barplot.h" +#include "barscaledraw.h" BarPlot::BarPlot(ChannelManager* channelMan, QWidget* parent) : QwtPlot(parent), barChart(channelMan) { _channelMan = channelMan; barChart.attach(this); + setAxisMaxMinor(QwtPlot::xBottom, 0); + setAxisScaleDraw(QwtPlot::xBottom, new BarScaleDraw(channelMan)); + update(); connect(_channelMan, &ChannelManager::dataAdded, this, &BarPlot::update); connect(_channelMan, &ChannelManager::numOfChannelsChanged, this, &BarPlot::update); + connect(_channelMan, &ChannelManager::channelNameChanged, this, &BarPlot::update); } void BarPlot::update() { + setAxisScale(QwtPlot::xBottom, 0, _channelMan->numOfChannels(), 1); + static_cast(axisScaleDraw(QwtPlot::xBottom))->updateLabels(); barChart.resample(); replot(); }