##// END OF EJS Templates
Fix lineseries points related drawing problems...
Miikka Heikkinen -
r2451:a5b974d85d04
parent child
Show More
@@ -60,6 +60,7 void LineChartItem::updateGeometry()
60 if (m_points.size() == 0) {
60 if (m_points.size() == 0) {
61 prepareGeometryChange();
61 prepareGeometryChange();
62 m_path = QPainterPath();
62 m_path = QPainterPath();
63 m_linePath = QPainterPath();
63 m_rect = QRect();
64 m_rect = QRect();
64 return;
65 return;
65 }
66 }
@@ -70,6 +71,7 void LineChartItem::updateGeometry()
70
71
71 int size = m_linePen.width();
72 int size = m_linePen.width();
72 linePath.addEllipse(m_points.at(0), size, size);
73 linePath.addEllipse(m_points.at(0), size, size);
74 linePath.moveTo(m_points.at(0));
73 for (int i = 1; i < m_points.size(); i++) {
75 for (int i = 1; i < m_points.size(); i++) {
74 linePath.lineTo(m_points.at(i));
76 linePath.lineTo(m_points.at(i));
75 linePath.addEllipse(m_points.at(i), size, size);
77 linePath.addEllipse(m_points.at(i), size, size);
@@ -100,10 +102,17 void LineChartItem::updateGeometry()
100
102
101 void LineChartItem::handleUpdated()
103 void LineChartItem::handleUpdated()
102 {
104 {
105 // If points visiblity has changed, a geometry update is needed.
106 // Also, if pen changes when points are visible, geometry update is needed.
107 bool doGeometryUpdate =
108 (m_pointsVisible != m_series->pointsVisible())
109 || (m_series->pointsVisible() && (m_linePen != m_series->pen()));
103 setVisible(m_series->isVisible());
110 setVisible(m_series->isVisible());
104 setOpacity(m_series->opacity());
111 setOpacity(m_series->opacity());
105 m_pointsVisible = m_series->pointsVisible();
112 m_pointsVisible = m_series->pointsVisible();
106 m_linePen = m_series->pen();
113 m_linePen = m_series->pen();
114 if (doGeometryUpdate)
115 updateGeometry();
107 update();
116 update();
108 }
117 }
109
118
General Comments 0
You need to be logged in to leave comments. Login now