##// END OF EJS Templates
Added horizontal bar series to qml tester
Tero Ahola -
r1914:2325cc247e94
parent child
Show More
@@ -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 }
@@ -1,77 +1,77
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
22
23 Flow {
23 Flow {
24 id: flow
24 id: flow
25 spacing: 5
25 spacing: 5
26 flow: Flow.TopToBottom
26 flow: Flow.TopToBottom
27 property variant series
27 property variant series
28
28
29 Button {
29 Button {
30 text: "visible"
30 text: "visible"
31 onClicked: series.visible = !series.visible;
31 onClicked: series.visible = !series.visible;
32 }
32 }
33 Button {
33 Button {
34 text: "color"
34 text: "color"
35 onClicked: series.color = main.nextColor();
35 onClicked: series.color = main.nextColor();
36 }
36 }
37 Button {
37 Button {
38 text: "borderColor"
38 text: "borderColor"
39 onClicked: series.borderColor = main.nextColor();
39 onClicked: series.borderColor = main.nextColor();
40 }
40 }
41 Button {
41 Button {
42 text: "borderWidth + (" + series.borderWidth + ")"
42 text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : ""
43 onClicked: series.borderWidth += 0.5;
43 onClicked: series.borderWidth += 0.5;
44 }
44 }
45 Button {
45 Button {
46 text: "borderWidth - (" + series.borderWidth + ")"
46 text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : ""
47 onClicked: series.borderWidth -= 0.5;
47 onClicked: series.borderWidth -= 0.5;
48 }
48 }
49 Button {
49 Button {
50 id: upperButton
50 id: upperButton
51 text: "upper series"
51 text: "upper series"
52 unpressedColor: "#79bd8f"
52 unpressedColor: "#79bd8f"
53 onClicked: {
53 onClicked: {
54 lineEditor.visible = true;
54 lineEditor.visible = true;
55 color = "#00a388";
55 color = "#00a388";
56 lowerButton.color = "#79bd8f";
56 lowerButton.color = "#79bd8f";
57 lineEditor.series = series.upperSeries;
57 lineEditor.series = series.upperSeries;
58 }
58 }
59 }
59 }
60 Button {
60 Button {
61 id: lowerButton
61 id: lowerButton
62 text: "lower series"
62 text: "lower series"
63 unpressedColor: "#79bd8f"
63 unpressedColor: "#79bd8f"
64 onClicked: {
64 onClicked: {
65 lineEditor.visible = true;
65 lineEditor.visible = true;
66 color = "#00a388";
66 color = "#00a388";
67 upperButton.color = "#79bd8f";
67 upperButton.color = "#79bd8f";
68 lineEditor.series = series.lowerSeries;
68 lineEditor.series = series.lowerSeries;
69 }
69 }
70 }
70 }
71 LineEditor {
71 LineEditor {
72 id: lineEditor
72 id: lineEditor
73 visible: false
73 visible: false
74 }
74 }
75
75
76 onSeriesChanged: lineEditor.series = series.upperSeries;
76 onSeriesChanged: lineEditor.series = series.upperSeries;
77 }
77 }
@@ -1,178 +1,178
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
22
23 Row {
23 Row {
24 anchors.fill: parent
24 anchors.fill: parent
25 spacing: 5
25 spacing: 5
26 property variant series
26 property variant series
27
27
28 // buttons for selecting the edited object: series, barset or label
28 // buttons for selecting the edited object: series, barset or label
29 Flow {
29 Flow {
30 spacing: 5
30 spacing: 5
31 flow: Flow.TopToBottom
31 flow: Flow.TopToBottom
32 Button {
32 Button {
33 id: seriesButton
33 id: seriesButton
34 text: "series"
34 text: "series"
35 unpressedColor: "#79bd8f"
35 unpressedColor: "#79bd8f"
36 onClicked: {
36 onClicked: {
37 seriesFlow.visible = true;
37 seriesFlow.visible = true;
38 setFlow.visible = false;
38 setFlow.visible = false;
39 labelsFlow.visible = false;
39 labelsFlow.visible = false;
40 color = "#00a388";
40 color = "#00a388";
41 sliceButton.color = "#79bd8f";
41 sliceButton.color = "#79bd8f";
42 labelButton.color = "#79bd8f";
42 labelButton.color = "#79bd8f";
43 }
43 }
44 }
44 }
45 Button {
45 Button {
46 id: setButton
46 id: setButton
47 text: "BarSet"
47 text: "BarSet"
48 unpressedColor: "#79bd8f"
48 unpressedColor: "#79bd8f"
49 onClicked: {
49 onClicked: {
50 seriesFlow.visible = false;
50 seriesFlow.visible = false;
51 setFlow.visible = true;
51 setFlow.visible = true;
52 labelsFlow.visible = false;
52 labelsFlow.visible = false;
53 color = "#00a388";
53 color = "#00a388";
54 seriesButton.color = "#79bd8f";
54 seriesButton.color = "#79bd8f";
55 labelButton.color = "#79bd8f";
55 labelButton.color = "#79bd8f";
56 }
56 }
57 }
57 }
58 Button {
58 Button {
59 id: labelButton
59 id: labelButton
60 text: "label"
60 text: "label"
61 unpressedColor: "#79bd8f"
61 unpressedColor: "#79bd8f"
62 onClicked: {
62 onClicked: {
63 seriesFlow.visible = false;
63 seriesFlow.visible = false;
64 setFlow.visible = false;
64 setFlow.visible = false;
65 labelsFlow.visible = true;
65 labelsFlow.visible = true;
66 color = "#00a388";
66 color = "#00a388";
67 seriesButton.color = "#79bd8f";
67 seriesButton.color = "#79bd8f";
68 sliceButton.color = "#79bd8f";
68 sliceButton.color = "#79bd8f";
69 }
69 }
70 }
70 }
71 }
71 }
72
72
73 // Buttons for editing series
73 // Buttons for editing series
74 Flow {
74 Flow {
75 id: seriesFlow
75 id: seriesFlow
76 spacing: 5
76 spacing: 5
77 flow: Flow.TopToBottom
77 flow: Flow.TopToBottom
78 visible: false
78 visible: false
79
79
80 Button {
80 Button {
81 text: "visible"
81 text: "visible"
82 onClicked: series.visible = !series.visible;
82 onClicked: series.visible = !series.visible;
83 }
83 }
84 Button {
84 Button {
85 text: "bar width +"
85 text: "bar width +"
86 onClicked: series.barWidth += 0.1;
86 onClicked: series.barWidth += 0.1;
87 }
87 }
88 Button {
88 Button {
89 text: "bar width -"
89 text: "bar width -"
90 onClicked: series.barWidth -= 0.1;
90 onClicked: series.barWidth -= 0.1;
91 }
91 }
92 }
92 }
93
93
94 // Buttons for editing sets
94 // Buttons for editing sets
95 Flow {
95 Flow {
96 id: setFlow
96 id: setFlow
97 spacing: 5
97 spacing: 5
98 flow: Flow.TopToBottom
98 flow: Flow.TopToBottom
99 visible: false
99 visible: false
100
100
101 Button {
101 Button {
102 text: "append set"
102 text: "append set"
103 onClicked: {
103 onClicked: {
104 var count = series.count;
104 var count = series.count;
105 series.append("set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]);
105 series.append("set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]);
106 }
106 }
107 }
107 }
108 Button {
108 Button {
109 text: "insert set"
109 text: "insert set"
110 onClicked: {
110 onClicked: {
111 var count = series.count;
111 var count = series.count;
112 series.insert(count - 1, "set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]);
112 series.insert(count - 1, "set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]);
113 }
113 }
114 }
114 }
115 Button {
115 Button {
116 text: "remove set"
116 text: "remove set"
117 onClicked: series.remove(series.at(series.count - 1));
117 onClicked: series.remove(series.at(series.count - 1));
118 }
118 }
119 Button {
119 Button {
120 text: "clear sets"
120 text: "clear sets"
121 onClicked: series.clear();
121 onClicked: series.clear();
122 }
122 }
123
123
124 Button {
124 Button {
125 text: "set 1 append"
125 text: "set 1 append"
126 onClicked: series.at(0).append(series.at(0).count + 1);
126 onClicked: series.at(0).append(series.at(0).count + 1);
127 }
127 }
128 Button {
128 Button {
129 text: "set 1 replace"
129 text: "set 1 replace"
130 onClicked: series.at(0).replace(series.at(0).count - 1, series.at(0).at(series.at(0).count - 1) + 1.5);
130 onClicked: series.at(0).replace(series.at(0).count - 1, series.at(0).at(series.at(0).count - 1) + 1.5);
131 }
131 }
132 Button {
132 Button {
133 text: "set 1 remove"
133 text: "set 1 remove"
134 onClicked: series.at(0).remove(series.at(0).count - 1);
134 onClicked: series.at(0).remove(series.at(0).count - 1);
135 }
135 }
136
136
137 Button {
137 Button {
138 text: "set 1 color"
138 text: "set 1 color"
139 onClicked: series.at(0).color = main.nextColor();
139 onClicked: series.at(0).color = main.nextColor();
140 }
140 }
141 Button {
141 Button {
142 text: "set 1 border color"
142 text: "set 1 border color"
143 onClicked: series.at(0).borderColor = main.nextColor();
143 onClicked: series.at(0).borderColor = main.nextColor();
144 }
144 }
145 Button {
145 Button {
146 text: "set 1 borderWidth + (" + series.at(0).borderWidth + ")"
146 text: "set 1 borderWidth +"
147 onClicked: series.at(0).borderWidth += 0.5;
147 onClicked: series.at(0).borderWidth += 0.5;
148 }
148 }
149 Button {
149 Button {
150 text: "set 1 borderWidth - (" + series.at(0).borderWidth + ")"
150 text: "set 1 borderWidth -"
151 onClicked: series.at(0).borderWidth -= 0.5;
151 onClicked: series.at(0).borderWidth -= 0.5;
152 }
152 }
153 }
153 }
154
154
155
155
156 Flow {
156 Flow {
157 id: labelsFlow
157 id: labelsFlow
158 spacing: 5
158 spacing: 5
159 flow: Flow.TopToBottom
159 flow: Flow.TopToBottom
160 visible: false
160 visible: false
161
161
162 Button {
162 Button {
163 text: "labels visible"
163 text: "labels visible"
164 onClicked: series.labelsVisible = !series.labelsVisible;
164 onClicked: series.labelsVisible = !series.labelsVisible;
165 }
165 }
166 Button {
166 Button {
167 text: "set 1 label color"
167 text: "set 1 label color"
168 onClicked: series.at(0).labelColor = main.nextColor();
168 onClicked: series.at(0).labelColor = main.nextColor();
169 }
169 }
170 FontEditor {
170 FontEditor {
171 id: fontEditor
171 id: fontEditor
172 fontDescription: "label"
172 fontDescription: "label"
173 function editedFont() {
173 function editedFont() {
174 return series.at(0).labelFont;
174 return series.at(0).labelFont;
175 }
175 }
176 }
176 }
177 }
177 }
178 }
178 }
@@ -1,89 +1,89
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
22
23
23
24 Flow {
24 Flow {
25 id: flow
25 id: flow
26 spacing: 5
26 spacing: 5
27 flow: Flow.TopToBottom
27 flow: Flow.TopToBottom
28 property variant series
28 property variant series
29
29
30 Button {
30 Button {
31 text: "visible"
31 text: "visible"
32 onClicked: series.visible = !series.visible;
32 onClicked: series.visible = !series.visible;
33 }
33 }
34 Button {
34 Button {
35 text: "color"
35 text: "color"
36 onClicked: series.color = main.nextColor();
36 onClicked: series.color = main.nextColor();
37 }
37 }
38 Button {
38 Button {
39 text: "width + (" + series.width + ")"
39 text: series != undefined ? "width + (" + series.width + ")" : ""
40 onClicked: series.width += 0.5;
40 onClicked: series.width += 0.5;
41 }
41 }
42 Button {
42 Button {
43 text: "width - (" + series.width + ")"
43 text: series != undefined ? "width - (" + series.width + ")" : ""
44 onClicked: series.width -= 0.5;
44 onClicked: series.width -= 0.5;
45 }
45 }
46 Button {
46 Button {
47 text: "style + (" + series.style + ")"
47 text: series != undefined ? "style + (" + series.style + ")" : ""
48 onClicked: series.style++;
48 onClicked: series.style++;
49 }
49 }
50 Button {
50 Button {
51 text: "style - (" + series.style + ")"
51 text: series != undefined ? "style - (" + series.style + ")" : ""
52 onClicked: series.style--;
52 onClicked: series.style--;
53 }
53 }
54 Button {
54 Button {
55 text: "cap style + (" + series.capStyle + ")"
55 text: series != undefined ? "cap style + (" + series.capStyle + ")" : ""
56 onClicked: series.capStyle++;
56 onClicked: series.capStyle++;
57 }
57 }
58 Button {
58 Button {
59 text: "cap style - (" +series.capStyle + ")"
59 text: series != undefined ? "cap style - (" +series.capStyle + ")" : ""
60 onClicked: series.capStyle--;
60 onClicked: series.capStyle--;
61 }
61 }
62 Button {
62 Button {
63 text: "points visible"
63 text: "points visible"
64 onClicked: series.pointsVisible = !series.pointsVisible;
64 onClicked: series.pointsVisible = !series.pointsVisible;
65 }
65 }
66 Button {
66 Button {
67 text: "append point"
67 text: "append point"
68 onClicked: series.append(series.count - 1, series.count - 1);
68 onClicked: series.append(series.count - 1, series.count - 1);
69 }
69 }
70 Button {
70 Button {
71 text: "replace point"
71 text: "replace point"
72 onClicked: {
72 onClicked: {
73 var xyPoint = series.at(series.count - 1);
73 var xyPoint = series.at(series.count - 1);
74 series.replace(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1);
74 series.replace(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1);
75 }
75 }
76 }
76 }
77 Button {
77 Button {
78 text: "remove point"
78 text: "remove point"
79 onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y);
79 onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y);
80 }
80 }
81 Button {
81 Button {
82 text: "insert point"
82 text: "insert point"
83 onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
83 onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
84 }
84 }
85 Button {
85 Button {
86 text: "clear"
86 text: "clear"
87 onClicked: series.clear();
87 onClicked: series.clear();
88 }
88 }
89 }
89 }
@@ -1,84 +1,84
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
22
23 Flow {
23 Flow {
24 id: flow
24 id: flow
25 spacing: 5
25 spacing: 5
26 flow: Flow.TopToBottom
26 flow: Flow.TopToBottom
27 property variant series
27 property variant series
28
28
29 Button {
29 Button {
30 text: "visible"
30 text: "visible"
31 onClicked: series.visible = !series.visible;
31 onClicked: series.visible = !series.visible;
32 }
32 }
33 Button {
33 Button {
34 text: "color"
34 text: "color"
35 onClicked: series.color = main.nextColor();
35 onClicked: series.color = main.nextColor();
36 }
36 }
37 Button {
37 Button {
38 text: "borderColor"
38 text: "borderColor"
39 onClicked: series.borderColor = main.nextColor();
39 onClicked: series.borderColor = main.nextColor();
40 }
40 }
41 Button {
41 Button {
42 text: "borderWidth + (" + series.borderWidth + ")"
42 text: series != undefined ? "borderWidth + (" + series.borderWidth + ")" : ""
43 onClicked: series.borderWidth += 0.5;
43 onClicked: series.borderWidth += 0.5;
44 }
44 }
45 Button {
45 Button {
46 text: "borderWidth - (" + series.borderWidth + ")"
46 text: series != undefined ? "borderWidth - (" + series.borderWidth + ")" : ""
47 onClicked: series.borderWidth -= 0.5;
47 onClicked: series.borderWidth -= 0.5;
48 }
48 }
49 Button {
49 Button {
50 text: "markerSize +"
50 text: "markerSize +"
51 onClicked: series.markerSize += 1.0;
51 onClicked: series.markerSize += 1.0;
52 }
52 }
53 Button {
53 Button {
54 text: "markerSize -"
54 text: "markerSize -"
55 onClicked: series.markerSize -= 1.0;
55 onClicked: series.markerSize -= 1.0;
56 }
56 }
57 Button {
57 Button {
58 text: "markerShape"
58 text: "markerShape"
59 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
59 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
60 }
60 }
61 Button {
61 Button {
62 text: "append point"
62 text: "append point"
63 onClicked: series.append(series.count - 1, series.count - 1);
63 onClicked: series.append(series.count - 1, series.count - 1);
64 }
64 }
65 Button {
65 Button {
66 text: "replace point"
66 text: "replace point"
67 onClicked: {
67 onClicked: {
68 var xyPoint = series.at(series.count - 1);
68 var xyPoint = series.at(series.count - 1);
69 series.replace(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1);
69 series.replace(xyPoint.x, xyPoint.y, xyPoint.x, xyPoint.y + 0.1);
70 }
70 }
71 }
71 }
72 Button {
72 Button {
73 text: "remove point"
73 text: "remove point"
74 onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y);
74 onClicked: series.remove(series.at(series.count - 1).x, series.at(series.count - 1).y);
75 }
75 }
76 Button {
76 Button {
77 text: "insert point"
77 text: "insert point"
78 onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
78 onClicked: series.insert(series.count - 2, series.count - 2, series.count - 2);
79 }
79 }
80 Button {
80 Button {
81 text: "clear"
81 text: "clear"
82 onClicked: series.clear();
82 onClicked: series.clear();
83 }
83 }
84 }
84 }
@@ -1,121 +1,171
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
22
23 Rectangle {
23 Rectangle {
24 id: main
24 id: main
25 width: parent.width
25 width: parent.width
26 height: parent.height
26 height: parent.height
27 property int viewNumber: 0
28 property int viewCount: 9
27 property int viewCount: 9
29 property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
28 property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
30 property int colorIndex: 0
29 property int colorIndex: 0
30 property int buttonWidth: 42
31
31
32 function nextColor() {
32 function nextColor() {
33 colorIndex++;
33 colorIndex++;
34 return colors[colorIndex % colors.length];
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 Row {
37 Row {
71 anchors.top: parent.top
38 anchors.top: parent.top
72 anchors.bottom: buttonRow.top
39 anchors.bottom: buttonRow.top
73 anchors.bottomMargin: 10
40 anchors.bottomMargin: 10
74 anchors.left: parent.left
41 anchors.left: parent.left
75 anchors.right: parent.right
42 anchors.right: parent.right
76
43
77 Loader {
44 Loader {
78 id: chartLoader
45 id: chartLoader
79 width: main.width - editorLoader.width
46 width: main.width - editorLoader.width
80 height: parent.height
47 height: parent.height
81 source: "Chart.qml"
48 source: "Chart.qml"
82 onStatusChanged: {
49 onStatusChanged: {
83 if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item)
50 if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item)
84 editorLoader.item.series = chartLoader.item.series;
51 editorLoader.item.series = chartLoader.item.series;
85 }
52 }
86 }
53 }
87
54
88 Loader {
55 Loader {
89 id: editorLoader
56 id: editorLoader
90 width: 280
57 width: 280
91 height: parent.height
58 height: parent.height
92 source: "ChartEditor.qml"
59 source: "ChartEditor.qml"
93 onStatusChanged: {
60 onStatusChanged: {
94 if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item)
61 if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item)
95 editorLoader.item.series = chartLoader.item.series;
62 editorLoader.item.series = chartLoader.item.series;
96 }
63 }
97 }
64 }
98 }
65 }
99
66
100 Row {
67 Row {
101 id: buttonRow
68 id: buttonRow
102 height: 40
69 height: 40
103 anchors.bottom: parent.bottom
70 anchors.bottom: parent.bottom
104 anchors.horizontalCenter: parent.horizontalCenter
71 anchors.horizontalCenter: parent.horizontalCenter
105 spacing: 10
72 spacing: 10
106
73
107 Button {
74 Button {
108 text: "previous"
75 text: "chart"
76 width: buttonWidth
109 onClicked: {
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";
104 }
105 }
106 Button {
107 text: "scatter"
108 width: buttonWidth
109 onClicked: {
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";
111 }
160 }
112 }
161 }
113
114 Button {
162 Button {
115 text: "next"
163 text: "hpbar"
164 width: buttonWidth
116 onClicked: {
165 onClicked: {
117 viewNumber = (viewNumber + 1) % viewCount;
166 chartLoader.source = "HorizontalPercentBarChart.qml";
167 editorLoader.source = "BarEditor.qml";
118 }
168 }
119 }
169 }
120 }
170 }
121 }
171 }
@@ -1,26 +1,29
1 <RCC>
1 <RCC>
2 <qresource prefix="/">
2 <qresource prefix="/">
3 <file>qml/qmlchartproperties/loader.qml</file>
3 <file>qml/qmlchartproperties/loader.qml</file>
4 <file>qml/qmlchartproperties/main.qml</file>
4 <file>qml/qmlchartproperties/main.qml</file>
5 <file>qml/qmlchartproperties/Button.qml</file>
5 <file>qml/qmlchartproperties/Button.qml</file>
6 <file>qml/qmlchartproperties/PieChart.qml</file>
6 <file>qml/qmlchartproperties/PieChart.qml</file>
7 <file>qml/qmlchartproperties/PieEditor.qml</file>
7 <file>qml/qmlchartproperties/PieEditor.qml</file>
8 <file>qml/qmlchartproperties/LineChart.qml</file>
8 <file>qml/qmlchartproperties/LineChart.qml</file>
9 <file>qml/qmlchartproperties/LineEditor.qml</file>
9 <file>qml/qmlchartproperties/LineEditor.qml</file>
10 <file>qml/qmlchartproperties/SplineChart.qml</file>
10 <file>qml/qmlchartproperties/SplineChart.qml</file>
11 <file>qml/qmlchartproperties/ScatterChart.qml</file>
11 <file>qml/qmlchartproperties/ScatterChart.qml</file>
12 <file>qml/qmlchartproperties/AreaChart.qml</file>
12 <file>qml/qmlchartproperties/AreaChart.qml</file>
13 <file>qml/qmlchartproperties/BarChart.qml</file>
13 <file>qml/qmlchartproperties/BarChart.qml</file>
14 <file>qml/qmlchartproperties/BarEditor.qml</file>
14 <file>qml/qmlchartproperties/BarEditor.qml</file>
15 <file>qml/qmlchartproperties/ScatterEditor.qml</file>
15 <file>qml/qmlchartproperties/ScatterEditor.qml</file>
16 <file>qml/qmlchartproperties/AreaEditor.qml</file>
16 <file>qml/qmlchartproperties/AreaEditor.qml</file>
17 <file>qml/qmlchartproperties/StackedBarChart.qml</file>
17 <file>qml/qmlchartproperties/StackedBarChart.qml</file>
18 <file>qml/qmlchartproperties/PercentBarChart.qml</file>
18 <file>qml/qmlchartproperties/PercentBarChart.qml</file>
19 <file>qml/qmlchartproperties/Chart.qml</file>
19 <file>qml/qmlchartproperties/Chart.qml</file>
20 <file>qml/qmlchartproperties/ChartEditor.qml</file>
20 <file>qml/qmlchartproperties/ChartEditor.qml</file>
21 <file>qml/qmlchartproperties/ChartEditor1.qml</file>
21 <file>qml/qmlchartproperties/ChartEditor1.qml</file>
22 <file>qml/qmlchartproperties/ChartEditor2.qml</file>
22 <file>qml/qmlchartproperties/ChartEditor2.qml</file>
23 <file>qml/qmlchartproperties/ChartEditor3.qml</file>
23 <file>qml/qmlchartproperties/ChartEditor3.qml</file>
24 <file>qml/qmlchartproperties/FontEditor.qml</file>
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 </qresource>
28 </qresource>
26 </RCC>
29 </RCC>
General Comments 0
You need to be logged in to leave comments. Login now