##// END OF EJS Templates
Allow editing of area series in QML tester app
Tero Ahola -
r1784:fcbf003a8d13
parent child
Show More
@@ -1,87 +1,101
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 ChartView {
24 ChartView {
25 title: "area series"
25 title: "area series"
26 anchors.fill: parent
26 anchors.fill: parent
27
27
28 property variant series: areaSeries
28 property variant series: areaSeries
29
29
30 AreaSeries {
30 AreaSeries {
31 id: areaSeries
31 id: areaSeries
32 name: "area 1"
32 name: "area 1"
33
33
34 upperSeries: LineSeries {
34 upperSeries: LineSeries {
35 XYPoint { x: 0; y: 1 }
35 XYPoint { x: 0; y: 1 }
36 XYPoint { x: 1; y: 1 }
36 XYPoint { x: 1; y: 1 }
37 XYPoint { x: 2; y: 3 }
37 XYPoint { x: 2; y: 3 }
38 XYPoint { x: 3; y: 3 }
38 XYPoint { x: 3; y: 3 }
39 XYPoint { x: 4; y: 2 }
39 XYPoint { x: 4; y: 2 }
40 XYPoint { x: 5; y: 0 }
40 XYPoint { x: 5; y: 0 }
41 XYPoint { x: 6; y: 2 }
41 XYPoint { x: 6; y: 2 }
42 XYPoint { x: 7; y: 1 }
42 XYPoint { x: 7; y: 1 }
43 XYPoint { x: 8; y: 2 }
43 XYPoint { x: 8; y: 2 }
44 XYPoint { x: 9; y: 1 }
44 XYPoint { x: 9; y: 1 }
45 XYPoint { x: 10; y: 3 }
45 XYPoint { x: 10; y: 3 }
46 XYPoint { x: 11; y: 3 }
46 XYPoint { x: 11; y: 3 }
47 }
47 }
48 lowerSeries: LineSeries {
49 XYPoint { x: 0; y: 0 }
50 XYPoint { x: 1; y: 0 }
51 XYPoint { x: 2; y: 0 }
52 XYPoint { x: 3; y: 0 }
53 XYPoint { x: 4; y: 0 }
54 XYPoint { x: 5; y: 0 }
55 XYPoint { x: 6; y: 0 }
56 XYPoint { x: 7; y: 0 }
57 XYPoint { x: 8; y: 0 }
58 XYPoint { x: 9; y: 0 }
59 XYPoint { x: 10; y: 0 }
60 XYPoint { x: 11; y: 0 }
61 }
48
62
49 onNameChanged: console.log(name + ".onNameChanged: " + name);
63 onNameChanged: console.log(name + ".onNameChanged: " + name);
50 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
64 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
51 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
65 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
52 onSelected: console.log(name + ".onSelected");
66 onSelected: console.log(name + ".onSelected");
53 onColorChanged: console.log(name + ".onColorChanged: " + color);
67 onColorChanged: console.log(name + ".onColorChanged: " + color);
54 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
68 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
55 // onCountChanged: console.log(name + ".onCountChanged: " + count);
69 // onCountChanged: console.log(name + ".onCountChanged: " + count);
56
70
57 Component.onCompleted: {
71 Component.onCompleted: {
58 createDefaultAxes();
72 createDefaultAxes();
59 }
73 }
60 }
74 }
61
75
62 AreaSeries {
76 AreaSeries {
63 name: "area 2"
77 name: "area 2"
64
78
65 upperSeries: LineSeries {
79 upperSeries: LineSeries {
66 XYPoint { x: 0; y: 0.5 }
80 XYPoint { x: 0; y: 0.5 }
67 XYPoint { x: 1; y: 1.5 }
81 XYPoint { x: 1; y: 1.5 }
68 XYPoint { x: 2; y: 0.3 }
82 XYPoint { x: 2; y: 0.3 }
69 XYPoint { x: 3; y: 1.5 }
83 XYPoint { x: 3; y: 1.5 }
70 XYPoint { x: 4; y: 0.1 }
84 XYPoint { x: 4; y: 0.1 }
71 XYPoint { x: 5; y: 0.3 }
85 XYPoint { x: 5; y: 0.3 }
72 XYPoint { x: 6; y: 1.2 }
86 XYPoint { x: 6; y: 1.2 }
73 XYPoint { x: 7; y: 1.3 }
87 XYPoint { x: 7; y: 1.3 }
74 XYPoint { x: 8; y: 0.2 }
88 XYPoint { x: 8; y: 0.2 }
75 XYPoint { x: 9; y: 0.1 }
89 XYPoint { x: 9; y: 0.1 }
76 XYPoint { x: 10; y: 3.2 }
90 XYPoint { x: 10; y: 3.2 }
77 XYPoint { x: 11; y: 4.6 }
91 XYPoint { x: 11; y: 4.6 }
78 }
92 }
79
93
80 onNameChanged: console.log(name + ".onNameChanged: " + name);
94 onNameChanged: console.log(name + ".onNameChanged: " + name);
81 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
95 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
82 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
96 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
83 onSelected: console.log(name + ".onSelected");
97 onSelected: console.log(name + ".onSelected");
84 onColorChanged: console.log(name + ".onColorChanged: " + color);
98 onColorChanged: console.log(name + ".onColorChanged: " + color);
85 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
99 onBorderColorChanged: console.log(name + ".onBorderColorChanged: " + borderColor);
86 }
100 }
87 }
101 }
@@ -1,59 +1,71
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
24
25 Flow {
25 Flow {
26 id: flow
26 id: flow
27 spacing: 5
27 spacing: 5
28 flow: Flow.TopToBottom
28 flow: Flow.TopToBottom
29 property variant series
29 property variant series
30
30
31 Button {
31 Button {
32 text: "visible"
32 text: "visible"
33 onClicked: series.visible = !series.visible;
33 onClicked: series.visible = !series.visible;
34 }
34 }
35 Button {
35 Button {
36 text: "color"
36 text: "color"
37 onClicked: series.color = main.nextColor();
37 onClicked: series.color = main.nextColor();
38 }
38 }
39 Button {
39 Button {
40 text: "borderColor"
40 text: "borderColor"
41 onClicked: series.borderColor = main.nextColor();
41 onClicked: series.borderColor = main.nextColor();
42 }
42 }
43 Button {
43 Button {
44 text: "upper color"
44 id: upperButton
45 onClicked: series.upperSeries.color = main.nextColor();
45 text: "upper series"
46 unpressedColor: "#79bd8f"
47 onClicked: {
48 lineEditor.visible = true;
49 color = "#00a388";
50 lowerButton.color = "#79bd8f";
51 lineEditor.series = series.upperSeries;
52 }
46 }
53 }
47 Button {
54 Button {
48 text: "lower color"
55 id: lowerButton
49 onClicked: series.lowerSeries.color = main.nextColor();
56 text: "lower series"
57 unpressedColor: "#79bd8f"
58 onClicked: {
59 lineEditor.visible = true;
60 color = "#00a388";
61 upperButton.color = "#79bd8f";
62 lineEditor.series = series.lowerSeries;
63 }
50 }
64 }
51 Button {
65 LineEditor {
52 text: "upper points visible"
66 id: lineEditor
53 onClicked: series.upperSeries.pointsVisible = !series.pointsVisible;
67 visible: false
54 }
55 Button {
56 text: "lower points visible"
57 onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible;
58 }
68 }
69
70 onSeriesChanged: lineEditor.series = series.upperSeries;
59 }
71 }
@@ -1,81 +1,100
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 Item {
24 Item {
25 id: chartEditor
25 id: chartEditor
26 property variant series // TODO: rename to chart
26 property variant series // TODO: rename to chart
27 onSeriesChanged: loader.item.chart = series;
27 onSeriesChanged: loader.item.chart = series;
28
28
29 Flow {
29 Flow {
30 id: selectorFlow
30 id: selectorFlow
31 anchors.top: parent.top
31 anchors.top: parent.top
32 height: 60
32 height: 60
33 anchors.left: parent.left
33 anchors.left: parent.left
34 anchors.right: parent.right
34 anchors.right: parent.right
35 spacing: 5
35 spacing: 5
36 flow: Flow.TopToBottom
36 flow: Flow.TopToBottom
37
37
38 Button {
38 Button {
39 id: chartButton
39 text: "Chart properties"
40 text: "Chart properties"
40 unpressedColor: "#ff6138"
41 unpressedColor: "#79bd8f"
41 onClicked: {
42 onClicked: {
43 color = "#00a388";
44 legendButton.color = "#79bd8f";
45 axisXButton.color = "#79bd8f";
46 axisYButton.color = "#79bd8f";
42 loader.source = "ChartEditor1.qml";
47 loader.source = "ChartEditor1.qml";
43 loader.item.chart = series;
48 loader.item.chart = series;
44 }
49 }
45 }
50 }
46 Button {
51 Button {
52 id: legendButton
47 text: "Legend properties"
53 text: "Legend properties"
48 unpressedColor: "#79bd8f"
54 unpressedColor: "#79bd8f"
49 onClicked: {
55 onClicked: {
56 color = "#00a388";
57 chartButton.color = "#79bd8f";
58 axisXButton.color = "#79bd8f";
59 axisYButton.color = "#79bd8f";
50 loader.source = "ChartEditor2.qml";
60 loader.source = "ChartEditor2.qml";
51 loader.item.chartLegend = series.legend;
61 loader.item.chartLegend = series.legend;
52 }
62 }
53 }
63 }
54 Button {
64 Button {
65 id: axisXButton
55 text: "Axis X properties"
66 text: "Axis X properties"
56 unpressedColor: "#beeb9f"
67 unpressedColor: "#79bd8f"
57 onClicked: {
68 onClicked: {
69 color = "#00a388";
70 chartButton.color = "#79bd8f";
71 legendButton.color = "#79bd8f";
72 axisYButton.color = "#79bd8f";
58 loader.source = "ChartEditor3.qml";
73 loader.source = "ChartEditor3.qml";
59 loader.item.axis = series.axisX;
74 loader.item.axis = series.axisX;
60 }
75 }
61 }
76 }
62 Button {
77 Button {
78 id: axisYButton
63 text: "Axis Y properties"
79 text: "Axis Y properties"
64 unpressedColor: "#00a388"
80 unpressedColor: "#79bd8f"
65 onClicked: {
81 onClicked: {
82 color = "#00a388";
83 chartButton.color = "#79bd8f";
84 legendButton.color = "#79bd8f";
85 axisXButton.color = "#79bd8f";
66 loader.source = "ChartEditor3.qml";
86 loader.source = "ChartEditor3.qml";
67 loader.item.axis = series.axisY;
87 loader.item.axis = series.axisY;
68 }
88 }
69 }
89 }
70 }
90 }
71
91
72 Loader {
92 Loader {
73 id: loader
93 id: loader
74 anchors.top: selectorFlow.bottom
94 anchors.top: selectorFlow.bottom
75 anchors.bottom: parent.bottom
95 anchors.bottom: parent.bottom
76 anchors.left: parent.left
96 anchors.left: parent.left
77 anchors.right: parent.right
97 anchors.right: parent.right
78 source: "ChartEditor1.qml"
79 }
98 }
80
99
81 }
100 }
General Comments 0
You need to be logged in to leave comments. Login now