@@ -295,192 +295,202 @@ void PlotManager::setupLayout(bool multi
}
else
{
// delete scrollArea left from multi layout
if (scrollArea != NULL)
delete scrollArea;
scrollArea = NULL;
layout = new QVBoxLayout(_plotArea);
layout->setContentsMargins(2,2,2,2);
layout->setSpacing(1);
Plot* PlotManager::addPlotWidget()
auto plot = new Plot();
plotWidgets.append(plot);
layout->addWidget(plot);
plot->darkBackground(_menu->darkBackgroundAction.isChecked());
plot->showGrid(_menu->showGridAction.isChecked());
plot->showMinorGrid(_menu->showMinorGridAction.isChecked());
plot->showLegend(_menu->showLegendAction.isChecked());
plot->setSymbols(_menu->showSymbols());
plot->showDemoIndicator(isDemoShown);
plot->setYAxis(_autoScaled, _yMin, _yMax);
plot->setNumOfSamples(_numOfSamples);
plot->setPlotWidth(_plotWidth);
if (_xAxisAsIndex)
plot->setXAxis(0, _numOfSamples);
plot->setXAxis(_xMin, _xMax);
return plot;
void PlotManager::addCurve(QString title, const XFrameBuffer* xBuf, const FrameBuffer* yBuf)
auto curve = new QwtPlotCurve(title);
auto series = new FrameBufferSeries(xBuf, yBuf);
curve->setSamples(series);
_addCurve(curve);
void PlotManager::_addCurve(QwtPlotCurve* curve)
// store and init the curve
curves.append(curve);
unsigned index = curves.size()-1;
auto color = infoModel->color(index);
curve->setPen(color);
// create the plot for the curve if we are on multi display
Plot* plot;
if (isMulti)
// create a new plot widget
plot = addPlotWidget();
plot = plotWidgets[0];
if (_stream != nullptr) // not displaying snapshot
QVector<const StreamChannel*> dispChannels;
dispChannels = QVector<const StreamChannel*>(1, _stream->channel(index));
dispChannels = _stream->allChannels();
plot->setDispChannels(dispChannels);
// show the curve
curve->attach(plot);
plot->replot();
void PlotManager::removeCurves(unsigned number)
if (! isMulti)
plotWidgets[0]->setDispChannels(dispChannels);
for (unsigned i = 0; i < number; i++)
if (!curves.isEmpty())
delete curves.takeLast();
if (isMulti) // delete corresponding widget as well
delete plotWidgets.takeLast();
unsigned PlotManager::numOfCurves()
return curves.size();
Plot* PlotManager::plotWidget(unsigned curveIndex)
return plotWidgets[curveIndex];
return plotWidgets[0];
void PlotManager::replot()
for (auto plot : plotWidgets)
void PlotManager::showGrid(bool show)
plot->showGrid(show);
void PlotManager::showMinorGrid(bool show)
plot->showMinorGrid(show);
void PlotManager::showLegend(bool show)
plot->showLegend(show);
void PlotManager::showDemoIndicator(bool show)
isDemoShown = show;
plot->showDemoIndicator(show);
void PlotManager::unzoom()
plot->unzoom();
void PlotManager::darkBackground(bool enabled)
plot->darkBackground(enabled);
void PlotManager::setSymbols(Plot::ShowSymbols shown)
showSymbols = shown;
plot->setSymbols(shown);
Status change: