##// END OF EJS Templates
QML sample improvement....
Mika Salmela -
r2532:0fd351ebdc9b
parent child
Show More
@@ -29,63 +29,50 ChartView {
29 theme: ChartView.ChartThemeBrownSand
29 theme: ChartView.ChartThemeBrownSand
30 legend.alignment: Qt.AlignBottom
30 legend.alignment: Qt.AlignBottom
31
31
32 //![1]
33 //![2]
34 BoxPlotSeries {
32 BoxPlotSeries {
35 id: plotSeries
33 id: plotSeries
36 name: "Income"
34 name: "Income"
37 //axisX: BarCategoryAxis { categories: ["Jan", "Feb", "Mar", "Apr", "May"] }
35 BoxSet { label: "Jan"; values: [3, 4, 4.4, 6, 7] }
38 BoxSet { values: [3, 4, 4.4, 6, 7] }
36 BoxSet { label: "Feb"; values: [5, 6, 7.5, 8, 12] }
39 BoxSet { label: "Tok"; values: [5, 6, 7.5, 8, 12] }
37 BoxSet { label: "Mar"; values: [2, 5, 5.7, 8, 9] }
40 BoxSet { label: "Kol"; values: [2, 5, 5.7, 8, 9] }
38 BoxSet { label: "Apr"; values: [5, 6, 6.8, 7, 8] }
41 BoxSet { id: nelBox
39 BoxSet { label: "May"; values: [4, 5, 5.2, 6, 7] }
42 label: "Nel"
43 values: [5, 6, 6.8, 7, 8];
44 onColorChanged: {
45 console.log("onColorChanged")
46 }
47 }
48 BoxSet { label: "Vii"; values: [4, 5, 5.2, 6, 7]; color: "#aa0000" }
49 //onClicked: console.log("series onClicked " + boxset.median)
50 //onHovered: console.log("series onHovered " + status + "median = " + boxset.median)
51 onCountChanged: console.log("onCountChanged")
52 }
40 }
53 //![2]
54
41
55 Rectangle {
42 // Rectangle {
56 id: moreButton
43 // id: moreButton
57 width: 50
44 // width: 50
58 height: 50
45 // height: 50
59 color: "gray"
46 // color: "gray"
60 MouseArea {
47 // MouseArea {
61 anchors.fill: parent
48 // anchors.fill: parent
62 onClicked: {
49 // onClicked: {
63 nelBox.color = "#0000aa"
50 // nelBox.color = "#0000aa"
64 var com = Qt.createComponent("box.qml")
51 // var com = Qt.createComponent("box.qml")
65 if (com.status == Component.Ready) {
52 // if (com.status == Component.Ready) {
66 var obj = com.createObject(moreButton)
53 // var obj = com.createObject(moreButton)
67 obj.lowerExtreme = 1.2
54 // obj.lowerExtreme = 1.2
68 console.log("lowerExtreme = " + obj.lowerExtreme)
55 // console.log("lowerExtreme = " + obj.lowerExtreme)
69 obj.lowerQuartile = 2.2
56 // obj.lowerQuartile = 2.2
70 console.log("lowerQuartile = " + obj.lowerQuartile)
57 // console.log("lowerQuartile = " + obj.lowerQuartile)
71 obj.median = 3.2
58 // obj.median = 3.2
72 console.log("median = " + obj.median)
59 // console.log("median = " + obj.median)
73 obj.upperQuartile = 4.2
60 // obj.upperQuartile = 4.2
74 console.log("upperQuartile = " + obj.upperQuartile)
61 // console.log("upperQuartile = " + obj.upperQuartile)
75 obj.upperExtreme = 5.2
62 // obj.upperExtreme = 5.2
76 console.log("upperExtreme = " + obj.upperExtreme)
63 // console.log("upperExtreme = " + obj.upperExtreme)
77 obj.label = "mik"
64 // obj.label = "mik"
78 console.log("label = " + obj.label)
65 // console.log("label = " + obj.label)
79 plotSeries.append(obj)
66 // plotSeries.append(obj)
80 obj.color = "#aa0000"
67 // obj.color = "#aa0000"
81 console.log("color = " + obj.color)
68 // console.log("color = " + obj.color)
82 obj.borderColor = "#00aa00"
69 // obj.borderColor = "#00aa00"
83 } else {
70 // } else {
84 console.log(com.errorString())
71 // console.log(com.errorString())
85 }
72 // }
86 }
73 // }
87 }
74 // }
88 }
75 // }
89
76
90 //![3]
77 //![3]
91 }
78 }
@@ -60,7 +60,29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
60 BoxPlotSeries then box-and-whiskers items with the same index are drawn to same slot.
60 BoxPlotSeries then box-and-whiskers items with the same index are drawn to same slot.
61
61
62 The following QML shows how to create a simple box-and-whiskers chart:
62 The following QML shows how to create a simple box-and-whiskers chart:
63 \snippet ../examples/qmlboxplot/qml/qmlboxplot/main.qml 1
63 \code
64 import QtQuick 1.0
65 import QtCommercial.Chart 1.1
66
67 ChartView {
68 title: "Box Plot series"
69 width: 400
70 height: 300
71 theme: ChartView.ChartThemeBrownSand
72 legend.alignment: Qt.AlignBottom
73
74 BoxPlotSeries {
75 id: plotSeries
76 name: "Income"
77 BoxSet { label: "Jan"; values: [3, 4, 4.4, 6, 7] }
78 BoxSet { label: "Feb"; values: [5, 6, 7.5, 8, 12] }
79 BoxSet { label: "Mar"; values: [2, 5, 5.7, 8, 9] }
80 BoxSet { label: "Apr"; values: [5, 6, 6.8, 7, 8] }
81 BoxSet { label: "May"; values: [4, 5, 5.2, 6, 7] }
82 }
83 }
84 \endcode
85
64 \beginfloatleft
86 \beginfloatleft
65 \image TODO_CREATE_IMAGE.png
87 \image TODO_CREATE_IMAGE.png
66 \endfloat
88 \endfloat
General Comments 0
You need to be logged in to leave comments. Login now