From 6eb2f806ec7f612bad05f02aafed7be22cf46a6d 2015-06-02 10:49:12 From: Titta Heikkala Date: 2015-06-02 10:49:12 Subject: [PATCH] Fix area series point labels The point label string needs to be initialized before each point. Change-Id: I69df8b433c849324d9176ea5a20787cc938093e3 Task-number: QTRD-3637 Reviewed-by: Miikka Heikkinen --- diff --git a/src/charts/areachart/areachartitem.cpp b/src/charts/areachart/areachartitem.cpp index 9813d33..99095cf 100644 --- a/src/charts/areachart/areachartitem.cpp +++ b/src/charts/areachart/areachartitem.cpp @@ -201,10 +201,11 @@ void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt painter->setPen(QPen(m_pointLabelsColor)); QFontMetrics fm(painter->font()); - QString pointLabel = m_pointLabelsFormat; + QString pointLabel; if (m_series->upperSeries()) { for (int i(0); i < m_series->upperSeries()->count(); i++) { + pointLabel = m_pointLabelsFormat; pointLabel.replace(xPointTag, presenter()->numberToString(m_series->upperSeries()->at(i).x())); pointLabel.replace(yPointTag, @@ -222,6 +223,7 @@ void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt if (m_series->lowerSeries()) { for (int i(0); i < m_series->lowerSeries()->count(); i++) { + pointLabel = m_pointLabelsFormat; pointLabel.replace(xPointTag, presenter()->numberToString(m_series->lowerSeries()->at(i).x())); pointLabel.replace(yPointTag, @@ -232,7 +234,6 @@ void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt QPointF position(m_lower->geometryPoints().at(i)); position.setX(position.x() - pointLabelWidth / 2); position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2 - labelOffset); - painter->drawText(position, pointLabel); } }