@@ -0,0 +1,64 | |||
|
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.1 | |
|
23 | ||
|
24 | ChartView { | |
|
25 | title: "Bar series" | |
|
26 | anchors.fill: parent | |
|
27 | theme: ChartView.ChartThemeLight | |
|
28 | legend.alignment: Qt.AlignBottom | |
|
29 | animationOptions: ChartView.SeriesAnimations | |
|
30 | ||
|
31 | property variant series: mySeries | |
|
32 | ||
|
33 | ||
|
34 | HorizontalBarSeries { | |
|
35 | id: mySeries | |
|
36 | name: "bar" | |
|
37 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
|
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
|
39 | onClicked: console.log("barset.onClicked: " + index); | |
|
40 | onHovered: console.log("barset.onHovered: " + status); | |
|
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
|
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
|
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
|
44 | onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); | |
|
45 | onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); | |
|
46 | onColorChanged: console.log("barset.onColorChanged: " + color); | |
|
47 | onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); | |
|
48 | onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); | |
|
49 | onCountChanged: console.log("barset.onCountChanged: " + count); | |
|
50 | onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); | |
|
51 | onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); | |
|
52 | onValueChanged: console.log("barset.onValuesChanged: " + index); | |
|
53 | } | |
|
54 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } | |
|
55 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } | |
|
56 | ||
|
57 | onNameChanged: console.log("groupedBarSeries.onNameChanged: " + series.name); | |
|
58 | onVisibleChanged: console.log("groupedBarSeries.onVisibleChanged: " + series.visible); | |
|
59 | onClicked: console.log("groupedBarSeries.onClicked: " + barset + " " + index); | |
|
60 | onHovered: console.log("groupedBarSeries.onHovered: " + barset + " " + status); | |
|
61 | onLabelsVisibleChanged: console.log("groupedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
|
62 | onCountChanged: console.log("groupedBarSeries.onCountChanged: " + count); | |
|
63 | } | |
|
64 | } |
@@ -0,0 +1,64 | |||
|
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.1 | |
|
23 | ||
|
24 | ChartView { | |
|
25 | title: "Percent bar series" | |
|
26 | anchors.fill: parent | |
|
27 | theme: ChartView.ChartThemeLight | |
|
28 | legend.alignment: Qt.AlignBottom | |
|
29 | animationOptions: ChartView.SeriesAnimations | |
|
30 | ||
|
31 | property variant series: mySeries | |
|
32 | ||
|
33 | HorizontalPercentBarSeries { | |
|
34 | id: mySeries | |
|
35 | name: "bar" | |
|
36 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
|
37 | ||
|
38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
|
39 | onClicked: console.log("barset.onClicked: " + index); | |
|
40 | onHovered: console.log("barset.onHovered: " + status); | |
|
41 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
|
42 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
|
43 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
|
44 | onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); | |
|
45 | onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); | |
|
46 | onColorChanged: console.log("barset.onColorChanged: " + color); | |
|
47 | onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); | |
|
48 | onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); | |
|
49 | onCountChanged: console.log("barset.onCountChanged: " + count); | |
|
50 | onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); | |
|
51 | onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); | |
|
52 | onValueChanged: console.log("barset.onValuesChanged: " + index); | |
|
53 | } | |
|
54 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } | |
|
55 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } | |
|
56 | ||
|
57 | onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name); | |
|
58 | onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible); | |
|
59 | onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index); | |
|
60 | onHovered: console.log("percentBarSeries.onHovered: " + barset + " " + status); | |
|
61 | onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
|
62 | onCountChanged: console.log("percentBarSeries.onCountChanged: " + count); | |
|
63 | } | |
|
64 | } |
@@ -0,0 +1,63 | |||
|
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.1 | |
|
23 | ||
|
24 | ChartView { | |
|
25 | title: "Stacked bar series" | |
|
26 | anchors.fill: parent | |
|
27 | theme: ChartView.ChartThemeLight | |
|
28 | legend.alignment: Qt.AlignBottom | |
|
29 | animationOptions: ChartView.SeriesAnimations | |
|
30 | ||
|
31 | property variant series: mySeries | |
|
32 | ||
|
33 | HorizontalStackedBarSeries { | |
|
34 | id: mySeries | |
|
35 | name: "bar" | |
|
36 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } | |
|
37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] | |
|
38 | onClicked: console.log("barset.onClicked: " + index); | |
|
39 | onHovered: console.log("barset.onHovered: " + status); | |
|
40 | onPenChanged: console.log("barset.onPenChanged: " + pen); | |
|
41 | onBrushChanged: console.log("barset.onBrushChanged: " + brush); | |
|
42 | onLabelChanged: console.log("barset.onLabelChanged: " + label); | |
|
43 | onLabelBrushChanged: console.log("barset.onLabelBrushChanged: " + labelBrush); | |
|
44 | onLabelFontChanged: console.log("barset.onLabelFontChanged: " + labelFont); | |
|
45 | onColorChanged: console.log("barset.onColorChanged: " + color); | |
|
46 | onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color); | |
|
47 | onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color); | |
|
48 | onCountChanged: console.log("barset.onCountChanged: " + count); | |
|
49 | onValuesAdded: console.log("barset.onValuesAdded: " + index + ", " + count); | |
|
50 | onValuesRemoved: console.log("barset.onValuesRemoved: " + index + ", " + count); | |
|
51 | onValueChanged: console.log("barset.onValuesChanged: " + index); | |
|
52 | } | |
|
53 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } | |
|
54 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } | |
|
55 | ||
|
56 | onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name); | |
|
57 | onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible); | |
|
58 | onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index); | |
|
59 | onHovered: console.log("stackedBarSeries.onHovered: " + barset + " " + status); | |
|
60 | onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible); | |
|
61 | onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count); | |
|
62 | } | |
|
63 | } |
@@ -39,11 +39,11 Flow { | |||
|
39 | 39 | onClicked: series.borderColor = main.nextColor(); |
|
40 | 40 | } |
|
41 | 41 | Button { |
|
42 | text: "borderWidth + (" + series.borderWidth + ")" | |
|
42 | text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : "" | |
|
43 | 43 | onClicked: series.borderWidth += 0.5; |
|
44 | 44 | } |
|
45 | 45 | Button { |
|
46 | text: "borderWidth - (" + series.borderWidth + ")" | |
|
46 | text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : "" | |
|
47 | 47 | onClicked: series.borderWidth -= 0.5; |
|
48 | 48 | } |
|
49 | 49 | Button { |
@@ -143,11 +143,11 Row { | |||
|
143 | 143 | onClicked: series.at(0).borderColor = main.nextColor(); |
|
144 | 144 | } |
|
145 | 145 | Button { |
|
146 |
text: "set 1 borderWidth + |
|
|
146 | text: "set 1 borderWidth +" | |
|
147 | 147 | onClicked: series.at(0).borderWidth += 0.5; |
|
148 | 148 | } |
|
149 | 149 | Button { |
|
150 |
text: "set 1 borderWidth - |
|
|
150 | text: "set 1 borderWidth -" | |
|
151 | 151 | onClicked: series.at(0).borderWidth -= 0.5; |
|
152 | 152 | } |
|
153 | 153 | } |
@@ -36,27 +36,27 Flow { | |||
|
36 | 36 | onClicked: series.color = main.nextColor(); |
|
37 | 37 | } |
|
38 | 38 | Button { |
|
39 | text: "width + (" + series.width + ")" | |
|
39 | text: series != undefined ? "width + (" + series.width + ")" : "" | |
|
40 | 40 | onClicked: series.width += 0.5; |
|
41 | 41 | } |
|
42 | 42 | Button { |
|
43 | text: "width - (" + series.width + ")" | |
|
43 | text: series != undefined ? "width - (" + series.width + ")" : "" | |
|
44 | 44 | onClicked: series.width -= 0.5; |
|
45 | 45 | } |
|
46 | 46 | Button { |
|
47 | text: "style + (" + series.style + ")" | |
|
47 | text: series != undefined ? "style + (" + series.style + ")" : "" | |
|
48 | 48 | onClicked: series.style++; |
|
49 | 49 | } |
|
50 | 50 | Button { |
|
51 | text: "style - (" + series.style + ")" | |
|
51 | text: series != undefined ? "style - (" + series.style + ")" : "" | |
|
52 | 52 | onClicked: series.style--; |
|
53 | 53 | } |
|
54 | 54 | Button { |
|
55 | text: "cap style + (" + series.capStyle + ")" | |
|
55 | text: series != undefined ? "cap style + (" + series.capStyle + ")" : "" | |
|
56 | 56 | onClicked: series.capStyle++; |
|
57 | 57 | } |
|
58 | 58 | Button { |
|
59 | text: "cap style - (" +series.capStyle + ")" | |
|
59 | text: series != undefined ? "cap style - (" +series.capStyle + ")" : "" | |
|
60 | 60 | onClicked: series.capStyle--; |
|
61 | 61 | } |
|
62 | 62 | Button { |
@@ -39,11 +39,11 Flow { | |||
|
39 | 39 | onClicked: series.borderColor = main.nextColor(); |
|
40 | 40 | } |
|
41 | 41 | Button { |
|
42 | text: "borderWidth + (" + series.borderWidth + ")" | |
|
42 | text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : "" | |
|
43 | 43 | onClicked: series.borderWidth += 0.5; |
|
44 | 44 | } |
|
45 | 45 | Button { |
|
46 | text: "borderWidth - (" + series.borderWidth + ")" | |
|
46 | text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : "" | |
|
47 | 47 | onClicked: series.borderWidth -= 0.5; |
|
48 | 48 | } |
|
49 | 49 | Button { |
@@ -24,49 +24,16 Rectangle { | |||
|
24 | 24 | id: main |
|
25 | 25 | width: parent.width |
|
26 | 26 | height: parent.height |
|
27 | property int viewNumber: 0 | |
|
28 | 27 | property int viewCount: 9 |
|
29 | 28 | property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"] |
|
30 | 29 | property int colorIndex: 0 |
|
30 | property int buttonWidth: 42 | |
|
31 | 31 | |
|
32 | 32 | function nextColor() { |
|
33 | 33 | colorIndex++; |
|
34 | 34 | return colors[colorIndex % colors.length]; |
|
35 | 35 | } |
|
36 | 36 | |
|
37 | onViewNumberChanged: { | |
|
38 | if (viewNumber == 0) { | |
|
39 | chartLoader.source = "Chart.qml"; | |
|
40 | editorLoader.source = "ChartEditor.qml"; | |
|
41 | } else if (viewNumber == 1) { | |
|
42 | chartLoader.source = "PieChart.qml"; | |
|
43 | editorLoader.source = "PieEditor.qml"; | |
|
44 | } else if (viewNumber == 2) { | |
|
45 | chartLoader.source = "LineChart.qml"; | |
|
46 | editorLoader.source = "LineEditor.qml"; | |
|
47 | } else if (viewNumber == 3) { | |
|
48 | chartLoader.source = "SplineChart.qml"; | |
|
49 | editorLoader.source = "LineEditor.qml"; | |
|
50 | } else if (viewNumber == 4) { | |
|
51 | chartLoader.source = "ScatterChart.qml"; | |
|
52 | editorLoader.source = "ScatterEditor.qml"; | |
|
53 | } else if (viewNumber == 5) { | |
|
54 | chartLoader.source = "AreaChart.qml"; | |
|
55 | editorLoader.source = "AreaEditor.qml"; | |
|
56 | } else if (viewNumber == 6) { | |
|
57 | chartLoader.source = "BarChart.qml"; | |
|
58 | editorLoader.source = "BarEditor.qml"; | |
|
59 | } else if (viewNumber == 7) { | |
|
60 | chartLoader.source = "StackedBarChart.qml"; | |
|
61 | editorLoader.source = "BarEditor.qml"; | |
|
62 | } else if (viewNumber == 8) { | |
|
63 | chartLoader.source = "PercentBarChart.qml"; | |
|
64 | editorLoader.source = "BarEditor.qml"; | |
|
65 | } else { | |
|
66 | console.log("Illegal view number"); | |
|
67 | } | |
|
68 | } | |
|
69 | ||
|
70 | 37 | Row { |
|
71 | 38 | anchors.top: parent.top |
|
72 | 39 | anchors.bottom: buttonRow.top |
@@ -105,16 +72,99 Rectangle { | |||
|
105 | 72 | spacing: 10 |
|
106 | 73 | |
|
107 | 74 | Button { |
|
108 |
text: " |
|
|
75 | text: "chart" | |
|
76 | width: buttonWidth | |
|
109 | 77 | onClicked: { |
|
110 | viewNumber = (viewNumber + viewCount - 1) % viewCount; | |
|
78 | chartLoader.source = "Chart.qml"; | |
|
79 | editorLoader.source = "ChartEditor.qml"; | |
|
80 | } | |
|
81 | } | |
|
82 | Button { | |
|
83 | text: "pie" | |
|
84 | width: buttonWidth | |
|
85 | onClicked: { | |
|
86 | chartLoader.source = "PieChart.qml"; | |
|
87 | editorLoader.source = "PieEditor.qml"; | |
|
88 | } | |
|
89 | } | |
|
90 | Button { | |
|
91 | text: "line" | |
|
92 | width: buttonWidth | |
|
93 | onClicked: { | |
|
94 | chartLoader.source = "LineChart.qml"; | |
|
95 | editorLoader.source = "PieEditor.qml"; | |
|
96 | } | |
|
97 | } | |
|
98 | Button { | |
|
99 | text: "spline" | |
|
100 | width: buttonWidth | |
|
101 | onClicked: { | |
|
102 | chartLoader.source = "SplineChart.qml"; | |
|
103 | editorLoader.source = "PieEditor.qml"; | |
|
111 | 104 | } |
|
112 | 105 | } |
|
113 | ||
|
114 | 106 | Button { |
|
115 |
text: " |
|
|
107 | text: "scatter" | |
|
108 | width: buttonWidth | |
|
116 | 109 | onClicked: { |
|
117 | viewNumber = (viewNumber + 1) % viewCount; | |
|
110 | chartLoader.source = "ScatterChart.qml"; | |
|
111 | editorLoader.source = "ScatterEditor.qml"; | |
|
112 | } | |
|
113 | } | |
|
114 | Button { | |
|
115 | text: "area" | |
|
116 | width: buttonWidth | |
|
117 | onClicked: { | |
|
118 | chartLoader.source = "AreaChart.qml"; | |
|
119 | editorLoader.source = "AreaEditor.qml"; | |
|
120 | } | |
|
121 | } | |
|
122 | Button { | |
|
123 | text: "bar" | |
|
124 | width: buttonWidth | |
|
125 | onClicked: { | |
|
126 | chartLoader.source = "BarChart.qml"; | |
|
127 | editorLoader.source = "BarEditor.qml"; | |
|
128 | } | |
|
129 | } | |
|
130 | Button { | |
|
131 | text: "sbar" | |
|
132 | width: buttonWidth | |
|
133 | onClicked: { | |
|
134 | chartLoader.source = "StackedBarChart.qml"; | |
|
135 | editorLoader.source = "BarEditor.qml"; | |
|
136 | } | |
|
137 | } | |
|
138 | Button { | |
|
139 | text: "pbar" | |
|
140 | width: buttonWidth | |
|
141 | onClicked: { | |
|
142 | chartLoader.source = "PercentBarChart.qml"; | |
|
143 | editorLoader.source = "BarEditor.qml"; | |
|
144 | } | |
|
145 | } | |
|
146 | Button { | |
|
147 | text: "hbar" | |
|
148 | width: buttonWidth | |
|
149 | onClicked: { | |
|
150 | chartLoader.source = "HorizontalBarChart.qml"; | |
|
151 | editorLoader.source = "BarEditor.qml"; | |
|
152 | } | |
|
153 | } | |
|
154 | Button { | |
|
155 | text: "hsbar" | |
|
156 | width: buttonWidth | |
|
157 | onClicked: { | |
|
158 | chartLoader.source = "HorizontalStackedBarChart.qml"; | |
|
159 | editorLoader.source = "BarEditor.qml"; | |
|
160 | } | |
|
161 | } | |
|
162 | Button { | |
|
163 | text: "hpbar" | |
|
164 | width: buttonWidth | |
|
165 | onClicked: { | |
|
166 | chartLoader.source = "HorizontalPercentBarChart.qml"; | |
|
167 | editorLoader.source = "BarEditor.qml"; | |
|
118 | 168 | } |
|
119 | 169 | } |
|
120 | 170 | } |
@@ -22,5 +22,8 | |||
|
22 | 22 | <file>qml/qmlchartproperties/ChartEditor2.qml</file> |
|
23 | 23 | <file>qml/qmlchartproperties/ChartEditor3.qml</file> |
|
24 | 24 | <file>qml/qmlchartproperties/FontEditor.qml</file> |
|
25 | <file>qml/qmlchartproperties/HorizontalBarChart.qml</file> | |
|
26 | <file>qml/qmlchartproperties/HorizontalPercentBarChart.qml</file> | |
|
27 | <file>qml/qmlchartproperties/HorizontalStackedBarChart.qml</file> | |
|
25 | 28 | </qresource> |
|
26 | 29 | </RCC> |
General Comments 0
You need to be logged in to leave comments.
Login now