@@ -39,8 +39,8 Rectangle { | |||||
39 | max: "2014" |
|
39 | max: "2014" | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 |
Value |
|
42 | ValueAxis { | |
43 |
id: value |
|
43 | id: valueAxis | |
44 | min: 0 |
|
44 | min: 0 | |
45 | max: 60 |
|
45 | max: 60 | |
46 | } |
|
46 | } | |
@@ -66,7 +66,7 Rectangle { | |||||
66 | id: myBarSeries |
|
66 | id: myBarSeries | |
67 | name: "Others" |
|
67 | name: "Others" | |
68 | axisX: categoriesAxis |
|
68 | axisX: categoriesAxis | |
69 |
axisY: value |
|
69 | axisY: valueAxis | |
70 | barWidth: 0.9 |
|
70 | barWidth: 0.9 | |
71 | visible: false |
|
71 | visible: false | |
72 | HBarModelMapper { |
|
72 | HBarModelMapper { | |
@@ -83,7 +83,7 Rectangle { | |||||
83 | id: lineSeries1 |
|
83 | id: lineSeries1 | |
84 | name: "Volkswagen" |
|
84 | name: "Volkswagen" | |
85 | axisX: categoriesAxis |
|
85 | axisX: categoriesAxis | |
86 |
axisY: value |
|
86 | axisY: valueAxis | |
87 | visible: false |
|
87 | visible: false | |
88 | HXYModelMapper { |
|
88 | HXYModelMapper { | |
89 | model: customModel |
|
89 | model: customModel | |
@@ -98,7 +98,7 Rectangle { | |||||
98 | id: lineSeries2 |
|
98 | id: lineSeries2 | |
99 | name: "Toyota" |
|
99 | name: "Toyota" | |
100 | axisX: categoriesAxis |
|
100 | axisX: categoriesAxis | |
101 |
axisY: value |
|
101 | axisY: valueAxis | |
102 | visible: false |
|
102 | visible: false | |
103 | HXYModelMapper { |
|
103 | HXYModelMapper { | |
104 | model: customModel |
|
104 | model: customModel | |
@@ -112,7 +112,7 Rectangle { | |||||
112 | id: lineSeries3 |
|
112 | id: lineSeries3 | |
113 | name: "Ford" |
|
113 | name: "Ford" | |
114 | axisX: categoriesAxis |
|
114 | axisX: categoriesAxis | |
115 |
axisY: value |
|
115 | axisY: valueAxis | |
116 | visible: false |
|
116 | visible: false | |
117 | HXYModelMapper { |
|
117 | HXYModelMapper { | |
118 | model: customModel |
|
118 | model: customModel | |
@@ -126,7 +126,7 Rectangle { | |||||
126 | id: lineSeries4 |
|
126 | id: lineSeries4 | |
127 | name: "Skoda" |
|
127 | name: "Skoda" | |
128 | axisX: categoriesAxis |
|
128 | axisX: categoriesAxis | |
129 |
axisY: value |
|
129 | axisY: valueAxis | |
130 | visible: false |
|
130 | visible: false | |
131 | HXYModelMapper { |
|
131 | HXYModelMapper { | |
132 | model: customModel |
|
132 | model: customModel | |
@@ -140,7 +140,7 Rectangle { | |||||
140 | id: lineSeries5 |
|
140 | id: lineSeries5 | |
141 | name: "Volvo" |
|
141 | name: "Volvo" | |
142 | axisX: categoriesAxis |
|
142 | axisX: categoriesAxis | |
143 |
axisY: value |
|
143 | axisY: valueAxis | |
144 | visible: false |
|
144 | visible: false | |
145 | HXYModelMapper { |
|
145 | HXYModelMapper { | |
146 | model: customModel |
|
146 | model: customModel |
@@ -25,13 +25,13 ChartView { | |||||
25 | id: chartView |
|
25 | id: chartView | |
26 | animationOptions: ChartView.NoAnimation |
|
26 | animationOptions: ChartView.NoAnimation | |
27 |
|
27 | |||
28 |
Value |
|
28 | ValueAxis { | |
29 | id: axisY |
|
29 | id: axisY | |
30 | min: -1 |
|
30 | min: -1 | |
31 | max: 3 |
|
31 | max: 3 | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 |
Value |
|
34 | ValueAxis { | |
35 | id: axisX |
|
35 | id: axisX | |
36 | min: 0 |
|
36 | min: 0 | |
37 | max: 1000 |
|
37 | max: 1000 | |
@@ -76,8 +76,6 ChartView { | |||||
76 | series.markerSize = 3; |
|
76 | series.markerSize = 3; | |
77 | series.borderColor = "transparent"; |
|
77 | series.borderColor = "transparent"; | |
78 | } |
|
78 | } | |
79 | // chartView.setAxisX(axisX, series); |
|
|||
80 | // chartView.setAxisY(axisY, series); |
|
|||
81 |
|
|
79 | } | |
82 | } |
|
80 | } | |
83 |
|
81 |
@@ -44,36 +44,36 Rectangle { | |||||
44 | BarSeries { |
|
44 | BarSeries { | |
45 | id: myBarSeries |
|
45 | id: myBarSeries | |
46 | axisX: barCategoriesAxis |
|
46 | axisX: barCategoriesAxis | |
47 |
axisY: value |
|
47 | axisY: valueAxisY | |
48 | BarSet { |
|
48 | BarSet { | |
49 | id: rainfallSet |
|
49 | id: rainfallSet | |
50 | label: "Rainfall" |
|
50 | label: "Rainfall" | |
51 | } |
|
51 | } | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 |
Value |
|
54 | ValueAxis { | |
55 |
id: value |
|
55 | id: valueAxisX | |
56 | min: 0 |
|
56 | min: 0 | |
57 | max: 5 |
|
57 | max: 5 | |
58 | } |
|
58 | } | |
59 |
|
59 | |||
60 |
Value |
|
60 | ValueAxis{ | |
61 |
id: value |
|
61 | id: valueAxisY | |
62 | min: 0 |
|
62 | min: 0 | |
63 | max: 10 |
|
63 | max: 10 | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | LineSeries { |
|
66 | LineSeries { | |
67 | id: maxTempSeries |
|
67 | id: maxTempSeries | |
68 |
axisX: value |
|
68 | axisX: valueAxisX | |
69 |
axisY: value |
|
69 | axisY: valueAxisY | |
70 | name: "Max. temperature" |
|
70 | name: "Max. temperature" | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | LineSeries { |
|
73 | LineSeries { | |
74 | id: minTempSeries |
|
74 | id: minTempSeries | |
75 |
axisX: value |
|
75 | axisX: valueAxisX | |
76 |
axisY: value |
|
76 | axisY: valueAxisY | |
77 | name: "Min. temperature" |
|
77 | name: "Min. temperature" | |
78 | } |
|
78 | } | |
79 | //![2] |
|
79 | //![2] | |
@@ -165,9 +165,9 Rectangle { | |||||
165 | //![5] |
|
165 | //![5] | |
166 |
|
166 | |||
167 | // Update scale of the chart |
|
167 | // Update scale of the chart | |
168 |
value |
|
168 | valueAxisY.max = Math.max(chartView.axisY().max,weatherObj.tempMaxC); | |
169 |
value |
|
169 | valueAxisX.min = 0; | |
170 |
value |
|
170 | valueAxisX.max = Number(i) + 1; | |
171 |
|
171 | |||
172 | // Set the x-axis labels to the dates of the forecast |
|
172 | // Set the x-axis labels to the dates of the forecast | |
173 | var xLabels = barCategoriesAxis.categories; |
|
173 | var xLabels = barCategoriesAxis.categories; |
@@ -71,7 +71,7 public: | |||||
71 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); |
|
71 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); | |
72 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); |
|
72 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); | |
73 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); |
|
73 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); | |
74 |
qmlRegisterType<QValueAxis>(uri, 1, 0, "Value |
|
74 | qmlRegisterType<QValueAxis>(uri, 1, 0, "ValueAxis"); | |
75 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); |
|
75 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); | |
76 |
|
76 | |||
77 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", |
|
77 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", |
@@ -66,7 +66,7 ChartView { | |||||
66 | legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color); |
|
66 | legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color); | |
67 |
|
67 | |||
68 |
|
68 | |||
69 |
Value |
|
69 | ValueAxis{ | |
70 | onColorChanged: console.log("axisX.onColorChanged: " + color); |
|
70 | onColorChanged: console.log("axisX.onColorChanged: " + color); | |
71 | onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible); |
|
71 | onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible); | |
72 | onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color); |
|
72 | onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color); | |
@@ -79,7 +79,7 ChartView { | |||||
79 | onMaxChanged: console.log("axisX.onMaxChanged: " + max); |
|
79 | onMaxChanged: console.log("axisX.onMaxChanged: " + max); | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 |
Value |
|
82 | ValueAxis{ | |
83 | onColorChanged: console.log("axisY.onColorChanged: " + color); |
|
83 | onColorChanged: console.log("axisY.onColorChanged: " + color); | |
84 | onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible); |
|
84 | onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible); | |
85 | onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color); |
|
85 | onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color); |
@@ -24,13 +24,13 import QtCommercial.Chart 1.0 | |||||
24 | ChartView { |
|
24 | ChartView { | |
25 | title: "user defined axes" |
|
25 | title: "user defined axes" | |
26 |
|
26 | |||
27 |
Value |
|
27 | ValueAxis { | |
28 | id: axisX |
|
28 | id: axisX | |
29 | min: 0 |
|
29 | min: 0 | |
30 | max: 10 |
|
30 | max: 10 | |
31 | } |
|
31 | } | |
32 |
|
32 | |||
33 |
Value |
|
33 | ValueAxis { | |
34 | id: axisY |
|
34 | id: axisY | |
35 | min: 0 |
|
35 | min: 0 | |
36 | max: 6 |
|
36 | max: 6 |
@@ -25,7 +25,7 ChartView { | |||||
25 | id: chartView |
|
25 | id: chartView | |
26 | title: "user defined axes" |
|
26 | title: "user defined axes" | |
27 |
|
27 | |||
28 |
Value |
|
28 | ValueAxis { | |
29 | id: axisX |
|
29 | id: axisX | |
30 | min: 0 |
|
30 | min: 0 | |
31 | max: 10 |
|
31 | max: 10 | |
@@ -33,7 +33,7 ChartView { | |||||
33 | // that don't have user defined X axis |
|
33 | // that don't have user defined X axis | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 |
Value |
|
36 | ValueAxis { | |
37 | id: axisY |
|
37 | id: axisY | |
38 | min: 0 |
|
38 | min: 0 | |
39 | max: 5 |
|
39 | max: 5 |
@@ -55,8 +55,8 ChartView { | |||||
55 | LineSeries { |
|
55 | LineSeries { | |
56 | id: lineSeries |
|
56 | id: lineSeries | |
57 | name: "line series" |
|
57 | name: "line series" | |
58 |
axisX: Value |
|
58 | axisX: ValueAxis { id: lineAxisX } | |
59 |
axisY: Value |
|
59 | axisY: ValueAxis { id: lineAxisY } | |
60 |
|
60 | |||
61 | XYPoint { x: 0; y: 0 } |
|
61 | XYPoint { x: 0; y: 0 } | |
62 | XYPoint { x: 1.1; y: 2.1 } |
|
62 | XYPoint { x: 1.1; y: 2.1 } | |
@@ -70,8 +70,8 ChartView { | |||||
70 | ScatterSeries { |
|
70 | ScatterSeries { | |
71 | id: scatterSeries |
|
71 | id: scatterSeries | |
72 | name: "scatter series" |
|
72 | name: "scatter series" | |
73 |
axisX: Value |
|
73 | axisX: ValueAxis { id: scatterAxisX } | |
74 |
axisY: Value |
|
74 | axisY: ValueAxis { id: scatterAxisY } | |
75 |
|
75 | |||
76 | XYPoint { x: 0; y: 0 } |
|
76 | XYPoint { x: 0; y: 0 } | |
77 | XYPoint { x: 1.1; y: 2.1 } |
|
77 | XYPoint { x: 1.1; y: 2.1 } |
@@ -30,21 +30,21 ChartView { | |||||
30 | repeat: true |
|
30 | repeat: true | |
31 | running: true |
|
31 | running: true | |
32 | onTriggered: { |
|
32 | onTriggered: { | |
33 |
if (lineSeries.axisX == value |
|
33 | if (lineSeries.axisX == valueAxis1) | |
34 |
lineSeries.axisX = value |
|
34 | lineSeries.axisX = valueAxis2; | |
35 | else |
|
35 | else | |
36 |
lineSeries.axisX = value |
|
36 | lineSeries.axisX = valueAxis1; | |
37 | } |
|
37 | } | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 |
Value |
|
40 | ValueAxis { | |
41 |
id: value |
|
41 | id: valueAxis1 | |
42 | min: 0 |
|
42 | min: 0 | |
43 | max: 5 |
|
43 | max: 5 | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 |
Value |
|
46 | ValueAxis { | |
47 |
id: value |
|
47 | id: valueAxis2 | |
48 | min: 1 |
|
48 | min: 1 | |
49 | max: 6 |
|
49 | max: 6 | |
50 | } |
|
50 | } | |
@@ -52,7 +52,7 ChartView { | |||||
52 | LineSeries { |
|
52 | LineSeries { | |
53 | id: lineSeries |
|
53 | id: lineSeries | |
54 | name: "line series" |
|
54 | name: "line series" | |
55 |
axisX: value |
|
55 | axisX: valueAxis1 | |
56 | XYPoint { x: 0; y: 0 } |
|
56 | XYPoint { x: 0; y: 0 } | |
57 | XYPoint { x: 1.1; y: 2.1 } |
|
57 | XYPoint { x: 1.1; y: 2.1 } | |
58 | XYPoint { x: 1.9; y: 3.3 } |
|
58 | XYPoint { x: 1.9; y: 3.3 } |
@@ -66,7 +66,7 ChartView { | |||||
66 | legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color); |
|
66 | legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color); | |
67 |
|
67 | |||
68 |
|
68 | |||
69 |
Value |
|
69 | ValueAxis{ | |
70 | onColorChanged: console.log("axisX.onColorChanged: " + color); |
|
70 | onColorChanged: console.log("axisX.onColorChanged: " + color); | |
71 | onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible); |
|
71 | onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible); | |
72 | onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color); |
|
72 | onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color); | |
@@ -79,7 +79,7 ChartView { | |||||
79 | onMaxChanged: console.log("axisX.onMaxChanged: " + max); |
|
79 | onMaxChanged: console.log("axisX.onMaxChanged: " + max); | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 |
Value |
|
82 | ValueAxis{ | |
83 | onColorChanged: console.log("axisY.onColorChanged: " + color); |
|
83 | onColorChanged: console.log("axisY.onColorChanged: " + color); | |
84 | onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible); |
|
84 | onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible); | |
85 | onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color); |
|
85 | onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color); |
General Comments 0
You need to be logged in to leave comments.
Login now