##// END OF EJS Templates
QML chart properties tester to match the current QML api
Tero Ahola -
r2096:4834084a6f1a
parent child
Show More
@@ -1,186 +1,186
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22
23 23 Row {
24 24 anchors.fill: parent
25 25 spacing: 5
26 26 property variant series
27 27
28 28 // buttons for selecting the edited object: series, barset or label
29 29 Flow {
30 30 spacing: 5
31 31 flow: Flow.TopToBottom
32 32 Button {
33 33 id: seriesButton
34 34 text: "series"
35 35 unpressedColor: "#79bd8f"
36 36 onClicked: {
37 37 seriesFlow.visible = true;
38 38 setFlow.visible = false;
39 39 labelsFlow.visible = false;
40 40 color = "#00a388";
41 sliceButton.color = "#79bd8f";
41 setButton.color = "#79bd8f";
42 42 labelButton.color = "#79bd8f";
43 43 }
44 44 }
45 45 Button {
46 46 id: setButton
47 47 text: "BarSet"
48 48 unpressedColor: "#79bd8f"
49 49 onClicked: {
50 50 seriesFlow.visible = false;
51 51 setFlow.visible = true;
52 52 labelsFlow.visible = false;
53 53 color = "#00a388";
54 54 seriesButton.color = "#79bd8f";
55 55 labelButton.color = "#79bd8f";
56 56 }
57 57 }
58 58 Button {
59 59 id: labelButton
60 60 text: "label"
61 61 unpressedColor: "#79bd8f"
62 62 onClicked: {
63 63 seriesFlow.visible = false;
64 64 setFlow.visible = false;
65 65 labelsFlow.visible = true;
66 66 color = "#00a388";
67 67 seriesButton.color = "#79bd8f";
68 sliceButton.color = "#79bd8f";
68 setButton.color = "#79bd8f";
69 69 }
70 70 }
71 71 }
72 72
73 73 // Buttons for editing series
74 74 Flow {
75 75 id: seriesFlow
76 76 spacing: 5
77 77 flow: Flow.TopToBottom
78 78 visible: false
79 79
80 80 Button {
81 81 text: "visible"
82 82 onClicked: series.visible = !series.visible;
83 83 }
84 84 Button {
85 85 text: "opacity +"
86 86 onClicked: series.opacity += 0.1;
87 87 }
88 88 Button {
89 89 text: "opacity -"
90 90 onClicked: series.opacity -= 0.1;
91 91 }
92 92 Button {
93 93 text: "bar width +"
94 94 onClicked: series.barWidth += 0.1;
95 95 }
96 96 Button {
97 97 text: "bar width -"
98 98 onClicked: series.barWidth -= 0.1;
99 99 }
100 100 }
101 101
102 102 // Buttons for editing sets
103 103 Flow {
104 104 id: setFlow
105 105 spacing: 5
106 106 flow: Flow.TopToBottom
107 107 visible: false
108 108
109 109 Button {
110 110 text: "append set"
111 111 onClicked: {
112 112 var count = series.count;
113 113 series.append("set" + count, [0, 0.1 * count, 0.2 * count, 0.3 * count, 0.4 * count, 0.5 * count, 0.6 * count]);
114 114 }
115 115 }
116 116 Button {
117 117 text: "insert set"
118 118 onClicked: {
119 119 var count = series.count;
120 120 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]);
121 121 }
122 122 }
123 123 Button {
124 124 text: "remove set"
125 125 onClicked: series.remove(series.at(series.count - 1));
126 126 }
127 127 Button {
128 128 text: "clear sets"
129 129 onClicked: series.clear();
130 130 }
131 131
132 132 Button {
133 133 text: "set 1 append"
134 134 onClicked: series.at(0).append(series.at(0).count + 1);
135 135 }
136 136 Button {
137 137 text: "set 1 replace"
138 138 onClicked: series.at(0).replace(series.at(0).count - 1, series.at(0).at(series.at(0).count - 1) + 1.5);
139 139 }
140 140 Button {
141 141 text: "set 1 remove"
142 142 onClicked: series.at(0).remove(series.at(0).count - 1);
143 143 }
144 144
145 145 Button {
146 146 text: "set 1 color"
147 147 onClicked: series.at(0).color = main.nextColor();
148 148 }
149 149 Button {
150 150 text: "set 1 border color"
151 151 onClicked: series.at(0).borderColor = main.nextColor();
152 152 }
153 153 Button {
154 154 text: "set 1 borderWidth +"
155 155 onClicked: series.at(0).borderWidth += 0.5;
156 156 }
157 157 Button {
158 158 text: "set 1 borderWidth -"
159 159 onClicked: series.at(0).borderWidth -= 0.5;
160 160 }
161 161 }
162 162
163 163
164 164 Flow {
165 165 id: labelsFlow
166 166 spacing: 5
167 167 flow: Flow.TopToBottom
168 168 visible: false
169 169
170 170 Button {
171 171 text: "labels visible"
172 172 onClicked: series.labelsVisible = !series.labelsVisible;
173 173 }
174 174 Button {
175 175 text: "set 1 label color"
176 176 onClicked: series.at(0).labelColor = main.nextColor();
177 177 }
178 178 FontEditor {
179 179 id: fontEditor
180 180 fontDescription: "label"
181 181 function editedFont() {
182 182 return series.at(0).labelFont;
183 183 }
184 184 }
185 185 }
186 186 }
@@ -1,105 +1,105
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22
23 23 Row {
24 24 anchors.fill: parent
25 25 spacing: 5
26 26 property variant axis
27 27
28 28 Flow {
29 29 spacing: 5
30 30 flow: Flow.TopToBottom
31 31
32 32 Button {
33 33 text: "axis visible"
34 34 onClicked: axis.visible = !axis.visible;
35 35 }
36 36 Button {
37 37 text: "axis grid visible"
38 38 onClicked: axis.gridVisible = !axis.gridVisible;
39 39 }
40 40 Button {
41 41 text: "axis color"
42 42 onClicked: axis.color = main.nextColor();
43 43 }
44 44 Button {
45 45 text: "axis labels color"
46 46 onClicked: axis.labelsColor = main.nextColor();
47 47 }
48 48 Button {
49 49 text: "axis labels angle +"
50 50 onClicked: axis.labelsAngle += 5;
51 51 }
52 52 Button {
53 53 text: "axis labels angle -"
54 54 onClicked: axis.labelsAngle -= 5;
55 55 }
56 56 Button {
57 57 text: "axis shades visible"
58 58 onClicked: axis.shadesVisible = !axis.shadesVisible;
59 59 }
60 60 Button {
61 61 text: "axis shades color"
62 62 onClicked: axis.shadesColor = main.nextColor();
63 63 }
64 64 Button {
65 65 text: "axis shades bcolor"
66 66 onClicked: axis.shadesBorderColor = main.nextColor();
67 67 }
68 68 Button {
69 69 text: "axis max +"
70 70 onClicked: axis.max += 0.1;
71 71 }
72 72 Button {
73 73 text: "axis max -"
74 74 onClicked: axis.max -= 0.1;
75 75 }
76 76 Button {
77 77 text: "axis min +"
78 78 onClicked: axis.min += 0.1;
79 79 }
80 80 Button {
81 81 text: "axis min -"
82 82 onClicked: axis.min -= 0.1;
83 83 }
84 84 Button {
85 text: "axis ticks count +"
86 onClicked: axis.ticksCount++;
85 text: "axis tick count +"
86 onClicked: axis.tickCount++;
87 87 }
88 88 Button {
89 text: "axis ticks count -"
90 onClicked: axis.ticksCount--;
89 text: "axis tick count -"
90 onClicked: axis.tickCount--;
91 91 }
92 92 Button {
93 93 text: "axis nice nmb"
94 94 onClicked: axis.niceNumbersEnabled = !axis.niceNumbersEnabled;
95 95 }
96 96 }
97 97
98 98 FontEditor {
99 99 id: fontEditor
100 100 fontDescription: "axis"
101 101 function editedFont() {
102 102 return axis.labelsFont;
103 103 }
104 104 }
105 105 }
@@ -1,179 +1,179
1 1 /****************************************************************************
2 2 **
3 3 ** Copyright (C) 2012 Digia Plc
4 4 ** All rights reserved.
5 5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 6 **
7 7 ** This file is part of the Qt Commercial Charts Add-on.
8 8 **
9 9 ** $QT_BEGIN_LICENSE$
10 10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 11 ** accordance with the Qt Commercial License Agreement provided with the
12 12 ** Software or, alternatively, in accordance with the terms contained in
13 13 ** a written agreement between you and Digia.
14 14 **
15 15 ** If you have questions regarding the use of this file, please use
16 16 ** contact form at http://qt.digia.com
17 17 ** $QT_END_LICENSE$
18 18 **
19 19 ****************************************************************************/
20 20
21 21 import QtQuick 1.0
22 22
23 23 Rectangle {
24 24 id: main
25 25 width: parent.width
26 26 height: parent.height
27 27 property int viewCount: 9
28 28 property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"]
29 29 property int colorIndex: 0
30 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 37 Row {
38 38 anchors.top: parent.top
39 39 anchors.bottom: buttonRow.top
40 40 anchors.bottomMargin: 10
41 41 anchors.left: parent.left
42 42 anchors.right: parent.right
43 43
44 44 Loader {
45 45 id: chartLoader
46 46 width: main.width - editorLoader.width
47 47 height: parent.height
48 48 source: "Chart.qml"
49 49 onStatusChanged: {
50 50 if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item) {
51 if (source.toString().search("Chart.qml") > 0)
51 if (source.toString().search("/Chart.qml") > 0)
52 52 editorLoader.item.chart = chartLoader.item.chart;
53 53 else
54 54 editorLoader.item.series = chartLoader.item.series;
55 55 }
56 56 }
57 57 }
58 58
59 59 Loader {
60 60 id: editorLoader
61 61 width: 280
62 62 height: parent.height
63 63 source: "ChartEditor.qml"
64 64 onStatusChanged: {
65 65 if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item) {
66 if (source.toString().search("ChartEditor.qml") > 0)
66 if (source.toString().search("/ChartEditor.qml") > 0)
67 67 editorLoader.item.chart = chartLoader.item.chart;
68 68 else
69 69 editorLoader.item.series = chartLoader.item.series;
70 70 }
71 71 }
72 72 }
73 73 }
74 74
75 75 Row {
76 76 id: buttonRow
77 77 height: 40
78 78 anchors.bottom: parent.bottom
79 79 anchors.horizontalCenter: parent.horizontalCenter
80 80 spacing: 10
81 81
82 82 Button {
83 83 text: "chart"
84 84 width: buttonWidth
85 85 onClicked: {
86 86 chartLoader.source = "Chart.qml";
87 87 editorLoader.source = "ChartEditor.qml";
88 88 }
89 89 }
90 90 Button {
91 91 text: "pie"
92 92 width: buttonWidth
93 93 onClicked: {
94 94 chartLoader.source = "PieChart.qml";
95 95 editorLoader.source = "PieEditor.qml";
96 96 }
97 97 }
98 98 Button {
99 99 text: "line"
100 100 width: buttonWidth
101 101 onClicked: {
102 102 chartLoader.source = "LineChart.qml";
103 103 editorLoader.source = "LineEditor.qml";
104 104 }
105 105 }
106 106 Button {
107 107 text: "spline"
108 108 width: buttonWidth
109 109 onClicked: {
110 110 chartLoader.source = "SplineChart.qml";
111 111 editorLoader.source = "LineEditor.qml";
112 112 }
113 113 }
114 114 Button {
115 115 text: "scatter"
116 116 width: buttonWidth
117 117 onClicked: {
118 118 chartLoader.source = "ScatterChart.qml";
119 119 editorLoader.source = "ScatterEditor.qml";
120 120 }
121 121 }
122 122 Button {
123 123 text: "area"
124 124 width: buttonWidth
125 125 onClicked: {
126 126 chartLoader.source = "AreaChart.qml";
127 127 editorLoader.source = "AreaEditor.qml";
128 128 }
129 129 }
130 130 Button {
131 131 text: "bar"
132 132 width: buttonWidth
133 133 onClicked: {
134 134 chartLoader.source = "BarChart.qml";
135 135 editorLoader.source = "BarEditor.qml";
136 136 }
137 137 }
138 138 Button {
139 139 text: "sbar"
140 140 width: buttonWidth
141 141 onClicked: {
142 142 chartLoader.source = "StackedBarChart.qml";
143 143 editorLoader.source = "BarEditor.qml";
144 144 }
145 145 }
146 146 Button {
147 147 text: "pbar"
148 148 width: buttonWidth
149 149 onClicked: {
150 150 chartLoader.source = "PercentBarChart.qml";
151 151 editorLoader.source = "BarEditor.qml";
152 152 }
153 153 }
154 154 Button {
155 155 text: "hbar"
156 156 width: buttonWidth
157 157 onClicked: {
158 158 chartLoader.source = "HorizontalBarChart.qml";
159 159 editorLoader.source = "BarEditor.qml";
160 160 }
161 161 }
162 162 Button {
163 163 text: "hsbar"
164 164 width: buttonWidth
165 165 onClicked: {
166 166 chartLoader.source = "HorizontalStackedBarChart.qml";
167 167 editorLoader.source = "BarEditor.qml";
168 168 }
169 169 }
170 170 Button {
171 171 text: "hpbar"
172 172 width: buttonWidth
173 173 onClicked: {
174 174 chartLoader.source = "HorizontalPercentBarChart.qml";
175 175 editorLoader.source = "BarEditor.qml";
176 176 }
177 177 }
178 178 }
179 179 }
General Comments 0
You need to be logged in to leave comments. Login now