##// END OF EJS Templates
Work-around for QML drawing issue
Tero Ahola -
r199:12a66e29cabc
parent child
Show More
@@ -1,75 +1,77
1 1 import QtQuick 1.0
2 2 import QtCommercial.Chart 1.0
3 3
4 4 Rectangle {
5 5 width: 360
6 6 height: 360
7 Text {
8 text: qsTr("Hello World")
9 anchors.centerIn: parent
10 }
11 7
12 8 // Another option for QML data api:
13 9 // ListModel {
14 10 // id: listModelForPie
15 11 // // PieDataElement
16 12 // ListElement {
17 13 // label: "Apple"
18 14 // value: 4.3
19 15 // }
20 16 // ListElement {
21 17 // label: "Blackberry"
22 18 // value: 15.1
23 19 // }
24 20 // }
25 21
26 22 Component.onCompleted: {
27 23 // console.log("Component.onCompleted: " + scatterElement.x);
28 24 // console.log("Component.onCompleted: " + scatterElement.y);
29 25 // console.log("Component.onCompleted: " + scatterElement.dataX);
30 26 // console.log("Component.onCompleted: " + scatterElement.dataY);
31 27 //console.log("Component.onCompleted: " + chartModel.get(0).x);
32 28 //console.log("Component.onCompleted: " + chartModel.scatterElements);
33 29 // console.log("Component.onCompleted: " + elementt.dataX);
34 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 35 Chart {
38 anchors.fill: parent
39 theme: Chart.ThemeIcy
36 id: chart2
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 43 ScatterSeries {
42 44 id: scatterSeries
43 45 data: [
44 46 ScatterElement { x: 1.1; y: 2.1 },
45 47 ScatterElement { x: 1.2; y: 2.0 },
46 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 49 ScatterElement { x: 3.1; y: 5.3 },
52 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 }
61 52 }
53 }
62 54
63 // Series {
64 // seriesType: Series.SeriesTypePie
65 // }
55 Chart {
56 id: chart1
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 // Series {
68 // seriesType: Series.SeriesTypeLine
69 // }
64 Series {
65 seriesType: Series.SeriesTypePie
66 }
67
68 Series {
69 seriesType: Series.SeriesTypeLine
70 }
70 71 // TODO:
71 72 // Series {
72 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