##// 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 28 ChartView {
29 29 id: chart
30 title: "Top-5 car brand shares in Finland"
30 title: "Custom model example"
31 31 anchors.fill: parent
32 32 theme: ChartView.ChartThemeLight
33 33
34 34 // For dynamic data you can use the ChartModel API.
35 35 ChartModel {
36 36 id: chartModel
37 ChartModelElement { values: [0, "Volkswagen", 13.5] }
38 ChartModelElement { values: [0, "Toyota", 10.9] }
39 ChartModelElement { values: [0, "Ford", 8.6] }
40 ChartModelElement { values: [0, "Skoda", 8.2] }
41 ChartModelElement { values: [0, "Volvo", 6.8] }
37 ChartModelElement { values: [0, "Volkswagen", 13.5, 4.4] }
38 ChartModelElement { values: [0, "Toyota", 10.9, 4.2] }
39 ChartModelElement { values: [0, "Ford", 8.6, 3.0] }
40 ChartModelElement { values: [0, "Skoda", 8.2, 1.9] }
41 ChartModelElement { values: [0, "Volvo", 6.8, 1.5] }
42 42 }
43 43
44 44 LineSeries {
45 45 name: "line"
46 // TODO: the current mapper api
46 47 model: chartModel
47 modelMapper.mapX: 2
48 modelMapper.mapY: 2
48 modelMapper.mapX: 3
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 60 PieSeries {
52 61 id: pieSeries
53 model: chartModel
54 62 size: 0.4
55 63 horizontalPosition: 0.2
56 64 verticalPosition: 0.3
57 // Define how your data maps to pie slices with the ModelMapper API of the pie series
58 modelMapper.mapLabels: 1
59 modelMapper.mapValues: 2
60 modelMapper.first: 0
61 modelMapper.count: -1 // "Undefined" = -1 by default
62 modelMapper.orientation: PieModelMapper.Vertical
65
66 // model: chartModel
67 // // TODO: the current mapper api
68 // modelMapper.mapLabels: 1
69 // modelMapper.mapValues: 2
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 90 AreaSeries {
66 91 name: "area"
67 92 upperSeries: LineSeries {
General Comments 0
You need to be logged in to leave comments. Login now