# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2017-04-01 08:49:22 # Node ID 0e27c36ff94971009547a2a7d6ea2b6f799d29fc # Parent 347335d8956f1103791664a4868c06e7b58b4902 fix symbols diff --git a/src/plot.cpp b/src/plot.cpp --- a/src/plot.cpp +++ b/src/plot.cpp @@ -38,6 +38,7 @@ Plot::Plot(QWidget* parent) : { isAutoScaled = true; symbolSize = 0; + numOfSamples = 1; QObject::connect(&zoomer, &Zoomer::unzoomed, this, &Plot::unzoomed); @@ -250,7 +251,10 @@ void Plot::onXScaleChanged() auto sw = axisWidget(QwtPlot::xBottom); auto paintDist = sw->scaleDraw()->scaleMap().pDist(); auto scaleDist = sw->scaleDraw()->scaleMap().sDist(); - int symDisPx = round(paintDist / scaleDist); + auto fullScaleDist = zoomer.zoomBase().width(); + auto zoomRate = fullScaleDist / scaleDist; + float samplesInView = numOfSamples / zoomRate; + int symDisPx = round(paintDist / samplesInView); if (symDisPx < SYMBOL_SHOW_AT_WIDTH) { @@ -294,6 +298,11 @@ void Plot::resizeEvent(QResizeEvent * ev void Plot::onNumOfSamplesChanged(unsigned value) { + numOfSamples = value; + onXScaleChanged(); + + // TODO: what to do with this? + // auto currentBase = zoomer.zoomBase(); // currentBase.setWidth(value); // zoomer.setZoomBase(currentBase); diff --git a/src/plot.h b/src/plot.h --- a/src/plot.h +++ b/src/plot.h @@ -72,6 +72,7 @@ private: bool isAutoScaled; double yMin, yMax; double _xMin, _xMax; + unsigned numOfSamples; int symbolSize; Zoomer zoomer; ScaleZoomer sZoomer; diff --git a/src/plotmanager.cpp b/src/plotmanager.cpp --- a/src/plotmanager.cpp +++ b/src/plotmanager.cpp @@ -462,12 +462,10 @@ void PlotManager::flashSnapshotOverlay() void PlotManager::onNumOfSamplesChanged(unsigned value) { _numOfSamples = value; - if (_xAxisAsIndex) + for (auto plot : plotWidgets) { - for (auto plot : plotWidgets) - { - plot->setXAxis(0, value); - } + plot->onNumOfSamplesChanged(value); + if (_xAxisAsIndex) plot->setXAxis(0, value); } }