##// END OF EJS Templates
Added donut to QML chart demo app
Tero Ahola -
r1832:a53d18bba921
parent child
Show More
@@ -0,0 +1,74
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
23
24 Rectangle {
25 anchors.fill: parent
26
27 //![1]
28 ChartView {
29 id: chart
30 title: "Production costs"
31 anchors.fill: parent
32 legend.visible: false
33
34 PieSeries {
35 id: pieOuter
36 size: 0.96
37 PieSlice { id: slice; label: "Alpha"; value: 19511; color: "#2D6960"; borderColor: "#163430" }
38 PieSlice { label: "Epsilon"; value: 11105; color: "#EFE672"; borderColor: "#3B391C" }
39 PieSlice { label: "Psi"; value: 9352; color: "#4C1B33"; borderColor: "#13060C" }
40 }
41
42 PieSeries {
43 size: 0.7
44 id: pieInner
45
46 PieSlice { label: "Materials"; value: 10334; color: "#618E87"; borderColor: "#163430" }
47 PieSlice { label: "Employee"; value: 3066; color: "#2D6960"; borderColor: "#163430"; borderWidth: 2 }
48 PieSlice { label: "Logistics"; value: 6111; color: "#214E48"; borderColor: "#163430"; borderWidth: 2 }
49
50 PieSlice { label: "Materials"; value: 7371; color: "#F7F28B"; borderColor: "#3B391C"; borderWidth: 2 }
51 PieSlice { label: "Employee"; value: 2443; color: "#EFE672"; borderColor: "#3B391C"; borderWidth: 2 }
52 PieSlice { label: "Logistics"; value: 1291; color: "#777339"; borderColor: "#3B391C"; borderWidth: 2 }
53
54 PieSlice { label: "Materials"; value: 4022; color: "#785466"; borderColor: "#13060C"; borderWidth: 2 }
55 PieSlice { label: "Employee"; value: 3998; color: "#4C1B33"; borderColor: "#13060C"; borderWidth: 2 }
56 PieSlice { label: "Logistics"; value: 1332; color: "#260D19"; borderColor: "#13060C"; borderWidth: 2 }
57 }
58 }
59 //![1]
60
61 Component.onCompleted: {
62 // Set the common slice properties dynamically for convenience
63 for (var i = 0; i < pieOuter.count; i++) {
64 pieOuter.at(i).labelPosition = PieSlice.LabelOutside;
65 pieOuter.at(i).labelVisible = true;
66 pieOuter.at(i).borderWidth = 2;
67 }
68 for (var i = 0; i < pieInner.count; i++) {
69 pieInner.at(i).labelPosition = PieSlice.LabelInsideNormal;
70 pieInner.at(i).labelVisible = true;
71 pieInner.at(i).borderWidth = 2;
72 }
73 }
74 }
@@ -23,8 +23,7 import QtCommercial.Chart 1.0
23
23
24 Rectangle {
24 Rectangle {
25 anchors.fill: parent
25 anchors.fill: parent
26 property int __explodedIndex: -1
26 property variant othersSlice: 0
27 property variant otherSlice: 0
28
27
29 //![1]
28 //![1]
30 ChartView {
29 ChartView {
@@ -45,7 +44,7 Rectangle {
45
44
46 Component.onCompleted: {
45 Component.onCompleted: {
47 // You can also manipulate slices dynamically
46 // You can also manipulate slices dynamically
48 otherSlice = pieSeries.append("Others", 52.0);
47 othersSlice = pieSeries.append("Others", 52.0);
49 pieSeries.find("Volkswagen").exploded = true;
48 pieSeries.find("Volkswagen").exploded = true;
50 }
49 }
51 //![1]
50 //![1]
@@ -24,7 +24,7 import QtCommercial.Chart 1.0
24 Rectangle {
24 Rectangle {
25 width: parent.width
25 width: parent.width
26 height: parent.height
26 height: parent.height
27 property int viewNumber: 1
27 property int viewNumber: 12
28
28
29 Loader {
29 Loader {
30 id: loader
30 id: loader
@@ -74,7 +74,7 Rectangle {
74
74
75 function nextView() {
75 function nextView() {
76 var i = viewNumber + 1;
76 var i = viewNumber + 1;
77 if (i > 11)
77 if (i > 12)
78 viewNumber = 1;
78 viewNumber = 1;
79 else
79 else
80 viewNumber = i;
80 viewNumber = i;
@@ -83,7 +83,7 Rectangle {
83 function previousView() {
83 function previousView() {
84 var i = viewNumber - 1;
84 var i = viewNumber - 1;
85 if (i <= 0)
85 if (i <= 0)
86 viewNumber = 11;
86 viewNumber = 12;
87 else
87 else
88 viewNumber = i;
88 viewNumber = i;
89 }
89 }
@@ -13,5 +13,6
13 <file>qml/qmlchart/View9.qml</file>
13 <file>qml/qmlchart/View9.qml</file>
14 <file>qml/qmlchart/View10.qml</file>
14 <file>qml/qmlchart/View10.qml</file>
15 <file>qml/qmlchart/View11.qml</file>
15 <file>qml/qmlchart/View11.qml</file>
16 <file>qml/qmlchart/View12.qml</file>
16 </qresource>
17 </qresource>
17 </RCC>
18 </RCC>
General Comments 0
You need to be logged in to leave comments. Login now