# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2017-08-16 12:28:53 # Node ID c35baca487568442b3302edade250380b872b5e3 # Parent f102fddaeb9fa5bbd2aefb19c4fd85a2943e5b1a fix auto show symbols diff --git a/src/plot.cpp b/src/plot.cpp --- a/src/plot.cpp +++ b/src/plot.cpp @@ -39,6 +39,7 @@ Plot::Plot(QWidget* parent) : isAutoScaled = true; symbolSize = 0; numOfSamples = 1; + plotWidth = 1; showSymbols = Plot::ShowSymbolsAuto; QObject::connect(&zoomer, &Zoomer::unzoomed, this, &Plot::unzoomed); @@ -302,7 +303,8 @@ void Plot::calcSymbolSize() auto scaleDist = sw->scaleDraw()->scaleMap().sDist(); auto fullScaleDist = zoomer.zoomBase().width(); auto zoomRate = fullScaleDist / scaleDist; - float samplesInView = numOfSamples / zoomRate; + float plotWidthNumSamp = abs(numOfSamples * plotWidth / (_xMax - _xMin)); + float samplesInView = plotWidthNumSamp / zoomRate; int symDisPx = round(paintDist / samplesInView); if (symDisPx < SYMBOL_SHOW_AT_WIDTH) @@ -351,5 +353,6 @@ void Plot::setNumOfSamples(unsigned valu void Plot::setPlotWidth(double width) { + plotWidth = width; zoomer.setHViewSize(width); } diff --git a/src/plot.h b/src/plot.h --- a/src/plot.h +++ b/src/plot.h @@ -84,6 +84,7 @@ private: double yMin, yMax; double _xMin, _xMax; unsigned numOfSamples; + double plotWidth; int symbolSize; Zoomer zoomer; ScaleZoomer sZoomer;