summaryrefslogtreecommitdiffstats
path: root/src/splinechart/splinechartitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/splinechart/splinechartitem.cpp')
-rw-r--r--src/splinechart/splinechartitem.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/splinechart/splinechartitem.cpp b/src/splinechart/splinechartitem.cpp
index 4a46a724..4f1162c1 100644
--- a/src/splinechart/splinechartitem.cpp
+++ b/src/splinechart/splinechartitem.cpp
@@ -141,6 +141,9 @@ void SplineChartItem::updateGeometry()
qreal rightMarginLine = centerPoint.x() + margin;
qreal horizontal = centerPoint.y();
+ // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
+ const int seriesLastIndex = m_series->count() - 1;
+
for (int i = 1; i < points.size(); i++) {
// Interpolating spline fragments accurately is not trivial, and would anyway be ugly
// when thick pen is used, so we work around it by utilizing three separate
@@ -154,7 +157,7 @@ void SplineChartItem::updateGeometry()
// degrees and both of the points are within the margin, one in the top half and one in the
// bottom half of the chart, the bottom one gets clipped incorrectly.
// However, this should be rare occurrence in any sensible chart.
- currentSeriesPoint = m_series->pointAt(i);
+ currentSeriesPoint = m_series->pointAt(qMin(seriesLastIndex, i));
currentGeometryPoint = points.at(i);
pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);