From 644b341d912542d04fbb9efbb4cc3ca8337cacc5 Mon Sep 17 00:00:00 2001 From: Alexander Ivash Date: Wed, 3 Jul 2024 22:49:29 +0200 Subject: [PATCH] fix fill is being filled even in yet unplotted areas --- Source/GUI/Plot.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/GUI/Plot.cpp b/Source/GUI/Plot.cpp index 293ce2285..fdc1b0740 100644 --- a/Source/GUI/Plot.cpp +++ b/Source/GUI/Plot.cpp @@ -297,8 +297,12 @@ class PlotCurve : public QwtPlotCurve { if(m_fillCurve) baselinePolygon = mapper.toPolygonF( xMap, yMap, m_fillCurve->data(), from, to); else if(m_fillBaseline) { - baselinePolygon += QPointF(xMap.transform(qreal(from)), yMap.transform(m_fillBaseline.value())); - baselinePolygon += QPointF(xMap.transform(qreal(to)), yMap.transform(m_fillBaseline.value())); + const PlotSeriesData* plotSeriesData = static_cast(data()); + auto fromSample = plotSeriesData->sample(from); + auto toSample = plotSeriesData->sample(to); + + baselinePolygon += QPointF(xMap.transform(qreal(fromSample.x())), yMap.transform(m_fillBaseline.value())); + baselinePolygon += QPointF(xMap.transform(qreal(toSample.x())), yMap.transform(m_fillBaseline.value())); } for(auto it = baselinePolygon.rbegin(); it != baselinePolygon.rend(); ++it) {