##// END OF EJS Templates
Optimization: line series now uses QPainter::drawLine
Tero Ahola -
r1780:94c0d22f0f14
parent child
Show More
@@ -96,7 +96,11 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
96 96 painter->save();
97 97 painter->setPen(m_linePen);
98 98 painter->setClipRect(clipRect());
99 painter->drawPath(m_path);
99 // Draw lines
100 const QVector<QPointF> &points = geometryPoints();
101 for (int i(1); i < points.size();i++)
102 painter->drawLine(points.at(i-1), points.at(i));
103 // Draw points
100 104 if (m_pointsVisible){
101 105 painter->setPen(m_pointPen);
102 106 painter->drawPoints(geometryPoints());
@@ -45,31 +45,43 ChartView {
45 45 XYPoint { x: 10; y: 3 }
46 46 XYPoint { x: 11; y: 3 }
47 47 }
48 lowerSeries: LineSeries {
49 XYPoint { x: 0; y: 0 }
50 XYPoint { x: 1; y: 0 }
51 XYPoint { x: 2; y: 0 }
52 XYPoint { x: 3; y: 0 }
53 XYPoint { x: 4; y: 0 }
54 XYPoint { x: 5; y: 0 }
55 XYPoint { x: 6; y: 0 }
56 XYPoint { x: 7; y: 0 }
57 XYPoint { x: 8; y: 0 }
58 XYPoint { x: 9; y: 0 }
59 XYPoint { x: 10; y: 0 }
60 XYPoint { x: 11; y: 0 }
61 }
62 48
63 onNameChanged: console.log("areaSeries.onNameChanged: " + name);
64 onVisibleChanged: console.log("areaSeries.onVisibleChanged: " + visible);
49 onNameChanged: console.log(name + ".onNameChanged: " + name);
50 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
65 51 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
66 onSelected: console.log("areaSeries.onSelected");
67 onColorChanged: console.log("areaSeries.onColorChanged: " + color);
68 onBorderColorChanged: console.log("areaSeries.onBorderColorChanged: " + borderColor);
69 // onCountChanged: console.log("areaSeries.onCountChanged: " + count);
52 onSelected: console.log(name + ".onSelected");
53 onColorChanged: console.log(name + ".onColorChanged: " + color);
54 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
55 // onCountChanged: console.log(name + ".onCountChanged: " + count);
70 56
71 57 Component.onCompleted: {
72 createDefaultAxes();
58 createDefaultAxes();
59 }
60 }
61
62 AreaSeries {
63 name: "area 2"
64
65 upperSeries: LineSeries {
66 XYPoint { x: 0; y: 0.5 }
67 XYPoint { x: 1; y: 1.5 }
68 XYPoint { x: 2; y: 0.3 }
69 XYPoint { x: 3; y: 1.5 }
70 XYPoint { x: 4; y: 0.1 }
71 XYPoint { x: 5; y: 0.3 }
72 XYPoint { x: 6; y: 1.2 }
73 XYPoint { x: 7; y: 1.3 }
74 XYPoint { x: 8; y: 0.2 }
75 XYPoint { x: 9; y: 0.1 }
76 XYPoint { x: 10; y: 3.2 }
77 XYPoint { x: 11; y: 4.6 }
73 78 }
79
80 onNameChanged: console.log(name + ".onNameChanged: " + name);
81 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
82 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
83 onSelected: console.log(name + ".onSelected");
84 onColorChanged: console.log(name + ".onColorChanged: " + color);
85 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
74 86 }
75 87 }
@@ -22,7 +22,7 import QtQuick 1.0
22 22 import QtCommercial.Chart 1.0
23 23
24 24 ChartView {
25 title: "Grouped bar series"
25 title: "Bar series"
26 26 anchors.fill: parent
27 27 theme: ChartView.ChartThemeLight
28 28 legend.alignment: Qt.AlignBottom
@@ -69,4 +69,4 ChartView {
69 69 setAxisX(myAxis,mySeries);
70 70 }
71 71
72 } No newline at end of file
72 }
General Comments 0
You need to be logged in to leave comments. Login now