diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp index 9ecb6c6..618e655 100644 --- a/src/charts/xychart/qxyseries.cpp +++ b/src/charts/xychart/qxyseries.cpp @@ -841,11 +841,12 @@ void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVectorsetFont(m_pointLabelsFont); painter->setPen(QPen(m_pointLabelsColor)); QFontMetrics fm(painter->font()); - - for (int i(0); i < points.size(); i++) { + // m_points is used for the label here as it has the series point information + // points variable passed is used for positioning because it has the coordinates + for (int i(0); i < m_points.size(); i++) { QString pointLabel = m_pointLabelsFormat; - pointLabel.replace(xPointTag, presenter()->numberToString(points.at(i).x())); - pointLabel.replace(yPointTag, presenter()->numberToString(points.at(i).y())); + pointLabel.replace(xPointTag, presenter()->numberToString(m_points.at(i).x())); + pointLabel.replace(yPointTag, presenter()->numberToString(m_points.at(i).y())); // Position text in relation to the point int pointLabelWidth = fm.width(pointLabel);