##// END OF EJS Templates
Drafting the new mapper api on QML
Tero Ahola -
r1221:d772c9d3a6aa
parent child
Show More
@@ -27,41 +27,66 Rectangle {
27
27
28 ChartView {
28 ChartView {
29 id: chart
29 id: chart
30 title: "Top-5 car brand shares in Finland"
30 title: "Custom model example"
31 anchors.fill: parent
31 anchors.fill: parent
32 theme: ChartView.ChartThemeLight
32 theme: ChartView.ChartThemeLight
33
33
34 // For dynamic data you can use the ChartModel API.
34 // For dynamic data you can use the ChartModel API.
35 ChartModel {
35 ChartModel {
36 id: chartModel
36 id: chartModel
37 ChartModelElement { values: [0, "Volkswagen", 13.5] }
37 ChartModelElement { values: [0, "Volkswagen", 13.5, 4.4] }
38 ChartModelElement { values: [0, "Toyota", 10.9] }
38 ChartModelElement { values: [0, "Toyota", 10.9, 4.2] }
39 ChartModelElement { values: [0, "Ford", 8.6] }
39 ChartModelElement { values: [0, "Ford", 8.6, 3.0] }
40 ChartModelElement { values: [0, "Skoda", 8.2] }
40 ChartModelElement { values: [0, "Skoda", 8.2, 1.9] }
41 ChartModelElement { values: [0, "Volvo", 6.8] }
41 ChartModelElement { values: [0, "Volvo", 6.8, 1.5] }
42 }
42 }
43
43
44 LineSeries {
44 LineSeries {
45 name: "line"
45 name: "line"
46 // TODO: the current mapper api
46 model: chartModel
47 model: chartModel
47 modelMapper.mapX: 2
48 modelMapper.mapX: 3
48 modelMapper.mapY: 2
49 modelMapper.mapY: 3
50
51 // TODO: the new mapper api
52 // XYModelMapperVertical {
53 // model: chartModel
54 // xColumn: 0
55 // yColumn: 1
56 // }
49 }
57 }
50
58
59
51 PieSeries {
60 PieSeries {
52 id: pieSeries
61 id: pieSeries
53 model: chartModel
54 size: 0.4
62 size: 0.4
55 horizontalPosition: 0.2
63 horizontalPosition: 0.2
56 verticalPosition: 0.3
64 verticalPosition: 0.3
57 // Define how your data maps to pie slices with the ModelMapper API of the pie series
65
58 modelMapper.mapLabels: 1
66 // model: chartModel
59 modelMapper.mapValues: 2
67 // // TODO: the current mapper api
60 modelMapper.first: 0
68 // modelMapper.mapLabels: 1
61 modelMapper.count: -1 // "Undefined" = -1 by default
69 // modelMapper.mapValues: 2
62 modelMapper.orientation: PieModelMapper.Vertical
70 // modelMapper.first: 0
71 // modelMapper.count: -1 // "Undefined" = -1 by default
72 // modelMapper.orientation: PieModelMapper.Vertical
73
74 // TODO: the new mapper api
75 // PieModelMapperVertical {
76 // model: chartModel
77 // labelsColumn: 0
78 // valuesColumn: 1
79 // }
63 }
80 }
64
81
82 // TODO: the new mapper api
83 // PieModelMapperVertical {
84 // series: pieSeries
85 // model: chartModel
86 // labelsColumn: 0
87 // valuesColumn: 1
88 // }
89
65 AreaSeries {
90 AreaSeries {
66 name: "area"
91 name: "area"
67 upperSeries: LineSeries {
92 upperSeries: LineSeries {
General Comments 0
You need to be logged in to leave comments. Login now