@@ -4,10 +4,6 import QtCommercial.Chart 1.0 | |||||
4 | Rectangle { |
|
4 | Rectangle { | |
5 | width: 360 |
|
5 | width: 360 | |
6 | height: 360 |
|
6 | height: 360 | |
7 | Text { |
|
|||
8 | text: qsTr("Hello World") |
|
|||
9 | anchors.centerIn: parent |
|
|||
10 | } |
|
|||
11 |
|
7 | |||
12 | // Another option for QML data api: |
|
8 | // Another option for QML data api: | |
13 | // ListModel { |
|
9 | // ListModel { | |
@@ -34,9 +30,15 Rectangle { | |||||
34 | // console.log("Component.onCompleted: " + chartModel.get(0).dataX); |
|
30 | // console.log("Component.onCompleted: " + chartModel.get(0).dataX); | |
35 | } |
|
31 | } | |
36 |
|
32 | |||
|
33 | // TODO: a bug: drawing order affects the drawing; if you draw chart1 first (by changing the | |||
|
34 | // z-order), then chart2 is not shown at all. By drawing chart2 first, both are visible. | |||
37 | Chart { |
|
35 | Chart { | |
38 | anchors.fill: parent |
|
36 | id: chart2 | |
39 | theme: Chart.ThemeIcy |
|
37 | anchors.top: chart1.bottom | |
|
38 | anchors.bottom: parent.bottom | |||
|
39 | anchors.left: parent.left | |||
|
40 | anchors.right: parent.right | |||
|
41 | theme: Chart.ThemeScientific | |||
40 |
|
42 | |||
41 | ScatterSeries { |
|
43 | ScatterSeries { | |
42 | id: scatterSeries |
|
44 | id: scatterSeries | |
@@ -44,32 +46,32 Rectangle { | |||||
44 | ScatterElement { x: 1.1; y: 2.1 }, |
|
46 | ScatterElement { x: 1.1; y: 2.1 }, | |
45 | ScatterElement { x: 1.2; y: 2.0 }, |
|
47 | ScatterElement { x: 1.2; y: 2.0 }, | |
46 | ScatterElement { x: 1.4; y: 2.3 }, |
|
48 | ScatterElement { x: 1.4; y: 2.3 }, | |
47 | ScatterElement { x: 1.9; y: 2.5 }, |
|
|||
48 | ScatterElement { x: 1.9; y: 3.4 }, |
|
|||
49 | ScatterElement { x: 2.9; y: 1.4 }, |
|
|||
50 | ScatterElement { x: 2.9; y: 2.4 }, |
|
|||
51 | ScatterElement { x: 3.1; y: 5.3 }, |
|
49 | ScatterElement { x: 3.1; y: 5.3 }, | |
52 | ScatterElement { x: 4.1; y: 3.7 } |
|
50 | ScatterElement { x: 4.1; y: 3.7 } | |
53 | ] |
|
51 | ] | |
54 | Component.onCompleted: { |
|
|||
55 | console.log("onCompleted " + data); |
|
|||
56 | // console.log("onCompleted " + data.get(0)); |
|
|||
57 | // console.log("onCompleted " + data.get(0).x); |
|
|||
58 | // var element = {"x": 9.9, "y": 8.5}; |
|
|||
59 | // data.append(element); |
|
|||
60 |
|
|
52 | } | |
61 |
|
|
53 | } | |
62 |
|
54 | |||
63 | // Series { |
|
55 | Chart { | |
64 | // seriesType: Series.SeriesTypePie |
|
56 | id: chart1 | |
65 | // } |
|
57 | anchors.top: parent.top | |
|
58 | anchors.left: parent.left | |||
|
59 | anchors.right: parent.right | |||
|
60 | height: parent.height / 2 | |||
|
61 | theme: Chart.ThemeIcy | |||
|
62 | opacity: 0.3 | |||
66 |
|
|
63 | ||
67 |
|
|
64 | Series { | |
68 |
|
|
65 | seriesType: Series.SeriesTypePie | |
69 |
|
|
66 | } | |
|
67 | ||||
|
68 | Series { | |||
|
69 | seriesType: Series.SeriesTypeLine | |||
|
70 | } | |||
70 |
|
|
71 | // TODO: | |
71 | // Series { |
|
72 | // Series { | |
72 | // seriesType: Series.SeriesTypeBar |
|
73 | // seriesType: Series.SeriesTypeBar | |
73 | // } |
|
74 | // } | |
74 | } |
|
75 | } | |
|
76 | ||||
75 | } |
|
77 | } |
General Comments 0
You need to be logged in to leave comments.
Login now