##// END OF EJS Templates
Fix area series point labels...
Titta Heikkala -
r2778:6eb2f806ec7f
parent child
Show More
@@ -201,10 +201,11 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
201 painter->setPen(QPen(m_pointLabelsColor));
201 painter->setPen(QPen(m_pointLabelsColor));
202 QFontMetrics fm(painter->font());
202 QFontMetrics fm(painter->font());
203
203
204 QString pointLabel = m_pointLabelsFormat;
204 QString pointLabel;
205
205
206 if (m_series->upperSeries()) {
206 if (m_series->upperSeries()) {
207 for (int i(0); i < m_series->upperSeries()->count(); i++) {
207 for (int i(0); i < m_series->upperSeries()->count(); i++) {
208 pointLabel = m_pointLabelsFormat;
208 pointLabel.replace(xPointTag,
209 pointLabel.replace(xPointTag,
209 presenter()->numberToString(m_series->upperSeries()->at(i).x()));
210 presenter()->numberToString(m_series->upperSeries()->at(i).x()));
210 pointLabel.replace(yPointTag,
211 pointLabel.replace(yPointTag,
@@ -222,6 +223,7 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
222
223
223 if (m_series->lowerSeries()) {
224 if (m_series->lowerSeries()) {
224 for (int i(0); i < m_series->lowerSeries()->count(); i++) {
225 for (int i(0); i < m_series->lowerSeries()->count(); i++) {
226 pointLabel = m_pointLabelsFormat;
225 pointLabel.replace(xPointTag,
227 pointLabel.replace(xPointTag,
226 presenter()->numberToString(m_series->lowerSeries()->at(i).x()));
228 presenter()->numberToString(m_series->lowerSeries()->at(i).x()));
227 pointLabel.replace(yPointTag,
229 pointLabel.replace(yPointTag,
@@ -232,7 +234,6 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
232 QPointF position(m_lower->geometryPoints().at(i));
234 QPointF position(m_lower->geometryPoints().at(i));
233 position.setX(position.x() - pointLabelWidth / 2);
235 position.setX(position.x() - pointLabelWidth / 2);
234 position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2 - labelOffset);
236 position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2 - labelOffset);
235
236 painter->drawText(position, pointLabel);
237 painter->drawText(position, pointLabel);
237 }
238 }
238 }
239 }
General Comments 0
You need to be logged in to leave comments. Login now