@@ -0,0 +1,41 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.0 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | //![1] | |||
|
28 | ChartView { | |||
|
29 | title: "Bar series" | |||
|
30 | anchors.fill: parent | |||
|
31 | legend.alignment: Qt.AlignBottom | |||
|
32 | axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"] | |||
|
33 | ||||
|
34 | BarSeries { | |||
|
35 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } | |||
|
36 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } | |||
|
37 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } | |||
|
38 | } | |||
|
39 | } | |||
|
40 | //![1] | |||
|
41 | } |
@@ -0,0 +1,41 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.0 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | //![1] | |||
|
28 | ChartView { | |||
|
29 | title: "Grouped Bar series" | |||
|
30 | anchors.fill: parent | |||
|
31 | legend.alignment: Qt.AlignBottom | |||
|
32 | axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"] | |||
|
33 | ||||
|
34 | GroupedBarSeries { | |||
|
35 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } | |||
|
36 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } | |||
|
37 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } | |||
|
38 | } | |||
|
39 | } | |||
|
40 | //![1] | |||
|
41 | } |
@@ -0,0 +1,41 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.0 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | //![1] | |||
|
28 | ChartView { | |||
|
29 | title: "Stacked Bar series" | |||
|
30 | anchors.fill: parent | |||
|
31 | legend.alignment: Qt.AlignBottom | |||
|
32 | axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"] | |||
|
33 | ||||
|
34 | StackedBarSeries { | |||
|
35 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } | |||
|
36 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } | |||
|
37 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } | |||
|
38 | } | |||
|
39 | } | |||
|
40 | //![1] | |||
|
41 | } |
@@ -0,0 +1,41 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.0 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | //![1] | |||
|
28 | ChartView { | |||
|
29 | title: "Percent Bar series" | |||
|
30 | anchors.fill: parent | |||
|
31 | legend.alignment: Qt.AlignBottom | |||
|
32 | axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"] | |||
|
33 | ||||
|
34 | PercentBarSeries { | |||
|
35 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } | |||
|
36 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } | |||
|
37 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } | |||
|
38 | } | |||
|
39 | } | |||
|
40 | //![1] | |||
|
41 | } |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -1,55 +1,44 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | //![1] |
|
27 | //![1] | |
28 | ChartView { |
|
28 | ChartView { | |
29 |
title: "Line |
|
29 | title: "Line" | |
30 | anchors.fill: parent |
|
30 | anchors.fill: parent | |
31 |
|
31 | |||
32 | LineSeries { |
|
32 | LineSeries { | |
33 | name: "Line" |
|
33 | name: "LineSeries" | |
34 | XyPoint { x: 0; y: 0 } |
|
34 | XyPoint { x: 0; y: 0 } | |
35 | XyPoint { x: 1.1; y: 2.1 } |
|
35 | XyPoint { x: 1.1; y: 2.1 } | |
36 | XyPoint { x: 1.9; y: 3.3 } |
|
36 | XyPoint { x: 1.9; y: 3.3 } | |
37 | XyPoint { x: 2.1; y: 2.1 } |
|
37 | XyPoint { x: 2.1; y: 2.1 } | |
38 | XyPoint { x: 2.9; y: 4.9 } |
|
38 | XyPoint { x: 2.9; y: 4.9 } | |
39 | XyPoint { x: 3.4; y: 3.0 } |
|
39 | XyPoint { x: 3.4; y: 3.0 } | |
40 | XyPoint { x: 4.1; y: 3.3 } |
|
40 | XyPoint { x: 4.1; y: 3.3 } | |
41 | } |
|
41 | } | |
42 |
|
||||
43 | SplineSeries { |
|
|||
44 | name: "Spline" |
|
|||
45 | XyPoint { x: 0; y: 0.3 } |
|
|||
46 | XyPoint { x: 1.1; y: 3.2 } |
|
|||
47 | XyPoint { x: 1.9; y: 2.4 } |
|
|||
48 | XyPoint { x: 2.1; y: 2.1 } |
|
|||
49 | XyPoint { x: 2.9; y: 2.6 } |
|
|||
50 | XyPoint { x: 3.4; y: 2.3 } |
|
|||
51 | XyPoint { x: 4.1; y: 3.1 } |
|
|||
52 | } |
|
|||
53 | } |
|
42 | } | |
54 | //![1] |
|
43 | //![1] | |
55 | } |
|
44 | } |
@@ -1,141 +1,44 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | //![1] |
|
27 | //![1] | |
28 | ChartView { |
|
28 | ChartView { | |
29 | title: "NHL All-Star Team Players" |
|
29 | title: "Spline" | |
30 | anchors.fill: parent |
|
30 | anchors.fill: parent | |
31 | axisXLabels: ["0", "2000", "1", "2001", "2", "2002", "3", "2003", "4", "2004", "5", "2005", |
|
|||
32 | "6", "2006", "7", "2007", "8", "2008", "9", "2009", "10", "2010", "11", "2011"] |
|
|||
33 |
|
31 | |||
34 |
|
|
32 | SplineSeries { | |
35 |
name: " |
|
33 | name: "SplineSeries" | |
36 | upperSeries: LineSeries { |
|
34 | XyPoint { x: 0; y: 0.3 } | |
37 |
|
|
35 | XyPoint { x: 1.1; y: 3.2 } | |
38 |
|
|
36 | XyPoint { x: 1.9; y: 2.4 } | |
39 |
|
|
37 | XyPoint { x: 2.1; y: 2.1 } | |
40 |
|
|
38 | XyPoint { x: 2.9; y: 2.6 } | |
41 |
|
|
39 | XyPoint { x: 3.4; y: 2.3 } | |
42 |
|
|
40 | XyPoint { x: 4.1; y: 3.1 } | |
43 | XyPoint { x: 6; y: 1 } |
|
|||
44 | XyPoint { x: 7; y: 1 } |
|
|||
45 | XyPoint { x: 8; y: 4 } |
|
|||
46 | XyPoint { x: 9; y: 3 } |
|
|||
47 | XyPoint { x: 10; y: 2 } |
|
|||
48 | XyPoint { x: 11; y: 1 } |
|
|||
49 |
|
|
41 | } | |
50 | lowerSeries: LineSeries { |
|
|||
51 | XyPoint { x: 0; y: 0 } |
|
|||
52 | XyPoint { x: 1; y: 0 } |
|
|||
53 | XyPoint { x: 2; y: 0 } |
|
|||
54 | XyPoint { x: 3; y: 0 } |
|
|||
55 | XyPoint { x: 4; y: 0 } |
|
|||
56 | XyPoint { x: 5; y: 0 } |
|
|||
57 | XyPoint { x: 6; y: 0 } |
|
|||
58 | XyPoint { x: 7; y: 0 } |
|
|||
59 | XyPoint { x: 8; y: 0 } |
|
|||
60 | XyPoint { x: 9; y: 0 } |
|
|||
61 | XyPoint { x: 10; y: 0 } |
|
|||
62 | XyPoint { x: 11; y: 0 } |
|
|||
63 | } |
|
42 | } | |
64 | } |
|
|||
65 | // ... |
|
|||
66 |
|
|
43 | //![1] | |
67 |
|
||||
68 | AreaSeries { |
|
|||
69 | id: swedish |
|
|||
70 | name: "Swedish" |
|
|||
71 | upperSeries: LineSeries { |
|
|||
72 | XyPoint { x: 0; y: 1 } |
|
|||
73 | XyPoint { x: 1; y: 1 } |
|
|||
74 | XyPoint { x: 2; y: 3 } |
|
|||
75 | XyPoint { x: 3; y: 3 } |
|
|||
76 | XyPoint { x: 4; y: 2 } |
|
|||
77 | XyPoint { x: 5; y: 0 } |
|
|||
78 | XyPoint { x: 6; y: 2 } |
|
|||
79 | XyPoint { x: 7; y: 1 } |
|
|||
80 | XyPoint { x: 8; y: 2 } |
|
|||
81 | XyPoint { x: 9; y: 1 } |
|
|||
82 | XyPoint { x: 10; y: 3 } |
|
|||
83 | XyPoint { x: 11; y: 3 } |
|
|||
84 | } |
|
|||
85 | lowerSeries: LineSeries { |
|
|||
86 | XyPoint { x: 0; y: 0 } |
|
|||
87 | XyPoint { x: 1; y: 0 } |
|
|||
88 | XyPoint { x: 2; y: 0 } |
|
|||
89 | XyPoint { x: 3; y: 0 } |
|
|||
90 | XyPoint { x: 4; y: 0 } |
|
|||
91 | XyPoint { x: 5; y: 0 } |
|
|||
92 | XyPoint { x: 6; y: 0 } |
|
|||
93 | XyPoint { x: 7; y: 0 } |
|
|||
94 | XyPoint { x: 8; y: 0 } |
|
|||
95 | XyPoint { x: 9; y: 0 } |
|
|||
96 | XyPoint { x: 10; y: 0 } |
|
|||
97 | XyPoint { x: 11; y: 0 } |
|
|||
98 | } |
|
|||
99 | onClicked: { |
|
|||
100 | color = "yellow"; |
|
|||
101 | borderColor = "blue"; |
|
|||
102 | } |
|
|||
103 | } |
|
|||
104 |
|
||||
105 | AreaSeries { |
|
|||
106 | name: "Finnish" |
|
|||
107 | upperSeries: LineSeries { |
|
|||
108 | XyPoint { x: 0; y: 0 } |
|
|||
109 | XyPoint { x: 1; y: 0 } |
|
|||
110 | XyPoint { x: 2; y: 0 } |
|
|||
111 | XyPoint { x: 3; y: 0 } |
|
|||
112 | XyPoint { x: 4; y: 0 } |
|
|||
113 | XyPoint { x: 5; y: 0 } |
|
|||
114 | XyPoint { x: 6; y: 1 } |
|
|||
115 | XyPoint { x: 7; y: 0 } |
|
|||
116 | XyPoint { x: 8; y: 0 } |
|
|||
117 | XyPoint { x: 9; y: 0 } |
|
|||
118 | XyPoint { x: 10; y: 0 } |
|
|||
119 | XyPoint { x: 11; y: 1 } |
|
|||
120 | } |
|
|||
121 | lowerSeries: LineSeries { |
|
|||
122 | XyPoint { x: 0; y: 0 } |
|
|||
123 | XyPoint { x: 1; y: 0 } |
|
|||
124 | XyPoint { x: 2; y: 0 } |
|
|||
125 | XyPoint { x: 3; y: 0 } |
|
|||
126 | XyPoint { x: 4; y: 0 } |
|
|||
127 | XyPoint { x: 5; y: 0 } |
|
|||
128 | XyPoint { x: 6; y: 0 } |
|
|||
129 | XyPoint { x: 7; y: 0 } |
|
|||
130 | XyPoint { x: 8; y: 0 } |
|
|||
131 | XyPoint { x: 9; y: 0 } |
|
|||
132 | XyPoint { x: 10; y: 0 } |
|
|||
133 | XyPoint { x: 11; y: 0 } |
|
|||
134 | } |
|
|||
135 | onClicked: { |
|
|||
136 | color = "white"; |
|
|||
137 | borderColor = "blue"; |
|
|||
138 | } |
|
|||
139 | } |
|
|||
140 | } |
|
|||
141 | } |
|
44 | } |
@@ -1,56 +1,141 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | //![1] |
|
27 | //![1] | |
28 | ChartView { |
|
28 | ChartView { | |
29 |
title: " |
|
29 | title: "NHL All-Star Team Players" | |
30 | anchors.fill: parent |
|
30 | anchors.fill: parent | |
|
31 | axisXLabels: ["0", "2000", "1", "2001", "2", "2002", "3", "2003", "4", "2004", "5", "2005", | |||
|
32 | "6", "2006", "7", "2007", "8", "2008", "9", "2009", "10", "2010", "11", "2011"] | |||
31 |
|
33 | |||
32 |
|
|
34 | AreaSeries { | |
33 |
|
|
35 | name: "Russian" | |
34 | name: "Scatter1" |
|
36 | upperSeries: LineSeries { | |
35 |
XyPoint { x: |
|
37 | XyPoint { x: 0; y: 1 } | |
36 |
XyPoint { x: 1 |
|
38 | XyPoint { x: 1; y: 1 } | |
37 |
XyPoint { x: |
|
39 | XyPoint { x: 2; y: 1 } | |
38 |
XyPoint { x: |
|
40 | XyPoint { x: 3; y: 1 } | |
39 |
XyPoint { x: |
|
41 | XyPoint { x: 4; y: 1 } | |
40 |
XyPoint { x: |
|
42 | XyPoint { x: 5; y: 0 } | |
41 |
XyPoint { x: |
|
43 | XyPoint { x: 6; y: 1 } | |
|
44 | XyPoint { x: 7; y: 1 } | |||
|
45 | XyPoint { x: 8; y: 4 } | |||
|
46 | XyPoint { x: 9; y: 3 } | |||
|
47 | XyPoint { x: 10; y: 2 } | |||
|
48 | XyPoint { x: 11; y: 1 } | |||
|
49 | } | |||
|
50 | lowerSeries: LineSeries { | |||
|
51 | XyPoint { x: 0; y: 0 } | |||
|
52 | XyPoint { x: 1; y: 0 } | |||
|
53 | XyPoint { x: 2; y: 0 } | |||
|
54 | XyPoint { x: 3; y: 0 } | |||
|
55 | XyPoint { x: 4; y: 0 } | |||
|
56 | XyPoint { x: 5; y: 0 } | |||
|
57 | XyPoint { x: 6; y: 0 } | |||
|
58 | XyPoint { x: 7; y: 0 } | |||
|
59 | XyPoint { x: 8; y: 0 } | |||
|
60 | XyPoint { x: 9; y: 0 } | |||
|
61 | XyPoint { x: 10; y: 0 } | |||
|
62 | XyPoint { x: 11; y: 0 } | |||
|
63 | } | |||
42 | } |
|
64 | } | |
43 |
|
||||
44 | ScatterSeries { |
|
|||
45 | name: "Scatter2" |
|
|||
46 |
|
|
65 | // ... | |
47 |
|
|
66 | //![1] | |
48 | XyPoint { x: 2.0; y: 2.0 } |
|
67 | ||
49 | XyPoint { x: 2.0; y: 2.1 } |
|
68 | AreaSeries { | |
50 | XyPoint { x: 2.07; y: 2.05 } |
|
69 | id: swedish | |
51 | XyPoint { x: 2.2; y: 2.9 } |
|
70 | name: "Swedish" | |
52 | XyPoint { x: 2.4; y: 2.7 } |
|
71 | upperSeries: LineSeries { | |
53 |
XyPoint { x: |
|
72 | XyPoint { x: 0; y: 1 } | |
|
73 | XyPoint { x: 1; y: 1 } | |||
|
74 | XyPoint { x: 2; y: 3 } | |||
|
75 | XyPoint { x: 3; y: 3 } | |||
|
76 | XyPoint { x: 4; y: 2 } | |||
|
77 | XyPoint { x: 5; y: 0 } | |||
|
78 | XyPoint { x: 6; y: 2 } | |||
|
79 | XyPoint { x: 7; y: 1 } | |||
|
80 | XyPoint { x: 8; y: 2 } | |||
|
81 | XyPoint { x: 9; y: 1 } | |||
|
82 | XyPoint { x: 10; y: 3 } | |||
|
83 | XyPoint { x: 11; y: 3 } | |||
|
84 | } | |||
|
85 | lowerSeries: LineSeries { | |||
|
86 | XyPoint { x: 0; y: 0 } | |||
|
87 | XyPoint { x: 1; y: 0 } | |||
|
88 | XyPoint { x: 2; y: 0 } | |||
|
89 | XyPoint { x: 3; y: 0 } | |||
|
90 | XyPoint { x: 4; y: 0 } | |||
|
91 | XyPoint { x: 5; y: 0 } | |||
|
92 | XyPoint { x: 6; y: 0 } | |||
|
93 | XyPoint { x: 7; y: 0 } | |||
|
94 | XyPoint { x: 8; y: 0 } | |||
|
95 | XyPoint { x: 9; y: 0 } | |||
|
96 | XyPoint { x: 10; y: 0 } | |||
|
97 | XyPoint { x: 11; y: 0 } | |||
|
98 | } | |||
|
99 | onClicked: { | |||
|
100 | color = "yellow"; | |||
|
101 | borderColor = "blue"; | |||
|
102 | } | |||
|
103 | } | |||
|
104 | ||||
|
105 | AreaSeries { | |||
|
106 | name: "Finnish" | |||
|
107 | upperSeries: LineSeries { | |||
|
108 | XyPoint { x: 0; y: 0 } | |||
|
109 | XyPoint { x: 1; y: 0 } | |||
|
110 | XyPoint { x: 2; y: 0 } | |||
|
111 | XyPoint { x: 3; y: 0 } | |||
|
112 | XyPoint { x: 4; y: 0 } | |||
|
113 | XyPoint { x: 5; y: 0 } | |||
|
114 | XyPoint { x: 6; y: 1 } | |||
|
115 | XyPoint { x: 7; y: 0 } | |||
|
116 | XyPoint { x: 8; y: 0 } | |||
|
117 | XyPoint { x: 9; y: 0 } | |||
|
118 | XyPoint { x: 10; y: 0 } | |||
|
119 | XyPoint { x: 11; y: 1 } | |||
|
120 | } | |||
|
121 | lowerSeries: LineSeries { | |||
|
122 | XyPoint { x: 0; y: 0 } | |||
|
123 | XyPoint { x: 1; y: 0 } | |||
|
124 | XyPoint { x: 2; y: 0 } | |||
|
125 | XyPoint { x: 3; y: 0 } | |||
|
126 | XyPoint { x: 4; y: 0 } | |||
|
127 | XyPoint { x: 5; y: 0 } | |||
|
128 | XyPoint { x: 6; y: 0 } | |||
|
129 | XyPoint { x: 7; y: 0 } | |||
|
130 | XyPoint { x: 8; y: 0 } | |||
|
131 | XyPoint { x: 9; y: 0 } | |||
|
132 | XyPoint { x: 10; y: 0 } | |||
|
133 | XyPoint { x: 11; y: 0 } | |||
|
134 | } | |||
|
135 | onClicked: { | |||
|
136 | color = "white"; | |||
|
137 | borderColor = "blue"; | |||
|
138 | } | |||
54 | } |
|
139 | } | |
55 | } |
|
140 | } | |
56 | } |
|
141 | } |
@@ -1,41 +1,56 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | //![1] |
|
27 | //![1] | |
28 | ChartView { |
|
28 | ChartView { | |
29 |
title: " |
|
29 | title: "Scatters" | |
30 | anchors.fill: parent |
|
30 | anchors.fill: parent | |
31 | legend.alignment: Qt.AlignBottom |
|
|||
32 | axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"] |
|
|||
33 |
|
31 | |||
34 |
|
|
32 | ScatterSeries { | |
35 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } |
|
33 | id: scatter1 | |
36 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
34 | name: "Scatter1" | |
37 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
|
35 | XyPoint { x: 1.5; y: 1.5 } | |
38 | } |
|
36 | XyPoint { x: 1.5; y: 1.6 } | |
|
37 | XyPoint { x: 1.57; y: 1.55 } | |||
|
38 | XyPoint { x: 1.8; y: 1.8 } | |||
|
39 | XyPoint { x: 1.9; y: 1.6 } | |||
|
40 | XyPoint { x: 2.1; y: 1.3 } | |||
|
41 | XyPoint { x: 2.5; y: 2.1 } | |||
39 | } |
|
42 | } | |
|
43 | ||||
|
44 | ScatterSeries { | |||
|
45 | name: "Scatter2" | |||
|
46 | // ... | |||
40 | //![1] |
|
47 | //![1] | |
|
48 | XyPoint { x: 2.0; y: 2.0 } | |||
|
49 | XyPoint { x: 2.0; y: 2.1 } | |||
|
50 | XyPoint { x: 2.07; y: 2.05 } | |||
|
51 | XyPoint { x: 2.2; y: 2.9 } | |||
|
52 | XyPoint { x: 2.4; y: 2.7 } | |||
|
53 | XyPoint { x: 2.67; y: 2.65 } | |||
|
54 | } | |||
|
55 | } | |||
41 | } |
|
56 | } |
@@ -1,86 +1,88 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | width: parent.width |
|
25 | width: parent.width | |
26 | height: parent.height |
|
26 | height: parent.height | |
27 | property int viewNumber: 1 |
|
27 | property int viewNumber: 1 | |
28 |
|
28 | |||
29 | Loader { |
|
29 | Loader { | |
30 | id: loader |
|
30 | id: loader | |
31 | anchors.top: parent.top |
|
31 | anchors.top: parent.top | |
32 | anchors.bottom: buttons.top |
|
32 | anchors.bottom: buttons.top | |
33 | anchors.left: parent.left |
|
33 | anchors.left: parent.left | |
34 | anchors.right: parent.right |
|
34 | anchors.right: parent.right | |
35 | source: "View" + viewNumber + ".qml"; |
|
35 | source: "View" + viewNumber + ".qml"; | |
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | Row { |
|
38 | Row { | |
39 | id: buttons |
|
39 | id: buttons | |
40 | anchors.bottom: parent.bottom |
|
40 | anchors.bottom: parent.bottom | |
41 | anchors.bottomMargin: 5 |
|
41 | anchors.bottomMargin: 15 | |
42 | anchors.horizontalCenter: parent.horizontalCenter |
|
42 | anchors.horizontalCenter: parent.horizontalCenter | |
43 |
spacing: |
|
43 | spacing: 5 | |
44 |
|
44 | |||
45 | Rectangle { |
|
45 | Rectangle { | |
46 | height: 35 |
|
46 | height: 35 | |
47 | width: 60 |
|
47 | width: 60 | |
48 | color: "#c8955c" |
|
48 | border.color: "#c8955c" | |
|
49 | border.width: 2 | |||
49 | radius: 5 |
|
50 | radius: 5 | |
50 | Text { |
|
51 | Text { | |
51 | anchors.centerIn: parent |
|
52 | anchors.centerIn: parent | |
52 | text: "<" |
|
53 | text: "<" | |
53 | } |
|
54 | } | |
54 | MouseArea { |
|
55 | MouseArea { | |
55 | anchors.fill: parent |
|
56 | anchors.fill: parent | |
56 | onClicked: { |
|
57 | onClicked: { | |
57 | var i = viewNumber - 1; |
|
58 | var i = viewNumber - 1; | |
58 | if (i <= 0) |
|
59 | if (i <= 0) | |
59 |
viewNumber = |
|
60 | viewNumber = 9; | |
60 | else |
|
61 | else | |
61 | viewNumber = i; |
|
62 | viewNumber = i; | |
62 | } |
|
63 | } | |
63 | } |
|
64 | } | |
64 | } |
|
65 | } | |
65 | Rectangle { |
|
66 | Rectangle { | |
66 | height: 35 |
|
67 | height: 35 | |
67 | width: 60 |
|
68 | width: 60 | |
68 | color: "#c8955c" |
|
69 | border.color: "#c8955c" | |
|
70 | border.width: 2 | |||
69 | radius: 5 |
|
71 | radius: 5 | |
70 | Text { |
|
72 | Text { | |
71 | anchors.centerIn: parent |
|
73 | anchors.centerIn: parent | |
72 | text: ">" |
|
74 | text: ">" | |
73 | } |
|
75 | } | |
74 | MouseArea { |
|
76 | MouseArea { | |
75 | anchors.fill: parent |
|
77 | anchors.fill: parent | |
76 | onClicked: { |
|
78 | onClicked: { | |
77 | var i = viewNumber + 1; |
|
79 | var i = viewNumber + 1; | |
78 |
if (i > |
|
80 | if (i > 9) | |
79 | viewNumber = 1; |
|
81 | viewNumber = 1; | |
80 | else |
|
82 | else | |
81 | viewNumber = i; |
|
83 | viewNumber = i; | |
82 | } |
|
84 | } | |
83 | } |
|
85 | } | |
84 | } |
|
86 | } | |
85 | } |
|
87 | } | |
86 | } |
|
88 | } |
@@ -1,11 +1,15 | |||||
1 | <RCC> |
|
1 | <RCC> | |
2 | <qresource prefix="/"> |
|
2 | <qresource prefix="/"> | |
3 | <file>qml/qmlchart/loader.qml</file> |
|
3 | <file>qml/qmlchart/loader.qml</file> | |
4 | <file>qml/qmlchart/main.qml</file> |
|
4 | <file>qml/qmlchart/main.qml</file> | |
5 | <file>qml/qmlchart/View1.qml</file> |
|
5 | <file>qml/qmlchart/View1.qml</file> | |
6 | <file>qml/qmlchart/View2.qml</file> |
|
6 | <file>qml/qmlchart/View2.qml</file> | |
7 | <file>qml/qmlchart/View3.qml</file> |
|
7 | <file>qml/qmlchart/View3.qml</file> | |
8 | <file>qml/qmlchart/View4.qml</file> |
|
8 | <file>qml/qmlchart/View4.qml</file> | |
9 | <file>qml/qmlchart/View5.qml</file> |
|
9 | <file>qml/qmlchart/View5.qml</file> | |
|
10 | <file>qml/qmlchart/View6.qml</file> | |||
|
11 | <file>qml/qmlchart/View7.qml</file> | |||
|
12 | <file>qml/qmlchart/View8.qml</file> | |||
|
13 | <file>qml/qmlchart/View9.qml</file> | |||
10 | </qresource> |
|
14 | </qresource> | |
11 | </RCC> |
|
15 | </RCC> |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,16 +1,27 | |||||
1 | /*! |
|
1 | /*! | |
2 | \page qml.html |
|
2 | \page qml.html | |
3 | \title QtCommercial Charts QML API |
|
3 | \title QtCommercial Charts QML API | |
4 | \keyword Charts QML API |
|
4 | \keyword Charts QML API | |
5 |
|
5 | |||
6 | Charts QML API is an intuitive and simple way to use QtCommercial Charts in your QML applications. |
|
6 | Charts QML API is an intuitive and simple way to use QtCommercial Charts in your QML applications. | |
7 |
|
7 | |||
8 | \raw HTML |
|
8 | \raw HTML | |
9 | <ul> |
|
9 | <ul> | |
10 | <li><a href="qml-chartview.html">ChartView</a></li> |
|
10 | <li><a href="qml-chartview.html">ChartView</a></li> | |
|
11 | <li><a href="qml-lineseries.html">LineSeries</a></li> | |||
|
12 | <li><a href="qml-areaseries.html">AreaSeries</a></li> | |||
|
13 | <li><a href="qml-scatterseries.html">ScatterSeries</a></li> | |||
|
14 | <li><a href="qml-splineseries.html">SplineSeries</a></li> | |||
11 | <li><a href="qml-pieseries.html">PieSeries</a></li> |
|
15 | <li><a href="qml-pieseries.html">PieSeries</a></li> | |
|
16 | <li><a href="qml-pieslice.html">PieSlice</a></li> | |||
|
17 | <li><a href="qml-barseries.html">BarSeries</a></li> | |||
|
18 | <li><a href="qml-groupedbarseries.html">GroupedBarSeries</a></li> | |||
|
19 | <li><a href="qml-stackedbarseries.html">StackedBarSeries</a></li> | |||
|
20 | <li><a href="qml-percentbarseries.html">PercentBarSeries</a></li> | |||
|
21 | <li><a href="qml-barset.html">BarSet</a></li> | |||
12 | <li><a href="qml-axis.html">Axis</a></li> |
|
22 | <li><a href="qml-axis.html">Axis</a></li> | |
13 | <li><a href="qml-legend.html">Legend</a></li> |
|
23 | <li><a href="qml-legend.html">Legend</a></li> | |
|
24 | <li><a href="qml-xypoint.html">XyPoint</a></li> | |||
14 | </ul> |
|
25 | </ul> | |
15 | \endraw |
|
26 | \endraw | |
16 | */ |
|
27 | */ |
@@ -1,79 +1,93 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativeareaseries.h" |
|
21 | #include "declarativeareaseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qxymodelmapper.h" |
|
24 | #include "qxymodelmapper.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
|
28 | /*! | |||
|
29 | \qmlclass AreaSeries QAreaSeries | |||
|
30 | ||||
|
31 | \section1 Example Usage | |||
|
32 | ||||
|
33 | \beginfloatleft | |||
|
34 | \image demos_qmlchart4.png | |||
|
35 | \endfloat | |||
|
36 | \clearfloat | |||
|
37 | ||||
|
38 | The following QML shows how to create a simple area chart: | |||
|
39 | \snippet ../demos/qmlchart/qml/qmlchart/View4.qml 1 | |||
|
40 | */ | |||
|
41 | ||||
28 | DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) : |
|
42 | DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) : | |
29 | QAreaSeries(parent) |
|
43 | QAreaSeries(parent) | |
30 | { |
|
44 | { | |
31 | } |
|
45 | } | |
32 |
|
46 | |||
33 | void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries* series) |
|
47 | void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries* series) | |
34 | { |
|
48 | { | |
35 | QAreaSeries::setUpperSeries(series); |
|
49 | QAreaSeries::setUpperSeries(series); | |
36 | } |
|
50 | } | |
37 |
|
51 | |||
38 | DeclarativeLineSeries* DeclarativeAreaSeries::upperSeries() const |
|
52 | DeclarativeLineSeries* DeclarativeAreaSeries::upperSeries() const | |
39 | { |
|
53 | { | |
40 | return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries()); |
|
54 | return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries()); | |
41 | } |
|
55 | } | |
42 |
|
56 | |||
43 | void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries* series) |
|
57 | void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries* series) | |
44 | { |
|
58 | { | |
45 | QAreaSeries::setLowerSeries(series); |
|
59 | QAreaSeries::setLowerSeries(series); | |
46 | } |
|
60 | } | |
47 |
|
61 | |||
48 | DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const |
|
62 | DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const | |
49 | { |
|
63 | { | |
50 | return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries()); |
|
64 | return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries()); | |
51 | } |
|
65 | } | |
52 |
|
66 | |||
53 | QColor DeclarativeAreaSeries::penColor() const |
|
67 | QColor DeclarativeAreaSeries::penColor() const | |
54 | { |
|
68 | { | |
55 | return pen().color(); |
|
69 | return pen().color(); | |
56 | } |
|
70 | } | |
57 |
|
71 | |||
58 | void DeclarativeAreaSeries::setPenColor(QColor color) |
|
72 | void DeclarativeAreaSeries::setPenColor(QColor color) | |
59 | { |
|
73 | { | |
60 | QPen p = pen(); |
|
74 | QPen p = pen(); | |
61 | p.setColor(color); |
|
75 | p.setColor(color); | |
62 | setPen(p); |
|
76 | setPen(p); | |
63 | } |
|
77 | } | |
64 |
|
78 | |||
65 | QColor DeclarativeAreaSeries::brushColor() const |
|
79 | QColor DeclarativeAreaSeries::brushColor() const | |
66 | { |
|
80 | { | |
67 | return brush().color(); |
|
81 | return brush().color(); | |
68 | } |
|
82 | } | |
69 |
|
83 | |||
70 | void DeclarativeAreaSeries::setBrushColor(QColor color) |
|
84 | void DeclarativeAreaSeries::setBrushColor(QColor color) | |
71 | { |
|
85 | { | |
72 | QBrush b = brush(); |
|
86 | QBrush b = brush(); | |
73 | b.setColor(color); |
|
87 | b.setColor(color); | |
74 | setBrush(b); |
|
88 | setBrush(b); | |
75 | } |
|
89 | } | |
76 |
|
90 | |||
77 | #include "moc_declarativeareaseries.cpp" |
|
91 | #include "moc_declarativeareaseries.cpp" | |
78 |
|
92 | |||
79 | QTCOMMERCIALCHART_END_NAMESPACE |
|
93 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,244 +1,300 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativebarseries.h" |
|
21 | #include "declarativebarseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include <QBarSet> |
|
23 | #include <QBarSet> | |
24 | #include <QVBarModelMapper> |
|
24 | #include <QVBarModelMapper> | |
25 | #include <QHBarModelMapper> |
|
25 | #include <QHBarModelMapper> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
|
29 | /*! | |||
|
30 | \qmlclass BarSeries QBarSeries | |||
|
31 | ||||
|
32 | \section1 Example Usage | |||
|
33 | ||||
|
34 | \beginfloatleft | |||
|
35 | \image demos_qmlchart6.png | |||
|
36 | \endfloat | |||
|
37 | \clearfloat | |||
|
38 | ||||
|
39 | The following QML shows how to create a simple bar chart: | |||
|
40 | \snippet ../demos/qmlchart/qml/qmlchart/View6.qml 1 | |||
|
41 | */ | |||
|
42 | ||||
|
43 | /*! | |||
|
44 | \qmlclass GroupedBarSeries QGroupedBarSeries | |||
|
45 | ||||
|
46 | \section1 Example Usage | |||
|
47 | ||||
|
48 | \beginfloatleft | |||
|
49 | \image demos_qmlchart7.png | |||
|
50 | \endfloat | |||
|
51 | \clearfloat | |||
|
52 | ||||
|
53 | The following QML shows how to create a simple grouped bar chart: | |||
|
54 | \snippet ../demos/qmlchart/qml/qmlchart/View7.qml 1 | |||
|
55 | */ | |||
|
56 | ||||
|
57 | /*! | |||
|
58 | \qmlclass StackedBarSeries QStackedBarSeries | |||
|
59 | ||||
|
60 | \section1 Example Usage | |||
|
61 | ||||
|
62 | \beginfloatleft | |||
|
63 | \image demos_qmlchart8.png | |||
|
64 | \endfloat | |||
|
65 | \clearfloat | |||
|
66 | ||||
|
67 | The following QML shows how to create a simple stacked bar chart: | |||
|
68 | \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 | |||
|
69 | */ | |||
|
70 | ||||
|
71 | /*! | |||
|
72 | \qmlclass PercentBarSeries QPercentBarSeries | |||
|
73 | ||||
|
74 | \section1 Example Usage | |||
|
75 | ||||
|
76 | \beginfloatleft | |||
|
77 | \image demos_qmlchart9.png | |||
|
78 | \endfloat | |||
|
79 | \clearfloat | |||
|
80 | ||||
|
81 | The following QML shows how to create a simple percent bar chart: | |||
|
82 | \snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1 | |||
|
83 | */ | |||
|
84 | ||||
29 | DeclarativeBarSet::DeclarativeBarSet(QObject *parent) : |
|
85 | DeclarativeBarSet::DeclarativeBarSet(QObject *parent) : | |
30 | QBarSet("", parent) |
|
86 | QBarSet("", parent) | |
31 | { |
|
87 | { | |
32 | connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int, int))); |
|
88 | connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int, int))); | |
33 | connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int, int))); |
|
89 | connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int, int))); | |
34 | } |
|
90 | } | |
35 |
|
91 | |||
36 | void DeclarativeBarSet::handleCountChanged(int index, int count) |
|
92 | void DeclarativeBarSet::handleCountChanged(int index, int count) | |
37 | { |
|
93 | { | |
38 | Q_UNUSED(index) |
|
94 | Q_UNUSED(index) | |
39 | Q_UNUSED(count) |
|
95 | Q_UNUSED(count) | |
40 | emit countChanged(QBarSet::count()); |
|
96 | emit countChanged(QBarSet::count()); | |
41 | } |
|
97 | } | |
42 |
|
98 | |||
43 | QVariantList DeclarativeBarSet::values() |
|
99 | QVariantList DeclarativeBarSet::values() | |
44 | { |
|
100 | { | |
45 | QVariantList values; |
|
101 | QVariantList values; | |
46 | for (int i(0); i < count(); i++) |
|
102 | for (int i(0); i < count(); i++) | |
47 | values.append(QVariant(at(i))); |
|
103 | values.append(QVariant(at(i))); | |
48 | return values; |
|
104 | return values; | |
49 | } |
|
105 | } | |
50 |
|
106 | |||
51 | void DeclarativeBarSet::setValues(QVariantList values) |
|
107 | void DeclarativeBarSet::setValues(QVariantList values) | |
52 | { |
|
108 | { | |
53 | while (count()) |
|
109 | while (count()) | |
54 | remove(count() - 1); |
|
110 | remove(count() - 1); | |
55 |
|
111 | |||
56 | for (int i(0); i < values.count(); i++) { |
|
112 | for (int i(0); i < values.count(); i++) { | |
57 | if (values.at(i).canConvert(QVariant::Double)) |
|
113 | if (values.at(i).canConvert(QVariant::Double)) | |
58 | append(values[i].toDouble()); |
|
114 | append(values[i].toDouble()); | |
59 | } |
|
115 | } | |
60 | } |
|
116 | } | |
61 |
|
117 | |||
62 | DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) : |
|
118 | DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) : | |
63 | QBarSeries(parent) |
|
119 | QBarSeries(parent) | |
64 | { |
|
120 | { | |
65 | } |
|
121 | } | |
66 |
|
122 | |||
67 | void DeclarativeBarSeries::classBegin() |
|
123 | void DeclarativeBarSeries::classBegin() | |
68 | { |
|
124 | { | |
69 | } |
|
125 | } | |
70 |
|
126 | |||
71 | void DeclarativeBarSeries::componentComplete() |
|
127 | void DeclarativeBarSeries::componentComplete() | |
72 | { |
|
128 | { | |
73 | foreach(QObject *child, children()) { |
|
129 | foreach(QObject *child, children()) { | |
74 | if (qobject_cast<DeclarativeBarSet *>(child)) { |
|
130 | if (qobject_cast<DeclarativeBarSet *>(child)) { | |
75 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); |
|
131 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); | |
76 | } else if(qobject_cast<QVBarModelMapper *>(child)) { |
|
132 | } else if(qobject_cast<QVBarModelMapper *>(child)) { | |
77 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); |
|
133 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); | |
78 | mapper->setSeries(this); |
|
134 | mapper->setSeries(this); | |
79 | } else if(qobject_cast<QHBarModelMapper *>(child)) { |
|
135 | } else if(qobject_cast<QHBarModelMapper *>(child)) { | |
80 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); |
|
136 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); | |
81 | mapper->setSeries(this); |
|
137 | mapper->setSeries(this); | |
82 | } |
|
138 | } | |
83 | } |
|
139 | } | |
84 | } |
|
140 | } | |
85 |
|
141 | |||
86 | QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren() |
|
142 | QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren() | |
87 | { |
|
143 | { | |
88 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); |
|
144 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); | |
89 | } |
|
145 | } | |
90 |
|
146 | |||
91 | void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) |
|
147 | void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) | |
92 | { |
|
148 | { | |
93 | // Empty implementation; the children are parsed in componentComplete instead |
|
149 | // Empty implementation; the children are parsed in componentComplete instead | |
94 | Q_UNUSED(list); |
|
150 | Q_UNUSED(list); | |
95 | Q_UNUSED(element); |
|
151 | Q_UNUSED(element); | |
96 | } |
|
152 | } | |
97 |
|
153 | |||
98 | DeclarativeBarSet *DeclarativeBarSeries::at(int index) |
|
154 | DeclarativeBarSet *DeclarativeBarSeries::at(int index) | |
99 | { |
|
155 | { | |
100 | QList<QBarSet*> setList = barSets(); |
|
156 | QList<QBarSet*> setList = barSets(); | |
101 | if (index < setList.count()) |
|
157 | if (index < setList.count()) | |
102 | return qobject_cast<DeclarativeBarSet *>(setList[index]); |
|
158 | return qobject_cast<DeclarativeBarSet *>(setList[index]); | |
103 |
|
159 | |||
104 | return 0; |
|
160 | return 0; | |
105 | } |
|
161 | } | |
106 |
|
162 | |||
107 | DeclarativeGroupedBarSeries::DeclarativeGroupedBarSeries(QDeclarativeItem *parent) : |
|
163 | DeclarativeGroupedBarSeries::DeclarativeGroupedBarSeries(QDeclarativeItem *parent) : | |
108 | QGroupedBarSeries(parent) |
|
164 | QGroupedBarSeries(parent) | |
109 | { |
|
165 | { | |
110 | } |
|
166 | } | |
111 |
|
167 | |||
112 | void DeclarativeGroupedBarSeries::classBegin() |
|
168 | void DeclarativeGroupedBarSeries::classBegin() | |
113 | { |
|
169 | { | |
114 | } |
|
170 | } | |
115 |
|
171 | |||
116 | void DeclarativeGroupedBarSeries::componentComplete() |
|
172 | void DeclarativeGroupedBarSeries::componentComplete() | |
117 | { |
|
173 | { | |
118 | foreach(QObject *child, children()) { |
|
174 | foreach(QObject *child, children()) { | |
119 | if (qobject_cast<DeclarativeBarSet *>(child)) { |
|
175 | if (qobject_cast<DeclarativeBarSet *>(child)) { | |
120 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); |
|
176 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); | |
121 | } else if(qobject_cast<QVBarModelMapper *>(child)) { |
|
177 | } else if(qobject_cast<QVBarModelMapper *>(child)) { | |
122 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); |
|
178 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); | |
123 | mapper->setSeries(this); |
|
179 | mapper->setSeries(this); | |
124 | } else if(qobject_cast<QHBarModelMapper *>(child)) { |
|
180 | } else if(qobject_cast<QHBarModelMapper *>(child)) { | |
125 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); |
|
181 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); | |
126 | mapper->setSeries(this); |
|
182 | mapper->setSeries(this); | |
127 | } |
|
183 | } | |
128 | } |
|
184 | } | |
129 | } |
|
185 | } | |
130 |
|
186 | |||
131 | QDeclarativeListProperty<QObject> DeclarativeGroupedBarSeries::seriesChildren() |
|
187 | QDeclarativeListProperty<QObject> DeclarativeGroupedBarSeries::seriesChildren() | |
132 | { |
|
188 | { | |
133 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); |
|
189 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); | |
134 | } |
|
190 | } | |
135 |
|
191 | |||
136 | void DeclarativeGroupedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) |
|
192 | void DeclarativeGroupedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) | |
137 | { |
|
193 | { | |
138 | // Empty implementation; the children are parsed in componentComplete instead |
|
194 | // Empty implementation; the children are parsed in componentComplete instead | |
139 | Q_UNUSED(list); |
|
195 | Q_UNUSED(list); | |
140 | Q_UNUSED(element); |
|
196 | Q_UNUSED(element); | |
141 | } |
|
197 | } | |
142 |
|
198 | |||
143 | DeclarativeBarSet *DeclarativeGroupedBarSeries::at(int index) |
|
199 | DeclarativeBarSet *DeclarativeGroupedBarSeries::at(int index) | |
144 | { |
|
200 | { | |
145 | QList<QBarSet*> setList = barSets(); |
|
201 | QList<QBarSet*> setList = barSets(); | |
146 | if (index < setList.count()) |
|
202 | if (index < setList.count()) | |
147 | return qobject_cast<DeclarativeBarSet *>(setList[index]); |
|
203 | return qobject_cast<DeclarativeBarSet *>(setList[index]); | |
148 |
|
204 | |||
149 | return 0; |
|
205 | return 0; | |
150 | } |
|
206 | } | |
151 |
|
207 | |||
152 | DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDeclarativeItem *parent) : |
|
208 | DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QDeclarativeItem *parent) : | |
153 | QStackedBarSeries(parent) |
|
209 | QStackedBarSeries(parent) | |
154 | { |
|
210 | { | |
155 | } |
|
211 | } | |
156 |
|
212 | |||
157 | void DeclarativeStackedBarSeries::classBegin() |
|
213 | void DeclarativeStackedBarSeries::classBegin() | |
158 | { |
|
214 | { | |
159 | } |
|
215 | } | |
160 |
|
216 | |||
161 | void DeclarativeStackedBarSeries::componentComplete() |
|
217 | void DeclarativeStackedBarSeries::componentComplete() | |
162 | { |
|
218 | { | |
163 | foreach(QObject *child, children()) { |
|
219 | foreach(QObject *child, children()) { | |
164 | if (qobject_cast<DeclarativeBarSet *>(child)) { |
|
220 | if (qobject_cast<DeclarativeBarSet *>(child)) { | |
165 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); |
|
221 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); | |
166 | } else if(qobject_cast<QVBarModelMapper *>(child)) { |
|
222 | } else if(qobject_cast<QVBarModelMapper *>(child)) { | |
167 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); |
|
223 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); | |
168 | mapper->setSeries(this); |
|
224 | mapper->setSeries(this); | |
169 | } else if(qobject_cast<QHBarModelMapper *>(child)) { |
|
225 | } else if(qobject_cast<QHBarModelMapper *>(child)) { | |
170 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); |
|
226 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); | |
171 | mapper->setSeries(this); |
|
227 | mapper->setSeries(this); | |
172 | } |
|
228 | } | |
173 | } |
|
229 | } | |
174 | } |
|
230 | } | |
175 |
|
231 | |||
176 | QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren() |
|
232 | QDeclarativeListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren() | |
177 | { |
|
233 | { | |
178 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); |
|
234 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); | |
179 | } |
|
235 | } | |
180 |
|
236 | |||
181 | void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) |
|
237 | void DeclarativeStackedBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) | |
182 | { |
|
238 | { | |
183 | // Empty implementation; the children are parsed in componentComplete instead |
|
239 | // Empty implementation; the children are parsed in componentComplete instead | |
184 | Q_UNUSED(list); |
|
240 | Q_UNUSED(list); | |
185 | Q_UNUSED(element); |
|
241 | Q_UNUSED(element); | |
186 | } |
|
242 | } | |
187 |
|
243 | |||
188 | DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index) |
|
244 | DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index) | |
189 | { |
|
245 | { | |
190 | QList<QBarSet*> setList = barSets(); |
|
246 | QList<QBarSet*> setList = barSets(); | |
191 | if (index < setList.count()) |
|
247 | if (index < setList.count()) | |
192 | return qobject_cast<DeclarativeBarSet *>(setList[index]); |
|
248 | return qobject_cast<DeclarativeBarSet *>(setList[index]); | |
193 |
|
249 | |||
194 | return 0; |
|
250 | return 0; | |
195 | } |
|
251 | } | |
196 |
|
252 | |||
197 | DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDeclarativeItem *parent) : |
|
253 | DeclarativePercentBarSeries::DeclarativePercentBarSeries(QDeclarativeItem *parent) : | |
198 | QPercentBarSeries(parent) |
|
254 | QPercentBarSeries(parent) | |
199 | { |
|
255 | { | |
200 | } |
|
256 | } | |
201 |
|
257 | |||
202 | void DeclarativePercentBarSeries::classBegin() |
|
258 | void DeclarativePercentBarSeries::classBegin() | |
203 | { |
|
259 | { | |
204 | } |
|
260 | } | |
205 |
|
261 | |||
206 | void DeclarativePercentBarSeries::componentComplete() |
|
262 | void DeclarativePercentBarSeries::componentComplete() | |
207 | { |
|
263 | { | |
208 | foreach(QObject *child, children()) { |
|
264 | foreach(QObject *child, children()) { | |
209 | if (qobject_cast<DeclarativeBarSet *>(child)) { |
|
265 | if (qobject_cast<DeclarativeBarSet *>(child)) { | |
210 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); |
|
266 | QBarSeries::append(qobject_cast<DeclarativeBarSet *>(child)); | |
211 | } else if(qobject_cast<QVBarModelMapper *>(child)) { |
|
267 | } else if(qobject_cast<QVBarModelMapper *>(child)) { | |
212 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); |
|
268 | QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child); | |
213 | mapper->setSeries(this); |
|
269 | mapper->setSeries(this); | |
214 | } else if(qobject_cast<QHBarModelMapper *>(child)) { |
|
270 | } else if(qobject_cast<QHBarModelMapper *>(child)) { | |
215 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); |
|
271 | QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child); | |
216 | mapper->setSeries(this); |
|
272 | mapper->setSeries(this); | |
217 | } |
|
273 | } | |
218 | } |
|
274 | } | |
219 | } |
|
275 | } | |
220 |
|
276 | |||
221 | QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren() |
|
277 | QDeclarativeListProperty<QObject> DeclarativePercentBarSeries::seriesChildren() | |
222 | { |
|
278 | { | |
223 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); |
|
279 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren); | |
224 | } |
|
280 | } | |
225 |
|
281 | |||
226 | void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) |
|
282 | void DeclarativePercentBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) | |
227 | { |
|
283 | { | |
228 | // Empty implementation; the children are parsed in componentComplete instead |
|
284 | // Empty implementation; the children are parsed in componentComplete instead | |
229 | Q_UNUSED(list); |
|
285 | Q_UNUSED(list); | |
230 | Q_UNUSED(element); |
|
286 | Q_UNUSED(element); | |
231 | } |
|
287 | } | |
232 |
|
288 | |||
233 | DeclarativeBarSet *DeclarativePercentBarSeries::at(int index) |
|
289 | DeclarativeBarSet *DeclarativePercentBarSeries::at(int index) | |
234 | { |
|
290 | { | |
235 | QList<QBarSet*> setList = barSets(); |
|
291 | QList<QBarSet*> setList = barSets(); | |
236 | if (index < setList.count()) |
|
292 | if (index < setList.count()) | |
237 | return qobject_cast<DeclarativeBarSet *>(setList[index]); |
|
293 | return qobject_cast<DeclarativeBarSet *>(setList[index]); | |
238 |
|
294 | |||
239 | return 0; |
|
295 | return 0; | |
240 | } |
|
296 | } | |
241 |
|
297 | |||
242 | #include "moc_declarativebarseries.cpp" |
|
298 | #include "moc_declarativebarseries.cpp" | |
243 |
|
299 | |||
244 | QTCOMMERCIALCHART_END_NAMESPACE |
|
300 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,60 +1,74 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativelineseries.h" |
|
21 | #include "declarativelineseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qlineseries.h" |
|
24 | #include "qlineseries.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
|
28 | /*! | |||
|
29 | \qmlclass LineSeries QLineSeries | |||
|
30 | ||||
|
31 | \section1 Example Usage | |||
|
32 | ||||
|
33 | \beginfloatleft | |||
|
34 | \image demos_qmlchart2.png | |||
|
35 | \endfloat | |||
|
36 | \clearfloat | |||
|
37 | ||||
|
38 | The following QML shows how to create a simple line chart: | |||
|
39 | \snippet ../demos/qmlchart/qml/qmlchart/View2.qml 1 | |||
|
40 | */ | |||
|
41 | ||||
28 | DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) : |
|
42 | DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) : | |
29 | QLineSeries(parent) |
|
43 | QLineSeries(parent) | |
30 | { |
|
44 | { | |
31 | connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); |
|
45 | connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); | |
32 | connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); |
|
46 | connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); | |
33 | } |
|
47 | } | |
34 |
|
48 | |||
35 | QXYSeries *DeclarativeLineSeries::xySeries() |
|
49 | QXYSeries *DeclarativeLineSeries::xySeries() | |
36 | { |
|
50 | { | |
37 | return this; |
|
51 | return this; | |
38 | } |
|
52 | } | |
39 |
|
53 | |||
40 | void DeclarativeLineSeries::handleCountChanged(int index) |
|
54 | void DeclarativeLineSeries::handleCountChanged(int index) | |
41 | { |
|
55 | { | |
42 | Q_UNUSED(index) |
|
56 | Q_UNUSED(index) | |
43 | emit countChanged(points().count()); |
|
57 | emit countChanged(points().count()); | |
44 | } |
|
58 | } | |
45 |
|
59 | |||
46 | QDeclarativeListProperty<QObject> DeclarativeLineSeries::declarativeChildren() |
|
60 | QDeclarativeListProperty<QObject> DeclarativeLineSeries::declarativeChildren() | |
47 | { |
|
61 | { | |
48 | return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren); |
|
62 | return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren); | |
49 | } |
|
63 | } | |
50 |
|
64 | |||
51 | void DeclarativeLineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element) |
|
65 | void DeclarativeLineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element) | |
52 | { |
|
66 | { | |
53 | Q_UNUSED(list) |
|
67 | Q_UNUSED(list) | |
54 | Q_UNUSED(element) |
|
68 | Q_UNUSED(element) | |
55 | // Empty implementation, childs are parsed in componentComplete |
|
69 | // Empty implementation, childs are parsed in componentComplete | |
56 | } |
|
70 | } | |
57 |
|
71 | |||
58 | #include "moc_declarativelineseries.cpp" |
|
72 | #include "moc_declarativelineseries.cpp" | |
59 |
|
73 | |||
60 | QTCOMMERCIALCHART_END_NAMESPACE |
|
74 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,143 +1,143 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativepieseries.h" |
|
21 | #include "declarativepieseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include <qdeclarativelist.h> |
|
24 | #include <qdeclarativelist.h> | |
25 | #include <QVPieModelMapper> |
|
25 | #include <QVPieModelMapper> | |
26 | #include <QHPieModelMapper> |
|
26 | #include <QHPieModelMapper> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | /*! |
|
30 | /*! | |
31 |
\qmlclass PieSeries |
|
31 | \qmlclass PieSeries QPieSeries | |
32 |
|
32 | |||
33 | \section1 Example Usage |
|
33 | \section1 Example Usage | |
34 |
|
34 | |||
35 | \beginfloatleft |
|
35 | \beginfloatleft | |
36 | \image demos_qmlchart1.png |
|
36 | \image demos_qmlchart1.png | |
37 | \endfloat |
|
37 | \endfloat | |
38 | \clearfloat |
|
38 | \clearfloat | |
39 |
|
39 | |||
40 | The following QML shows how to create a simple pie chart. |
|
40 | The following QML shows how to create a simple pie chart. | |
41 |
|
41 | |||
42 | \snippet ../demos/qmlchart/qml/qmlchart/View1.qml 1 |
|
42 | \snippet ../demos/qmlchart/qml/qmlchart/View1.qml 1 | |
43 | */ |
|
43 | */ | |
44 |
|
44 | |||
45 | /*! |
|
45 | /*! | |
46 | \qmlproperty real PieSeries::horizontalPosition |
|
46 | \qmlproperty real PieSeries::horizontalPosition | |
47 | \brief Defines the horizontal position of the pie. |
|
47 | \brief Defines the horizontal position of the pie. | |
48 |
|
48 | |||
49 | The value is a relative value to the chart rectangle where: |
|
49 | The value is a relative value to the chart rectangle where: | |
50 |
|
50 | |||
51 | \list |
|
51 | \list | |
52 | \o 0.0 is the absolute left. |
|
52 | \o 0.0 is the absolute left. | |
53 | \o 1.0 is the absolute right. |
|
53 | \o 1.0 is the absolute right. | |
54 | \endlist |
|
54 | \endlist | |
55 |
|
55 | |||
56 | Default value is 0.5 (center). |
|
56 | Default value is 0.5 (center). | |
57 |
|
57 | |||
58 | \sa verticalPosition |
|
58 | \sa verticalPosition | |
59 | */ |
|
59 | */ | |
60 |
|
60 | |||
61 | /*! |
|
61 | /*! | |
62 | \qmlproperty real PieSeries::verticalPosition |
|
62 | \qmlproperty real PieSeries::verticalPosition | |
63 | \brief Defines the vertical position of the pie. |
|
63 | \brief Defines the vertical position of the pie. | |
64 |
|
64 | |||
65 | The value is a relative value to the chart rectangle where: |
|
65 | The value is a relative value to the chart rectangle where: | |
66 |
|
66 | |||
67 | \list |
|
67 | \list | |
68 | \o 0.0 is the absolute top. |
|
68 | \o 0.0 is the absolute top. | |
69 | \o 1.0 is the absolute bottom. |
|
69 | \o 1.0 is the absolute bottom. | |
70 | \endlist |
|
70 | \endlist | |
71 |
|
71 | |||
72 | Default value is 0.5 (center). |
|
72 | Default value is 0.5 (center). | |
73 |
|
73 | |||
74 | \sa horizontalPosition |
|
74 | \sa horizontalPosition | |
75 | */ |
|
75 | */ | |
76 |
|
76 | |||
77 | DeclarativePieSeries::DeclarativePieSeries(QObject *parent) : |
|
77 | DeclarativePieSeries::DeclarativePieSeries(QObject *parent) : | |
78 | QPieSeries(parent) |
|
78 | QPieSeries(parent) | |
79 | { |
|
79 | { | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | void DeclarativePieSeries::classBegin() |
|
82 | void DeclarativePieSeries::classBegin() | |
83 | { |
|
83 | { | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | void DeclarativePieSeries::componentComplete() |
|
86 | void DeclarativePieSeries::componentComplete() | |
87 | { |
|
87 | { | |
88 | foreach(QObject *child, children()) { |
|
88 | foreach(QObject *child, children()) { | |
89 | if (qobject_cast<QPieSlice *>(child)) { |
|
89 | if (qobject_cast<QPieSlice *>(child)) { | |
90 | QPieSeries::append(qobject_cast<QPieSlice *>(child)); |
|
90 | QPieSeries::append(qobject_cast<QPieSlice *>(child)); | |
91 | } else if(qobject_cast<QVPieModelMapper *>(child)) { |
|
91 | } else if(qobject_cast<QVPieModelMapper *>(child)) { | |
92 | QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child); |
|
92 | QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child); | |
93 | mapper->setSeries(this); |
|
93 | mapper->setSeries(this); | |
94 | } else if(qobject_cast<QHPieModelMapper *>(child)) { |
|
94 | } else if(qobject_cast<QHPieModelMapper *>(child)) { | |
95 | QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child); |
|
95 | QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child); | |
96 | mapper->setSeries(this); |
|
96 | mapper->setSeries(this); | |
97 | } |
|
97 | } | |
98 | } |
|
98 | } | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren() |
|
101 | QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren() | |
102 | { |
|
102 | { | |
103 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren); |
|
103 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren); | |
104 | } |
|
104 | } | |
105 |
|
105 | |||
106 | void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) |
|
106 | void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) | |
107 | { |
|
107 | { | |
108 | // Empty implementation; the children are parsed in componentComplete instead |
|
108 | // Empty implementation; the children are parsed in componentComplete instead | |
109 | Q_UNUSED(list); |
|
109 | Q_UNUSED(list); | |
110 | Q_UNUSED(element); |
|
110 | Q_UNUSED(element); | |
111 | } |
|
111 | } | |
112 |
|
112 | |||
113 | QPieSlice *DeclarativePieSeries::at(int index) |
|
113 | QPieSlice *DeclarativePieSeries::at(int index) | |
114 | { |
|
114 | { | |
115 | QList<QPieSlice*> sliceList = slices(); |
|
115 | QList<QPieSlice*> sliceList = slices(); | |
116 | if (index < sliceList.count()) |
|
116 | if (index < sliceList.count()) | |
117 | return sliceList[index]; |
|
117 | return sliceList[index]; | |
118 |
|
118 | |||
119 | return 0; |
|
119 | return 0; | |
120 | } |
|
120 | } | |
121 |
|
121 | |||
122 | QPieSlice* DeclarativePieSeries::find(QString label) |
|
122 | QPieSlice* DeclarativePieSeries::find(QString label) | |
123 | { |
|
123 | { | |
124 | foreach (QPieSlice *slice, slices()) { |
|
124 | foreach (QPieSlice *slice, slices()) { | |
125 | if (slice->label() == label) |
|
125 | if (slice->label() == label) | |
126 | return slice; |
|
126 | return slice; | |
127 | } |
|
127 | } | |
128 | return 0; |
|
128 | return 0; | |
129 | } |
|
129 | } | |
130 |
|
130 | |||
131 | QPieSlice* DeclarativePieSeries::append(QString label, qreal value) |
|
131 | QPieSlice* DeclarativePieSeries::append(QString label, qreal value) | |
132 | { |
|
132 | { | |
133 | // TODO: parameter order is wrong, switch it: |
|
133 | // TODO: parameter order is wrong, switch it: | |
134 | QPieSlice *slice = new QPieSlice(this); |
|
134 | QPieSlice *slice = new QPieSlice(this); | |
135 | slice->setLabel(label); |
|
135 | slice->setLabel(label); | |
136 | slice->setValue(value); |
|
136 | slice->setValue(value); | |
137 | QPieSeries::append(slice); |
|
137 | QPieSeries::append(slice); | |
138 | return slice; |
|
138 | return slice; | |
139 | } |
|
139 | } | |
140 |
|
140 | |||
141 | #include "moc_declarativepieseries.cpp" |
|
141 | #include "moc_declarativepieseries.cpp" | |
142 |
|
142 | |||
143 | QTCOMMERCIALCHART_END_NAMESPACE |
|
143 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,72 +1,86 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativescatterseries.h" |
|
21 | #include "declarativescatterseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qscatterseries.h" |
|
24 | #include "qscatterseries.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
|
28 | /*! | |||
|
29 | \qmlclass ScatterSeries QScatterSeries | |||
|
30 | ||||
|
31 | \section1 Example Usage | |||
|
32 | ||||
|
33 | \beginfloatleft | |||
|
34 | \image demos_qmlchart5.png | |||
|
35 | \endfloat | |||
|
36 | \clearfloat | |||
|
37 | ||||
|
38 | The following QML shows how to create a simple scatter chart: | |||
|
39 | \snippet ../demos/qmlchart/qml/qmlchart/View5.qml 1 | |||
|
40 | */ | |||
|
41 | ||||
28 | DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) : |
|
42 | DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) : | |
29 | QScatterSeries(parent) |
|
43 | QScatterSeries(parent) | |
30 | { |
|
44 | { | |
31 | connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); |
|
45 | connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); | |
32 | connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); |
|
46 | connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); | |
33 | } |
|
47 | } | |
34 |
|
48 | |||
35 | QXYSeries *DeclarativeScatterSeries::xySeries() |
|
49 | QXYSeries *DeclarativeScatterSeries::xySeries() | |
36 | { |
|
50 | { | |
37 | return this; |
|
51 | return this; | |
38 | } |
|
52 | } | |
39 |
|
53 | |||
40 | void DeclarativeScatterSeries::handleCountChanged(int index) |
|
54 | void DeclarativeScatterSeries::handleCountChanged(int index) | |
41 | { |
|
55 | { | |
42 | Q_UNUSED(index) |
|
56 | Q_UNUSED(index) | |
43 | emit countChanged(QScatterSeries::count()); |
|
57 | emit countChanged(QScatterSeries::count()); | |
44 | } |
|
58 | } | |
45 |
|
59 | |||
46 | QDeclarativeListProperty<QObject> DeclarativeScatterSeries::declarativeChildren() |
|
60 | QDeclarativeListProperty<QObject> DeclarativeScatterSeries::declarativeChildren() | |
47 | { |
|
61 | { | |
48 | return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren); |
|
62 | return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren); | |
49 | } |
|
63 | } | |
50 |
|
64 | |||
51 | void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element) |
|
65 | void DeclarativeScatterSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element) | |
52 | { |
|
66 | { | |
53 | Q_UNUSED(list) |
|
67 | Q_UNUSED(list) | |
54 | Q_UNUSED(element) |
|
68 | Q_UNUSED(element) | |
55 | // Empty implementation, childs are parsed in componentComplete |
|
69 | // Empty implementation, childs are parsed in componentComplete | |
56 | } |
|
70 | } | |
57 |
|
71 | |||
58 | QColor DeclarativeScatterSeries::brushColor() |
|
72 | QColor DeclarativeScatterSeries::brushColor() | |
59 | { |
|
73 | { | |
60 | return brush().color(); |
|
74 | return brush().color(); | |
61 | } |
|
75 | } | |
62 |
|
76 | |||
63 | void DeclarativeScatterSeries::setBrushColor(QColor color) |
|
77 | void DeclarativeScatterSeries::setBrushColor(QColor color) | |
64 | { |
|
78 | { | |
65 | QBrush b = brush(); |
|
79 | QBrush b = brush(); | |
66 | b.setColor(color); |
|
80 | b.setColor(color); | |
67 | setBrush(b); |
|
81 | setBrush(b); | |
68 | } |
|
82 | } | |
69 |
|
83 | |||
70 | #include "moc_declarativescatterseries.cpp" |
|
84 | #include "moc_declarativescatterseries.cpp" | |
71 |
|
85 | |||
72 | QTCOMMERCIALCHART_END_NAMESPACE |
|
86 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,60 +1,74 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativesplineseries.h" |
|
21 | #include "declarativesplineseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include <QChart> |
|
23 | #include <QChart> | |
24 | #include "declarativexypoint.h" |
|
24 | #include "declarativexypoint.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
|
28 | /*! | |||
|
29 | \qmlclass SplineSeries QSplineSeries | |||
|
30 | ||||
|
31 | \section1 Example Usage | |||
|
32 | ||||
|
33 | \beginfloatleft | |||
|
34 | \image demos_qmlchart3.png | |||
|
35 | \endfloat | |||
|
36 | \clearfloat | |||
|
37 | ||||
|
38 | The following QML shows how to create a simple spline chart: | |||
|
39 | \snippet ../demos/qmlchart/qml/qmlchart/View3.qml 1 | |||
|
40 | */ | |||
|
41 | ||||
28 | DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) : |
|
42 | DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) : | |
29 | QSplineSeries(parent) |
|
43 | QSplineSeries(parent) | |
30 | { |
|
44 | { | |
31 | connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); |
|
45 | connect(this, SIGNAL(pointAdded(int)), this, SLOT(handleCountChanged(int))); | |
32 | connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); |
|
46 | connect(this, SIGNAL(pointRemoved(int)), this, SLOT(handleCountChanged(int))); | |
33 | } |
|
47 | } | |
34 |
|
48 | |||
35 | QXYSeries *DeclarativeSplineSeries::xySeries() |
|
49 | QXYSeries *DeclarativeSplineSeries::xySeries() | |
36 | { |
|
50 | { | |
37 | return this; |
|
51 | return this; | |
38 | } |
|
52 | } | |
39 |
|
53 | |||
40 | void DeclarativeSplineSeries::handleCountChanged(int index) |
|
54 | void DeclarativeSplineSeries::handleCountChanged(int index) | |
41 | { |
|
55 | { | |
42 | Q_UNUSED(index) |
|
56 | Q_UNUSED(index) | |
43 | emit countChanged(points().count()); |
|
57 | emit countChanged(points().count()); | |
44 | } |
|
58 | } | |
45 |
|
59 | |||
46 | QDeclarativeListProperty<QObject> DeclarativeSplineSeries::declarativeChildren() |
|
60 | QDeclarativeListProperty<QObject> DeclarativeSplineSeries::declarativeChildren() | |
47 | { |
|
61 | { | |
48 | return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren); |
|
62 | return QDeclarativeListProperty<QObject>(this, 0, &appendDeclarativeChildren); | |
49 | } |
|
63 | } | |
50 |
|
64 | |||
51 | void DeclarativeSplineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element) |
|
65 | void DeclarativeSplineSeries::appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element) | |
52 | { |
|
66 | { | |
53 | Q_UNUSED(list) |
|
67 | Q_UNUSED(list) | |
54 | Q_UNUSED(element) |
|
68 | Q_UNUSED(element) | |
55 | // Empty implementation, childs are parsed in componentComplete |
|
69 | // Empty implementation, childs are parsed in componentComplete | |
56 | } |
|
70 | } | |
57 |
|
71 | |||
58 | #include "moc_declarativesplineseries.cpp" |
|
72 | #include "moc_declarativesplineseries.cpp" | |
59 |
|
73 | |||
60 | QTCOMMERCIALCHART_END_NAMESPACE |
|
74 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now