##// END OF EJS Templates
Splitted scatter&area view in QML app (again)
Tero Ahola -
r925:0fae8c496057
parent child
Show More
@@ -1,74 +1,51
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 anchors.fill: parent
26 height: parent.height
27
28 // Another option for QML data api:
29 // ListModel {
30 // id: listModelForPie
31 // // PieDataElement
32 // ListElement {
33 // label: "Apple"
34 // value: 4.3
35 // }
36 // ListElement {
37 // label: "Blackberry"
38 // value: 15.1
39 // }
40 // }
41
42 Component.onCompleted: {
43 // console.log("model:" + myModel.item(0));
44 // myModel.insert(1, {"time":1.4; "speed":41.1 });
45 // scatter.appendData();
46 // chart1.theme = Chart.ThemeHighContrast;
47 // chart2.theme = Chart.ThemeHighContrast;
48 }
49
26
50 Chart {
27 Chart {
51 id: chart1
28 title: "Car brand shares in Finland"
52 anchors.fill: parent
29 anchors.fill: parent
53 theme: Chart.ChartThemeDark
30 theme: Chart.ChartThemeLight
54
55 BarSeries {
56 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
57 // TBD: data
58 }
59
31
60 PieSeries {
32 PieSeries {
61 horizontalPosition: 0.2
33 horizontalPosition: 0.2
62 verticalPosition: 0.3
34 verticalPosition: 0.3
63 size: 0.4
35 size: 0.4
64 endAngle: 0.52 * 360 // The share of "others" is 52%
65 slices: [
36 slices: [
66 PieSlice { label: "Volkswagen"; value: 13.5 },
37 PieSlice { label: "Volkswagen"; value: 13.5 },
67 PieSlice { label: "Toyota"; value: 10.9 },
38 PieSlice { label: "Toyota"; value: 10.9 },
68 PieSlice { label: "Ford"; value: 8.6 },
39 PieSlice { label: "Ford"; value: 8.6 },
69 PieSlice { label: "Skoda"; value: 8.2 },
40 PieSlice { label: "Skoda"; value: 8.2 },
70 PieSlice { label: "Volvo"; value: 6.8 }
41 PieSlice { label: "Volvo"; value: 6.8 },
42 PieSlice { label: "Others"; value: 52.0 }
71 ]
43 ]
72 }
44 }
45
46 BarSeries {
47 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
48 // data implementation missing
49 }
73 }
50 }
74 }
51 }
@@ -1,51 +1,57
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 Chart {
27 Chart {
28 title: "Line&Spline"
28 anchors.fill: parent
29 anchors.fill: parent
29 theme: Chart.ChartThemeBrownSand
30 theme: Chart.ChartThemeBrownSand
30
31
31 LineSeries {
32 LineSeries {
32 name: "Line"
33 name: "Line"
33 points: [
34 points: [
34 XyPoint { x: 0.0; y: 0.0 },
35 XyPoint { x: 0.0; y: 0.0 },
35 XyPoint { x: 1.1; y: 2.1 },
36 XyPoint { x: 1.1; y: 2.1 },
37 XyPoint { x: 1.9; y: 3.3 },
36 XyPoint { x: 2.9; y: 4.9 },
38 XyPoint { x: 2.9; y: 4.9 },
37 XyPoint { x: 3.2; y: 3.0 }
39 XyPoint { x: 3.2; y: 3.0 },
40 XyPoint { x: 4.0; y: 3.3 }
38 ]
41 ]
39 }
42 }
40
43
41 SplineSeries {
44 SplineSeries {
42 name: "Spline"
45 name: "Spline"
43 points: [
46 points: [
44 XyPoint { x: 0.0; y: 0.3 },
47 XyPoint { x: 0.0; y: 0.3 },
45 XyPoint { x: 1.1; y: 3.2 },
48 XyPoint { x: 1.1; y: 3.2 },
46 XyPoint { x: 2.17; y: 2.15 },
49 XyPoint { x: 1.7; y: 2.4 },
47 XyPoint { x: 4.17; y: 3.15 }
50 XyPoint { x: 2.1; y: 2.1 },
51 XyPoint { x: 2.9; y: 2.6 },
52 XyPoint { x: 3.4; y: 2.3 },
53 XyPoint { x: 4.1; y: 3.1 }
48 ]
54 ]
49 }
55 }
50 }
56 }
51 }
57 }
@@ -1,70 +1,128
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 Chart {
27 Chart {
28 title: "NHL All-Star Team Players"
28 anchors.fill: parent
29 anchors.fill: parent
29 theme: Chart.ChartThemeHighContrast
30 theme: Chart.ChartThemeHighContrast
30
31
31 AreaSeries {
32 AreaSeries {
32 name: "Area"
33 name: "Finnish"
33 points: [
34 points: [
34 XyPoint { x: 0.0; y: 1.1 },
35 XyPoint { x: 0; y: 0 },
35 XyPoint { x: 2.5; y: 3.6 },
36 XyPoint { x: 1; y: 0 },
36 XyPoint { x: 3.57; y: 2.55 }
37 XyPoint { x: 2; y: 0 },
38 XyPoint { x: 3; y: 0 },
39 XyPoint { x: 4; y: 0 },
40 XyPoint { x: 5; y: 0 },
41 XyPoint { x: 6; y: 1 },
42 XyPoint { x: 7; y: 0 },
43 XyPoint { x: 8; y: 0 },
44 XyPoint { x: 9; y: 0 },
45 XyPoint { x: 10; y: 0 },
46 XyPoint { x: 11; y: 1 }
37 ]
47 ]
38 lowerPoints: [
48 lowerPoints: [
39 XyPoint { x: 0.0; y: 0.0 },
49 XyPoint { x: 0; y: 0 },
40 XyPoint { x: 2.5; y: 0.0 },
50 XyPoint { x: 1; y: 0 },
41 XyPoint { x: 3.57; y: 0.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 }
42 ]
61 ]
43 }
62 }
44
63
45 ScatterSeries {
64 AreaSeries {
46 name: "Scatter1"
65 name: "Russian"
47 points: [
66 points: [
48 XyPoint { x: 1.5; y: 1.5 },
67 XyPoint { x: 0; y: 1 },
49 XyPoint { x: 1.5; y: 1.6 },
68 XyPoint { x: 1; y: 1 },
50 XyPoint { x: 1.57; y: 1.55 }
69 XyPoint { x: 2; y: 1 },
70 XyPoint { x: 3; y: 1 },
71 XyPoint { x: 4; y: 1 },
72 XyPoint { x: 5; y: 0 },
73 XyPoint { x: 6; y: 1 },
74 XyPoint { x: 7; y: 1 },
75 XyPoint { x: 8; y: 4 },
76 XyPoint { x: 9; y: 3 },
77 XyPoint { x: 10; y: 2 },
78 XyPoint { x: 11; y: 1 }
51 ]
79 ]
52 }
80 lowerPoints: [
53 ScatterSeries {
81 XyPoint { x: 0; y: 0 },
54 name: "Scatter2"
82 XyPoint { x: 1; y: 0 },
55 points: [
83 XyPoint { x: 2; y: 0 },
56 XyPoint { x: 2.0; y: 2.0 },
84 XyPoint { x: 3; y: 0 },
57 XyPoint { x: 2.0; y: 2.1 },
85 XyPoint { x: 4; y: 0 },
58 XyPoint { x: 2.07; y: 2.05 }
86 XyPoint { x: 5; y: 0 },
87 XyPoint { x: 6; y: 0 },
88 XyPoint { x: 7; y: 0 },
89 XyPoint { x: 8; y: 0 },
90 XyPoint { x: 9; y: 0 },
91 XyPoint { x: 10; y: 0 },
92 XyPoint { x: 11; y: 0 }
59 ]
93 ]
60 }
94 }
61 ScatterSeries {
95
62 name: "Scatter3"
96 AreaSeries {
97 name: "Swedish"
63 points: [
98 points: [
64 XyPoint { x: 2.6; y: 2.6 },
99 XyPoint { x: 0; y: 1 },
65 XyPoint { x: 2.6; y: 2.7 },
100 XyPoint { x: 1; y: 1 },
66 XyPoint { x: 2.67; y: 2.65 }
101 XyPoint { x: 2; y: 3 },
102 XyPoint { x: 3; y: 3 },
103 XyPoint { x: 4; y: 2 },
104 XyPoint { x: 5; y: 0 },
105 XyPoint { x: 6; y: 2 },
106 XyPoint { x: 7; y: 1 },
107 XyPoint { x: 8; y: 2 },
108 XyPoint { x: 9; y: 1 },
109 XyPoint { x: 10; y: 3 },
110 XyPoint { x: 11; y: 3 }
111 ]
112 lowerPoints: [
113 XyPoint { x: 0; y: 0 },
114 XyPoint { x: 1; y: 0 },
115 XyPoint { x: 2; y: 0 },
116 XyPoint { x: 3; y: 0 },
117 XyPoint { x: 4; y: 0 },
118 XyPoint { x: 5; y: 0 },
119 XyPoint { x: 6; y: 0 },
120 XyPoint { x: 7; y: 0 },
121 XyPoint { x: 8; y: 0 },
122 XyPoint { x: 9; y: 0 },
123 XyPoint { x: 10; y: 0 },
124 XyPoint { x: 11; y: 0 }
67 ]
125 ]
68 }
126 }
69 }
127 }
70 }
128 }
@@ -1,54 +1,53
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: 0
27 property int __viewNumber: 0
28
28
29 Timer {
29 Timer {
30 id: timer
30 id: timer
31 running: true
31 running: true
32 repeat: true
32 repeat: true
33 interval: 5000
33 interval: 5000
34 triggeredOnStart: true
34 triggeredOnStart: false
35 onTriggered: {
35 onTriggered: {
36 loader.source = "View" + (__viewNumber % 3 + 1) + ".qml";
37 __viewNumber++;
36 __viewNumber++;
38 }
37 }
39 }
38 }
40
39
41 Loader {
40 Loader {
42 id: loader
41 id: loader
43 anchors.fill: parent
42 anchors.fill: parent
43 source: "View" + (__viewNumber % 4 + 1) + ".qml";
44 }
44 }
45
45
46 MouseArea {
46 MouseArea {
47 anchors.fill: parent
47 anchors.fill: parent
48 onClicked: {
48 onClicked: {
49 timer.restart();
49 timer.restart();
50 loader.source = "View" + (__viewNumber % 3 + 1) + ".qml";
51 __viewNumber++;
50 __viewNumber++;
52 }
51 }
53 }
52 }
54 }
53 }
@@ -1,9 +1,10
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 </qresource>
9 </qresource>
9 </RCC>
10 </RCC>
General Comments 0
You need to be logged in to leave comments. Login now