@@ -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 | } |
@@ -1,52 +1,51 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | import QtCommercial.Chart 1.0 |
|
23 | 23 | |
|
24 | 24 | Rectangle { |
|
25 | 25 | anchors.fill: parent |
|
26 |
property int |
|
|
27 | property variant otherSlice: 0 | |
|
26 | property variant othersSlice: 0 | |
|
28 | 27 | |
|
29 | 28 | //![1] |
|
30 | 29 | ChartView { |
|
31 | 30 | id: chart |
|
32 | 31 | title: "Top-5 car brand shares in Finland" |
|
33 | 32 | anchors.fill: parent |
|
34 | 33 | legend.alignment: Qt.AlignBottom |
|
35 | 34 | |
|
36 | 35 | PieSeries { |
|
37 | 36 | id: pieSeries |
|
38 | 37 | PieSlice { label: "Volkswagen"; value: 13.5 } |
|
39 | 38 | PieSlice { label: "Toyota"; value: 10.9 } |
|
40 | 39 | PieSlice { label: "Ford"; value: 8.6 } |
|
41 | 40 | PieSlice { label: "Skoda"; value: 8.2 } |
|
42 | 41 | PieSlice { label: "Volvo"; value: 6.8 } |
|
43 | 42 | } |
|
44 | 43 | } |
|
45 | 44 | |
|
46 | 45 | Component.onCompleted: { |
|
47 | 46 | // You can also manipulate slices dynamically |
|
48 | otherSlice = pieSeries.append("Others", 52.0); | |
|
47 | othersSlice = pieSeries.append("Others", 52.0); | |
|
49 | 48 | pieSeries.find("Volkswagen").exploded = true; |
|
50 | 49 | } |
|
51 | 50 | //![1] |
|
52 | 51 | } |
@@ -1,90 +1,90 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | import QtCommercial.Chart 1.0 |
|
23 | 23 | |
|
24 | 24 | Rectangle { |
|
25 | 25 | width: parent.width |
|
26 | 26 | height: parent.height |
|
27 | property int viewNumber: 1 | |
|
27 | property int viewNumber: 12 | |
|
28 | 28 | |
|
29 | 29 | Loader { |
|
30 | 30 | id: loader |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | source: "View" + viewNumber + ".qml"; |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | Rectangle { |
|
36 | 36 | id: infoText |
|
37 | 37 | anchors.centerIn: parent |
|
38 | 38 | width: parent.width |
|
39 | 39 | height: 40 |
|
40 | 40 | color: "black" |
|
41 | 41 | Text { |
|
42 | 42 | color: "white" |
|
43 | 43 | anchors.centerIn: parent |
|
44 | 44 | text: "Use left and right arrow keys to navigate between chart types" |
|
45 | 45 | } |
|
46 | 46 | |
|
47 | 47 | Behavior on opacity { |
|
48 | 48 | NumberAnimation { duration: 400 } |
|
49 | 49 | } |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | 52 | MouseArea { |
|
53 | 53 | focus: true |
|
54 | 54 | anchors.fill: parent |
|
55 | 55 | onClicked: { |
|
56 | 56 | if (infoText.opacity > 0) { |
|
57 | 57 | infoText.opacity = 0.0; |
|
58 | 58 | } else { |
|
59 | 59 | nextView(); |
|
60 | 60 | } |
|
61 | 61 | } |
|
62 | 62 | Keys.onPressed: { |
|
63 | 63 | if (infoText.opacity > 0) { |
|
64 | 64 | infoText.opacity = 0.0; |
|
65 | 65 | } else { |
|
66 | 66 | if (event.key == Qt.Key_Left) { |
|
67 | 67 | previousView(); |
|
68 | 68 | } else { |
|
69 | 69 | nextView(); |
|
70 | 70 | } |
|
71 | 71 | } |
|
72 | 72 | } |
|
73 | 73 | } |
|
74 | 74 | |
|
75 | 75 | function nextView() { |
|
76 | 76 | var i = viewNumber + 1; |
|
77 |
if (i > 1 |
|
|
77 | if (i > 12) | |
|
78 | 78 | viewNumber = 1; |
|
79 | 79 | else |
|
80 | 80 | viewNumber = i; |
|
81 | 81 | } |
|
82 | 82 | |
|
83 | 83 | function previousView() { |
|
84 | 84 | var i = viewNumber - 1; |
|
85 | 85 | if (i <= 0) |
|
86 |
viewNumber = 1 |
|
|
86 | viewNumber = 12; | |
|
87 | 87 | else |
|
88 | 88 | viewNumber = i; |
|
89 | 89 | } |
|
90 | 90 | } |
@@ -1,17 +1,18 | |||
|
1 | 1 | <RCC> |
|
2 | 2 | <qresource prefix="/"> |
|
3 | 3 | <file>qml/qmlchart/loader.qml</file> |
|
4 | 4 | <file>qml/qmlchart/main.qml</file> |
|
5 | 5 | <file>qml/qmlchart/View1.qml</file> |
|
6 | 6 | <file>qml/qmlchart/View2.qml</file> |
|
7 | 7 | <file>qml/qmlchart/View3.qml</file> |
|
8 | 8 | <file>qml/qmlchart/View4.qml</file> |
|
9 | 9 | <file>qml/qmlchart/View5.qml</file> |
|
10 | 10 | <file>qml/qmlchart/View6.qml</file> |
|
11 | 11 | <file>qml/qmlchart/View7.qml</file> |
|
12 | 12 | <file>qml/qmlchart/View8.qml</file> |
|
13 | 13 | <file>qml/qmlchart/View9.qml</file> |
|
14 | 14 | <file>qml/qmlchart/View10.qml</file> |
|
15 | 15 | <file>qml/qmlchart/View11.qml</file> |
|
16 | <file>qml/qmlchart/View12.qml</file> | |
|
16 | 17 | </qresource> |
|
17 | 18 | </RCC> |
General Comments 0
You need to be logged in to leave comments.
Login now