##// END OF EJS Templates
Fixed qmlcustommodel
Marek Rosa -
r1619:184fe7965456
parent child
Show More
@@ -34,10 +34,16 Rectangle {
34
34
35 BarCategoriesAxis {
35 BarCategoriesAxis {
36 id: categoryAxis
36 id: categoryAxis
37 categories: ["2007", "2008", "2009", "2010", "2011", "2012" ]
37 categories: ["2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014" ]
38 }
39
40 ValuesAxis {
41 id: yAxis
42 min: 0
43 max: 60
38 }
44 }
39 // ...
45 // ...
40 //![1]
46 //![1]
41
47
42 //![2]
48 //![2]
43 CustomModel {
49 CustomModel {
@@ -58,7 +64,7 Rectangle {
58 id: myBarSeries
64 id: myBarSeries
59 name: "Others"
65 name: "Others"
60 barWidth: 0.9
66 barWidth: 0.9
61 // visible: false
67 visible: false
62 HBarModelMapper {
68 HBarModelMapper {
63 model: customModel
69 model: customModel
64 firstBarSetRow: 6
70 firstBarSetRow: 6
@@ -70,8 +76,9 Rectangle {
70
76
71 //![4]
77 //![4]
72 LineSeries {
78 LineSeries {
79 id: lineSeries1
73 name: "Volkswagen"
80 name: "Volkswagen"
74 //visible: false
81 visible: false
75 HXYModelMapper {
82 HXYModelMapper {
76 model: customModel
83 model: customModel
77 xRow: 0
84 xRow: 0
@@ -82,6 +89,7 Rectangle {
82 //![4]
89 //![4]
83
90
84 LineSeries {
91 LineSeries {
92 id: lineSeries2
85 name: "Toyota"
93 name: "Toyota"
86 visible: false
94 visible: false
87 HXYModelMapper {
95 HXYModelMapper {
@@ -93,6 +101,7 Rectangle {
93 }
101 }
94
102
95 LineSeries {
103 LineSeries {
104 id: lineSeries3
96 name: "Ford"
105 name: "Ford"
97 visible: false
106 visible: false
98 HXYModelMapper {
107 HXYModelMapper {
@@ -104,6 +113,7 Rectangle {
104 }
113 }
105
114
106 LineSeries {
115 LineSeries {
116 id: lineSeries4
107 name: "Skoda"
117 name: "Skoda"
108 visible: false
118 visible: false
109 HXYModelMapper {
119 HXYModelMapper {
@@ -115,6 +125,7 Rectangle {
115 }
125 }
116
126
117 LineSeries {
127 LineSeries {
128 id: lineSeries5
118 name: "Volvo"
129 name: "Volvo"
119 visible: false
130 visible: false
120 HXYModelMapper {
131 HXYModelMapper {
@@ -129,7 +140,7 Rectangle {
129 PieSeries {
140 PieSeries {
130 id: pieSeries
141 id: pieSeries
131 size: 0.4
142 size: 0.4
132 horizontalPosition: 0.7
143 horizontalPosition: 0.85
133 verticalPosition: 0.4
144 verticalPosition: 0.4
134 onClicked: {
145 onClicked: {
135 // Show the selection by exploding the slice
146 // Show the selection by exploding the slice
@@ -142,20 +153,32 Rectangle {
142 }
153 }
143 }
154 }
144 }
155 }
156
157 VPieModelMapper {
158 model: customModel
159 labelsColumn: 1
160 valuesColumn: 2
161 firstRow: 1
162 }
145 }
163 }
146 //![3]
164 //![3]
147
165
148 VPieModelMapper {
149 series: pieSeries
150 model: customModel
151 labelsColumn: 1
152 valuesColumn: 2
153 firstRow: 1
154 }
155
156 Component.onCompleted: {
166 Component.onCompleted: {
157 createDefaultAxes();
167 createDefaultAxes();
158 setAxisX(categoryAxis,myBarSeries)
168 setAxisX(categoryAxis,myBarSeries)
159 }
169 setAxisX(categoryAxis,lineSeries1)
170 setAxisX(categoryAxis,lineSeries2)
171 setAxisX(categoryAxis,lineSeries3)
172 setAxisX(categoryAxis,lineSeries4)
173 setAxisX(categoryAxis,lineSeries5)
174 setAxisY(yAxis,myBarSeries)
175 setAxisY(yAxis,lineSeries1)
176 setAxisY(yAxis,lineSeries2)
177 setAxisY(yAxis,lineSeries3)
178 setAxisY(yAxis,lineSeries4)
179 setAxisY(yAxis,lineSeries5)
180 categoryAxis.min = "2007"
181 categoryAxis.max = "2014"
182 }
160 }
183 }
161 }
184 }
General Comments 0
You need to be logged in to leave comments. Login now