@@ -96,7 +96,11 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||||
96 | painter->save(); |
|
96 | painter->save(); | |
97 | painter->setPen(m_linePen); |
|
97 | painter->setPen(m_linePen); | |
98 | painter->setClipRect(clipRect()); |
|
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 | if (m_pointsVisible){ |
|
104 | if (m_pointsVisible){ | |
101 | painter->setPen(m_pointPen); |
|
105 | painter->setPen(m_pointPen); | |
102 | painter->drawPoints(geometryPoints()); |
|
106 | painter->drawPoints(geometryPoints()); |
@@ -45,31 +45,43 ChartView { | |||||
45 | XYPoint { x: 10; y: 3 } |
|
45 | XYPoint { x: 10; y: 3 } | |
46 | XYPoint { x: 11; y: 3 } |
|
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( |
|
49 | onNameChanged: console.log(name + ".onNameChanged: " + name); | |
64 |
onVisibleChanged: console.log( |
|
50 | onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible); | |
65 | onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); |
|
51 | onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y); | |
66 |
onSelected: console.log( |
|
52 | onSelected: console.log(name + ".onSelected"); | |
67 |
onColorChanged: console.log( |
|
53 | onColorChanged: console.log(name + ".onColorChanged: " + color); | |
68 |
onBorderColorChanged: console.log( |
|
54 | onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor); | |
69 |
// onCountChanged: console.log( |
|
55 | // onCountChanged: console.log(name + ".onCountChanged: " + count); | |
70 |
|
56 | |||
71 | Component.onCompleted: { |
|
57 | Component.onCompleted: { | |
72 | createDefaultAxes(); |
|
58 | createDefaultAxes(); | |
73 | } |
|
59 | } | |
74 | } |
|
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 } | |||
|
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); | |||
|
86 | } | |||
75 | } |
|
87 | } |
@@ -22,7 +22,7 import QtQuick 1.0 | |||||
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | ChartView { |
|
24 | ChartView { | |
25 |
title: " |
|
25 | title: "Bar series" | |
26 | anchors.fill: parent |
|
26 | anchors.fill: parent | |
27 | theme: ChartView.ChartThemeLight |
|
27 | theme: ChartView.ChartThemeLight | |
28 | legend.alignment: Qt.AlignBottom |
|
28 | legend.alignment: Qt.AlignBottom |
General Comments 0
You need to be logged in to leave comments.
Login now