##// END OF EJS Templates
QML demo basic area chart to use value axis to make it simpler
Tero Ahola -
r1934:e8c5b1221524
parent child
Show More
@@ -1,117 +1,107
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.1
22 import QtCommercial.Chart 1.1
23
23
24 Rectangle {
24 Rectangle {
25 anchors.fill: parent
25 anchors.fill: parent
26
26
27 //![1]
27 //![1]
28 ChartView {
28 ChartView {
29 title: "NHL All-Star Team Players"
29 title: "NHL All-Star Team Players"
30 anchors.fill: parent
30 anchors.fill: parent
31
31
32 CategoryAxis {
32 ValueAxis {
33 id: categoriesAxis
33 id: valueAxis
34 startValue: -0.5
34 min: 2000
35 CategoryRange { endValue: 0.5; label: "2000" }
35 max: 2011
36 CategoryRange { endValue: 1.5; label: "2001" }
36 tickCount: 12
37 CategoryRange { endValue: 2.5; label: "2002" }
38 CategoryRange { endValue: 3.5; label: "2003" }
39 CategoryRange { endValue: 4.5; label: "2004" }
40 CategoryRange { endValue: 5.5; label: "2005" }
41 CategoryRange { endValue: 6.5; label: "2006" }
42 CategoryRange { endValue: 7.5; label: "2007" }
43 CategoryRange { endValue: 8.5; label: "2008" }
44 CategoryRange { endValue: 9.5; label: "2009" }
45 CategoryRange { endValue: 10.5; label: "2010" }
46 CategoryRange { endValue: 11.5; label: "2011" }
47 }
37 }
48
38
49 AreaSeries {
39 AreaSeries {
50 name: "Russian"
40 name: "Russian"
51 color: "#FFD52B1E"
41 color: "#FFD52B1E"
52 borderColor: "#FF0039A5"
42 borderColor: "#FF0039A5"
53 borderWidth: 3
43 borderWidth: 3
54 axisX: categoriesAxis
44 axisX: valueAxis
55 upperSeries: LineSeries {
45 upperSeries: LineSeries {
56 XYPoint { x: 0; y: 1 }
46 XYPoint { x: 2000; y: 1 }
57 XYPoint { x: 1; y: 1 }
47 XYPoint { x: 2001; y: 1 }
58 XYPoint { x: 2; y: 1 }
48 XYPoint { x: 2002; y: 1 }
59 XYPoint { x: 3; y: 1 }
49 XYPoint { x: 2003; y: 1 }
60 XYPoint { x: 4; y: 1 }
50 XYPoint { x: 2004; y: 1 }
61 XYPoint { x: 5; y: 0 }
51 XYPoint { x: 2005; y: 0 }
62 XYPoint { x: 6; y: 1 }
52 XYPoint { x: 2006; y: 1 }
63 XYPoint { x: 7; y: 1 }
53 XYPoint { x: 2007; y: 1 }
64 XYPoint { x: 8; y: 4 }
54 XYPoint { x: 2008; y: 4 }
65 XYPoint { x: 9; y: 3 }
55 XYPoint { x: 2009; y: 3 }
66 XYPoint { x: 10; y: 2 }
56 XYPoint { x: 2010; y: 2 }
67 XYPoint { x: 11; y: 1 }
57 XYPoint { x: 2011; y: 1 }
68 }
58 }
69 }
59 }
70 // ...
60 // ...
71 //![1]
61 //![1]
72
62
73 AreaSeries {
63 AreaSeries {
74 name: "Swedish"
64 name: "Swedish"
75 color: "#AF005292"
65 color: "#AF005292"
76 borderColor: "#AFFDCA00"
66 borderColor: "#AFFDCA00"
77 borderWidth: 3
67 borderWidth: 3
78 axisX: categoriesAxis
68 axisX: valueAxis
79 upperSeries: LineSeries {
69 upperSeries: LineSeries {
80 XYPoint { x: 0; y: 1 }
70 XYPoint { x: 2000; y: 1 }
81 XYPoint { x: 1; y: 1 }
71 XYPoint { x: 2001; y: 1 }
82 XYPoint { x: 2; y: 3 }
72 XYPoint { x: 2002; y: 3 }
83 XYPoint { x: 3; y: 3 }
73 XYPoint { x: 2003; y: 3 }
84 XYPoint { x: 4; y: 2 }
74 XYPoint { x: 2004; y: 2 }
85 XYPoint { x: 5; y: 0 }
75 XYPoint { x: 2005; y: 0 }
86 XYPoint { x: 6; y: 2 }
76 XYPoint { x: 2006; y: 2 }
87 XYPoint { x: 7; y: 1 }
77 XYPoint { x: 2007; y: 1 }
88 XYPoint { x: 8; y: 2 }
78 XYPoint { x: 2008; y: 2 }
89 XYPoint { x: 9; y: 1 }
79 XYPoint { x: 2009; y: 1 }
90 XYPoint { x: 10; y: 3 }
80 XYPoint { x: 2010; y: 3 }
91 XYPoint { x: 11; y: 3 }
81 XYPoint { x: 2011; y: 3 }
92 }
82 }
93 }
83 }
94
84
95 AreaSeries {
85 AreaSeries {
96 name: "Finnish"
86 name: "Finnish"
97 color: "#00357F"
87 color: "#00357F"
98 borderColor: "#FEFEFE"
88 borderColor: "#FEFEFE"
99 borderWidth: 3
89 borderWidth: 3
100 axisX: categoriesAxis
90 axisX: valueAxis
101 upperSeries: LineSeries {
91 upperSeries: LineSeries {
102 XYPoint { x: 0; y: 0 }
92 XYPoint { x: 2000; y: 0 }
103 XYPoint { x: 1; y: 0 }
93 XYPoint { x: 2001; y: 0 }
104 XYPoint { x: 2; y: 0 }
94 XYPoint { x: 2002; y: 0 }
105 XYPoint { x: 3; y: 0 }
95 XYPoint { x: 2003; y: 0 }
106 XYPoint { x: 4; y: 0 }
96 XYPoint { x: 2004; y: 0 }
107 XYPoint { x: 5; y: 0 }
97 XYPoint { x: 2005; y: 0 }
108 XYPoint { x: 6; y: 1 }
98 XYPoint { x: 2006; y: 1 }
109 XYPoint { x: 7; y: 0 }
99 XYPoint { x: 2007; y: 0 }
110 XYPoint { x: 8; y: 0 }
100 XYPoint { x: 2008; y: 0 }
111 XYPoint { x: 9; y: 0 }
101 XYPoint { x: 2009; y: 0 }
112 XYPoint { x: 10; y: 0 }
102 XYPoint { x: 2010; y: 0 }
113 XYPoint { x: 11; y: 1 }
103 XYPoint { x: 2011; y: 1 }
114 }
104 }
115 }
105 }
116 }
106 }
117 }
107 }
General Comments 0
You need to be logged in to leave comments. Login now