@@ -1,69 +1,69 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Two Series, Common Axes" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.visible: false |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | ValueAxis { |
|
36 | 36 | id: axisX |
|
37 | 37 | min: 0 |
|
38 | 38 | max: 10 |
|
39 | 39 | tickCount: 5 |
|
40 | 40 | } |
|
41 | 41 | |
|
42 | 42 | ValueAxis { |
|
43 | 43 | id: axisY |
|
44 | 44 | min: -0.5 |
|
45 | 45 | max: 1.5 |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | LineSeries { |
|
49 | 49 | id: series1 |
|
50 | 50 | axisX: axisX |
|
51 | 51 | axisY: axisY |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | ScatterSeries { |
|
55 | 55 | id: series2 |
|
56 | 56 | axisX: axisX |
|
57 | 57 | axisY: axisY |
|
58 | 58 | } |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | // Add data dynamically to the series |
|
62 | 62 | Component.onCompleted: { |
|
63 | 63 | for (var i = 0; i <= 10; i++) { |
|
64 | 64 | series1.append(i, Math.random()); |
|
65 | 65 | series2.append(i, Math.random()); |
|
66 | 66 | } |
|
67 | 67 | } |
|
68 | 68 | //![1] |
|
69 | 69 | } |
@@ -1,61 +1,61 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Accurate Historical Data" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.visible: false |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | LineSeries { |
|
36 | 36 | axisX: DateTimeAxis { |
|
37 | 37 | format: "yyyy MMM" |
|
38 | 38 | tickCount: 5 |
|
39 | 39 | } |
|
40 | 40 | axisY: ValueAxis { |
|
41 | 41 | min: 0 |
|
42 | 42 | max: 150 |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | // Please note that month in JavaScript months are zero based, so 2 means March |
|
46 | 46 | XYPoint { x: toMsecsSinceEpoch(new Date(1950, 2, 15)); y: 5 } |
|
47 | 47 | XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 } |
|
48 | 48 | XYPoint { x: toMsecsSinceEpoch(new Date(1987, 12, 31)); y: 102 } |
|
49 | 49 | XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 } |
|
50 | 50 | XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 2)); y: 110 } |
|
51 | 51 | } |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | // DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to |
|
55 | 55 | // milliseconds since epoch to make them match the DateTimeAxis values |
|
56 | 56 | function toMsecsSinceEpoch(date) { |
|
57 | 57 | var msecs = date.getTime(); |
|
58 | 58 | return msecs; |
|
59 | 59 | } |
|
60 | 60 | //![1] |
|
61 | 61 | } |
@@ -1,69 +1,69 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Numerical Data for Dummies" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.visible: false |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | LineSeries { |
|
36 | 36 | axisY: CategoryAxis { |
|
37 | 37 | min: 0 |
|
38 | 38 | max: 30 |
|
39 | 39 | CategoryRange { |
|
40 | 40 | label: "critical" |
|
41 | 41 | endValue: 2 |
|
42 | 42 | } |
|
43 | 43 | CategoryRange { |
|
44 | 44 | label: "low" |
|
45 | 45 | endValue: 4 |
|
46 | 46 | } |
|
47 | 47 | CategoryRange { |
|
48 | 48 | label: "normal" |
|
49 | 49 | endValue: 7 |
|
50 | 50 | } |
|
51 | 51 | CategoryRange { |
|
52 | 52 | label: "high" |
|
53 | 53 | endValue: 15 |
|
54 | 54 | } |
|
55 | 55 | CategoryRange { |
|
56 | 56 | label: "extremely high" |
|
57 | 57 | endValue: 30 |
|
58 | 58 | } |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | XYPoint { x: 0; y: 4.3 } |
|
62 | 62 | XYPoint { x: 1; y: 4.1 } |
|
63 | 63 | XYPoint { x: 2; y: 4.7 } |
|
64 | 64 | XYPoint { x: 3; y: 3.9 } |
|
65 | 65 | XYPoint { x: 4; y: 5.2 } |
|
66 | 66 | } |
|
67 | 67 | } |
|
68 | 68 | //![1] |
|
69 | 69 | } |
@@ -1,81 +1,81 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | |
|
24 | Rectangle { | |
|
24 | Item { | |
|
25 | 25 | width: 440 |
|
26 | 26 | height: 330 |
|
27 | 27 | property bool sourceLoaded: false |
|
28 | 28 | |
|
29 | 29 | ListView { |
|
30 | 30 | id: root |
|
31 | 31 | focus: true |
|
32 | 32 | anchors.fill: parent |
|
33 | 33 | snapMode: ListView.SnapOneItem |
|
34 | 34 | highlightRangeMode: ListView.StrictlyEnforceRange |
|
35 | 35 | highlightMoveDuration: 250 |
|
36 | 36 | orientation: ListView.Horizontal |
|
37 | 37 | boundsBehavior: Flickable.StopAtBounds |
|
38 | 38 | |
|
39 | 39 | onCurrentIndexChanged: { |
|
40 | 40 | if (infoText.opacity > 0.0) { |
|
41 | 41 | if (sourceLoaded) |
|
42 | 42 | infoText.opacity = 0.0; |
|
43 | 43 | else if (currentIndex != 0) |
|
44 | 44 | currentIndex = 0; |
|
45 | 45 | } |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | model: ListModel { |
|
49 | 49 | ListElement {component: "View1.qml"} |
|
50 | 50 | ListElement {component: "View2.qml"} |
|
51 | 51 | ListElement {component: "View3.qml"} |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | delegate: Loader { |
|
55 | 55 | width: root.width |
|
56 | 56 | height: root.height |
|
57 | 57 | |
|
58 | 58 | source: component |
|
59 | 59 | asynchronous: true |
|
60 | 60 | |
|
61 | 61 | onLoaded: sourceLoaded = true |
|
62 | 62 | } |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | Rectangle { |
|
66 | 66 | id: infoText |
|
67 | 67 | anchors.centerIn: parent |
|
68 | 68 | width: parent.width |
|
69 | 69 | height: 40 |
|
70 | 70 | color: "black" |
|
71 | 71 | Text { |
|
72 | 72 | color: "white" |
|
73 | 73 | anchors.centerIn: parent |
|
74 | 74 | text: "You can navigate between views using swipe or arrow keys" |
|
75 | 75 | } |
|
76 | 76 | |
|
77 | 77 | Behavior on opacity { |
|
78 | 78 | NumberAnimation { duration: 400 } |
|
79 | 79 | } |
|
80 | 80 | } |
|
81 | 81 | } |
@@ -1,55 +1,55 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | //![2] |
|
23 | 23 | import QtQuick 2.0 |
|
24 | 24 | //![2] |
|
25 | 25 | import QtCharts 2.0 |
|
26 | 26 | |
|
27 | Rectangle { | |
|
27 | Item { | |
|
28 | 28 | anchors.fill: parent |
|
29 | 29 | property variant othersSlice: 0 |
|
30 | 30 | |
|
31 | 31 | //![1] |
|
32 | 32 | ChartView { |
|
33 | 33 | id: chart |
|
34 | 34 | title: "Top-5 car brand shares in Finland" |
|
35 | 35 | anchors.fill: parent |
|
36 | 36 | legend.alignment: Qt.AlignBottom |
|
37 | 37 | antialiasing: true |
|
38 | 38 | |
|
39 | 39 | PieSeries { |
|
40 | 40 | id: pieSeries |
|
41 | 41 | PieSlice { label: "Volkswagen"; value: 13.5 } |
|
42 | 42 | PieSlice { label: "Toyota"; value: 10.9 } |
|
43 | 43 | PieSlice { label: "Ford"; value: 8.6 } |
|
44 | 44 | PieSlice { label: "Skoda"; value: 8.2 } |
|
45 | 45 | PieSlice { label: "Volvo"; value: 6.8 } |
|
46 | 46 | } |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | Component.onCompleted: { |
|
50 | 50 | // You can also manipulate slices dynamically |
|
51 | 51 | othersSlice = pieSeries.append("Others", 52.0); |
|
52 | 52 | pieSeries.find("Volkswagen").exploded = true; |
|
53 | 53 | } |
|
54 | 54 | //![1] |
|
55 | 55 | } |
@@ -1,43 +1,43 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Horizontal Stacked Bar series" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.alignment: Qt.AlignBottom |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | HorizontalStackedBarSeries { |
|
36 | 36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
37 | 37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } |
|
38 | 38 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
39 | 39 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
|
40 | 40 | } |
|
41 | 41 | } |
|
42 | 42 | //![1] |
|
43 | 43 | } |
@@ -1,44 +1,44 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Horizontal Percent Bar series" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.alignment: Qt.AlignBottom |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | HorizontalPercentBarSeries { |
|
36 | 36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
37 | 37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } |
|
38 | 38 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
39 | 39 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
|
40 | 40 | } |
|
41 | 41 | } |
|
42 | 42 | //![1] |
|
43 | 43 | } |
|
44 | 44 |
@@ -1,78 +1,78 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | id: chart |
|
31 | 31 | title: "Production costs" |
|
32 | 32 | anchors.fill: parent |
|
33 | 33 | legend.visible: false |
|
34 | 34 | antialiasing: true |
|
35 | 35 | |
|
36 | 36 | PieSeries { |
|
37 | 37 | id: pieOuter |
|
38 | 38 | size: 0.96 |
|
39 | 39 | holeSize: 0.7 |
|
40 | 40 | PieSlice { id: slice; label: "Alpha"; value: 19511; color: "#8AB846"; borderColor: "#163430" } |
|
41 | 41 | PieSlice { label: "Epsilon"; value: 11105; color: "#C0EEFF"; borderColor: "#3B391C" } |
|
42 | 42 | PieSlice { label: "Psi"; value: 9352; color: "#DF8939"; borderColor: "#13060C" } |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | PieSeries { |
|
46 | 46 | size: 0.7 |
|
47 | 47 | id: pieInner |
|
48 | 48 | holeSize: 0.25 |
|
49 | 49 | |
|
50 | 50 | PieSlice { label: "Materials"; value: 10334; color: "#8AB846"; borderColor: "#163430" } |
|
51 | 51 | PieSlice { label: "Employee"; value: 3066; color: "#AAE356"; borderColor: "#163430" } |
|
52 | 52 | PieSlice { label: "Logistics"; value: 6111; color: "#99CC4E"; borderColor: "#163430" } |
|
53 | 53 | |
|
54 | 54 | PieSlice { label: "Materials"; value: 7371; color: "#C0EEFF"; borderColor: "#3B391C" } |
|
55 | 55 | PieSlice { label: "Employee"; value: 2443; color: "#C9FAFF"; borderColor: "#3B391C" } |
|
56 | 56 | PieSlice { label: "Logistics"; value: 1291; color: "#B0FAFF"; borderColor: "#3B391C" } |
|
57 | 57 | |
|
58 | 58 | PieSlice { label: "Materials"; value: 4022; color: "#DF8939"; borderColor: "#13060C" } |
|
59 | 59 | PieSlice { label: "Employee"; value: 3998; color: "#FC9D42"; borderColor: "#13060C" } |
|
60 | 60 | PieSlice { label: "Logistics"; value: 1332; color: "#F2963F"; borderColor: "#13060C" } |
|
61 | 61 | } |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | Component.onCompleted: { |
|
65 | 65 | // Set the common slice properties dynamically for convenience |
|
66 | 66 | for (var i = 0; i < pieOuter.count; i++) { |
|
67 | 67 | pieOuter.at(i).labelPosition = PieSlice.LabelOutside; |
|
68 | 68 | pieOuter.at(i).labelVisible = true; |
|
69 | 69 | pieOuter.at(i).borderWidth = 3; |
|
70 | 70 | } |
|
71 | 71 | for (var i = 0; i < pieInner.count; i++) { |
|
72 | 72 | pieInner.at(i).labelPosition = PieSlice.LabelInsideNormal; |
|
73 | 73 | pieInner.at(i).labelVisible = true; |
|
74 | 74 | pieInner.at(i).borderWidth = 2; |
|
75 | 75 | } |
|
76 | 76 | } |
|
77 | 77 | //![1] |
|
78 | 78 | } |
@@ -1,46 +1,46 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Line" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | antialiasing: true |
|
33 | 33 | |
|
34 | 34 | LineSeries { |
|
35 | 35 | name: "LineSeries" |
|
36 | 36 | XYPoint { x: 0; y: 0 } |
|
37 | 37 | XYPoint { x: 1.1; y: 2.1 } |
|
38 | 38 | XYPoint { x: 1.9; y: 3.3 } |
|
39 | 39 | XYPoint { x: 2.1; y: 2.1 } |
|
40 | 40 | XYPoint { x: 2.9; y: 4.9 } |
|
41 | 41 | XYPoint { x: 3.4; y: 3.0 } |
|
42 | 42 | XYPoint { x: 4.1; y: 3.3 } |
|
43 | 43 | } |
|
44 | 44 | } |
|
45 | 45 | //![1] |
|
46 | 46 | } |
@@ -1,46 +1,46 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Spline" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | antialiasing: true |
|
33 | 33 | |
|
34 | 34 | SplineSeries { |
|
35 | 35 | name: "SplineSeries" |
|
36 | 36 | XYPoint { x: 0; y: 0.0 } |
|
37 | 37 | XYPoint { x: 1.1; y: 3.2 } |
|
38 | 38 | XYPoint { x: 1.9; y: 2.4 } |
|
39 | 39 | XYPoint { x: 2.1; y: 2.1 } |
|
40 | 40 | XYPoint { x: 2.9; y: 2.6 } |
|
41 | 41 | XYPoint { x: 3.4; y: 2.3 } |
|
42 | 42 | XYPoint { x: 4.1; y: 3.1 } |
|
43 | 43 | } |
|
44 | 44 | } |
|
45 | 45 | //![1] |
|
46 | 46 | } |
@@ -1,109 +1,109 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "NHL All-Star Team Players" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | antialiasing: true |
|
33 | 33 | |
|
34 | 34 | ValueAxis { |
|
35 | 35 | id: valueAxis |
|
36 | 36 | min: 2000 |
|
37 | 37 | max: 2011 |
|
38 | 38 | tickCount: 12 |
|
39 | 39 | labelFormat: "%.0f" |
|
40 | 40 | } |
|
41 | 41 | |
|
42 | 42 | AreaSeries { |
|
43 | 43 | name: "Russian" |
|
44 | 44 | color: "#FFD52B1E" |
|
45 | 45 | borderColor: "#FF0039A5" |
|
46 | 46 | borderWidth: 3 |
|
47 | 47 | axisX: valueAxis |
|
48 | 48 | upperSeries: LineSeries { |
|
49 | 49 | XYPoint { x: 2000; y: 1 } |
|
50 | 50 | XYPoint { x: 2001; y: 1 } |
|
51 | 51 | XYPoint { x: 2002; y: 1 } |
|
52 | 52 | XYPoint { x: 2003; y: 1 } |
|
53 | 53 | XYPoint { x: 2004; y: 1 } |
|
54 | 54 | XYPoint { x: 2005; y: 0 } |
|
55 | 55 | XYPoint { x: 2006; y: 1 } |
|
56 | 56 | XYPoint { x: 2007; y: 1 } |
|
57 | 57 | XYPoint { x: 2008; y: 4 } |
|
58 | 58 | XYPoint { x: 2009; y: 3 } |
|
59 | 59 | XYPoint { x: 2010; y: 2 } |
|
60 | 60 | XYPoint { x: 2011; y: 1 } |
|
61 | 61 | } |
|
62 | 62 | } |
|
63 | 63 | //![1] |
|
64 | 64 | |
|
65 | 65 | AreaSeries { |
|
66 | 66 | name: "Swedish" |
|
67 | 67 | color: "#AF005292" |
|
68 | 68 | borderColor: "#AFFDCA00" |
|
69 | 69 | borderWidth: 3 |
|
70 | 70 | axisX: valueAxis |
|
71 | 71 | upperSeries: LineSeries { |
|
72 | 72 | XYPoint { x: 2000; y: 1 } |
|
73 | 73 | XYPoint { x: 2001; y: 1 } |
|
74 | 74 | XYPoint { x: 2002; y: 3 } |
|
75 | 75 | XYPoint { x: 2003; y: 3 } |
|
76 | 76 | XYPoint { x: 2004; y: 2 } |
|
77 | 77 | XYPoint { x: 2005; y: 0 } |
|
78 | 78 | XYPoint { x: 2006; y: 2 } |
|
79 | 79 | XYPoint { x: 2007; y: 1 } |
|
80 | 80 | XYPoint { x: 2008; y: 2 } |
|
81 | 81 | XYPoint { x: 2009; y: 1 } |
|
82 | 82 | XYPoint { x: 2010; y: 3 } |
|
83 | 83 | XYPoint { x: 2011; y: 3 } |
|
84 | 84 | } |
|
85 | 85 | } |
|
86 | 86 | |
|
87 | 87 | AreaSeries { |
|
88 | 88 | name: "Finnish" |
|
89 | 89 | color: "#00357F" |
|
90 | 90 | borderColor: "#FEFEFE" |
|
91 | 91 | borderWidth: 3 |
|
92 | 92 | axisX: valueAxis |
|
93 | 93 | upperSeries: LineSeries { |
|
94 | 94 | XYPoint { x: 2000; y: 0 } |
|
95 | 95 | XYPoint { x: 2001; y: 0 } |
|
96 | 96 | XYPoint { x: 2002; y: 0 } |
|
97 | 97 | XYPoint { x: 2003; y: 0 } |
|
98 | 98 | XYPoint { x: 2004; y: 0 } |
|
99 | 99 | XYPoint { x: 2005; y: 0 } |
|
100 | 100 | XYPoint { x: 2006; y: 1 } |
|
101 | 101 | XYPoint { x: 2007; y: 0 } |
|
102 | 102 | XYPoint { x: 2008; y: 0 } |
|
103 | 103 | XYPoint { x: 2009; y: 0 } |
|
104 | 104 | XYPoint { x: 2010; y: 0 } |
|
105 | 105 | XYPoint { x: 2011; y: 1 } |
|
106 | 106 | } |
|
107 | 107 | } |
|
108 | 108 | } |
|
109 | 109 | } |
@@ -1,57 +1,57 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Scatters" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | antialiasing: true |
|
33 | 33 | |
|
34 | 34 | ScatterSeries { |
|
35 | 35 | id: scatter1 |
|
36 | 36 | name: "Scatter1" |
|
37 | 37 | XYPoint { x: 1.5; y: 1.5 } |
|
38 | 38 | XYPoint { x: 1.5; y: 1.6 } |
|
39 | 39 | XYPoint { x: 1.57; y: 1.55 } |
|
40 | 40 | XYPoint { x: 1.8; y: 1.8 } |
|
41 | 41 | XYPoint { x: 1.9; y: 1.6 } |
|
42 | 42 | XYPoint { x: 2.1; y: 1.3 } |
|
43 | 43 | XYPoint { x: 2.5; y: 2.1 } |
|
44 | 44 | } |
|
45 | 45 | |
|
46 | 46 | ScatterSeries { |
|
47 | 47 | name: "Scatter2" |
|
48 | 48 | //![1] |
|
49 | 49 | XYPoint { x: 2.0; y: 2.0 } |
|
50 | 50 | XYPoint { x: 2.0; y: 2.1 } |
|
51 | 51 | XYPoint { x: 2.07; y: 2.05 } |
|
52 | 52 | XYPoint { x: 2.2; y: 2.9 } |
|
53 | 53 | XYPoint { x: 2.4; y: 2.7 } |
|
54 | 54 | XYPoint { x: 2.67; y: 2.65 } |
|
55 | 55 | } |
|
56 | 56 | } |
|
57 | 57 | } |
@@ -1,44 +1,44 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Bar series" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.alignment: Qt.AlignBottom |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | BarSeries { |
|
36 | 36 | id: mySeries |
|
37 | 37 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
38 | 38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } |
|
39 | 39 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
40 | 40 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
|
41 | 41 | } |
|
42 | 42 | } |
|
43 | 43 | //![1] |
|
44 | 44 | } |
@@ -1,44 +1,44 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Stacked Bar series" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.alignment: Qt.AlignBottom |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | StackedBarSeries { |
|
36 | 36 | id: mySeries |
|
37 | 37 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
38 | 38 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } |
|
39 | 39 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
40 | 40 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
|
41 | 41 | } |
|
42 | 42 | } |
|
43 | 43 | //![1] |
|
44 | 44 | } |
@@ -1,43 +1,43 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Percent Bar series" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.alignment: Qt.AlignBottom |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | PercentBarSeries { |
|
36 | 36 | axisX: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
37 | 37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } |
|
38 | 38 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
39 | 39 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
|
40 | 40 | } |
|
41 | 41 | } |
|
42 | 42 | //![1] |
|
43 | 43 | } |
@@ -1,44 +1,44 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | ChartView { |
|
30 | 30 | title: "Horizontal Bar series" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.alignment: Qt.AlignBottom |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | HorizontalBarSeries { |
|
36 | 36 | axisY: BarCategoryAxis { categories: ["2007", "2008", "2009", "2010", "2011", "2012" ] } |
|
37 | 37 | BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] } |
|
38 | 38 | BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] } |
|
39 | 39 | BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] } |
|
40 | 40 | } |
|
41 | 41 | } |
|
42 | 42 | //![1] |
|
43 | 43 | } |
|
44 | 44 |
@@ -1,92 +1,92 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | //![1] |
|
23 | 23 | import QtQuick 2.0 |
|
24 | 24 | //![1] |
|
25 | 25 | |
|
26 | Rectangle { | |
|
26 | Item { | |
|
27 | 27 | width: 600 |
|
28 | 28 | height: 400 |
|
29 | 29 | property bool sourceLoaded: false |
|
30 | 30 | |
|
31 | 31 | ListView { |
|
32 | 32 | id: root |
|
33 | 33 | focus: true |
|
34 | 34 | anchors.fill: parent |
|
35 | 35 | snapMode: ListView.SnapOneItem |
|
36 | 36 | highlightRangeMode: ListView.StrictlyEnforceRange |
|
37 | 37 | highlightMoveDuration: 250 |
|
38 | 38 | orientation: ListView.Horizontal |
|
39 | 39 | boundsBehavior: Flickable.StopAtBounds |
|
40 | 40 | |
|
41 | 41 | onCurrentIndexChanged: { |
|
42 | 42 | if (infoText.opacity > 0.0) { |
|
43 | 43 | if (sourceLoaded) |
|
44 | 44 | infoText.opacity = 0.0; |
|
45 | 45 | else if (currentIndex != 0) |
|
46 | 46 | currentIndex = 0; |
|
47 | 47 | } |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | model: ListModel { |
|
51 | 51 | ListElement {component: "View1.qml"} |
|
52 | 52 | ListElement {component: "View2.qml"} |
|
53 | 53 | ListElement {component: "View3.qml"} |
|
54 | 54 | ListElement {component: "View4.qml"} |
|
55 | 55 | ListElement {component: "View5.qml"} |
|
56 | 56 | ListElement {component: "View6.qml"} |
|
57 | 57 | ListElement {component: "View7.qml"} |
|
58 | 58 | ListElement {component: "View8.qml"} |
|
59 | 59 | ListElement {component: "View9.qml"} |
|
60 | 60 | ListElement {component: "View10.qml"} |
|
61 | 61 | ListElement {component: "View11.qml"} |
|
62 | 62 | ListElement {component: "View12.qml"} |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | delegate: Loader { |
|
66 | 66 | width: root.width |
|
67 | 67 | height: root.height |
|
68 | 68 | |
|
69 | 69 | source: component |
|
70 | 70 | asynchronous: true |
|
71 | 71 | |
|
72 | 72 | onLoaded: sourceLoaded = true |
|
73 | 73 | } |
|
74 | 74 | } |
|
75 | 75 | |
|
76 | 76 | Rectangle { |
|
77 | 77 | id: infoText |
|
78 | 78 | anchors.centerIn: parent |
|
79 | 79 | width: parent.width |
|
80 | 80 | height: 40 |
|
81 | 81 | color: "black" |
|
82 | 82 | Text { |
|
83 | 83 | color: "white" |
|
84 | 84 | anchors.centerIn: parent |
|
85 | 85 | text: "You can navigate between views using swipe or arrow keys" |
|
86 | 86 | } |
|
87 | 87 | |
|
88 | 88 | Behavior on opacity { |
|
89 | 89 | NumberAnimation { duration: 400 } |
|
90 | 90 | } |
|
91 | 91 | } |
|
92 | 92 | } |
@@ -1,103 +1,103 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | width: 400 |
|
27 | 27 | height: 300 |
|
28 | 28 | property int __activeIndex: 1 |
|
29 | 29 | property real __intervalCoefficient: 0 |
|
30 | 30 | |
|
31 | 31 | //![1] |
|
32 | 32 | ChartView { |
|
33 | 33 | id: chartView |
|
34 | 34 | anchors.fill: parent |
|
35 | 35 | title: "Wheel of fortune" |
|
36 | 36 | legend.visible: false |
|
37 | 37 | antialiasing: true |
|
38 | 38 | |
|
39 | 39 | PieSeries { |
|
40 | 40 | id: wheelOfFortune |
|
41 | 41 | horizontalPosition: 0.3 |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | SplineSeries { |
|
45 | 45 | id: splineSeries |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | ScatterSeries { |
|
49 | 49 | id: scatterSeries |
|
50 | 50 | } |
|
51 | 51 | } |
|
52 | 52 | //![1] |
|
53 | 53 | |
|
54 | 54 | //![2] |
|
55 | 55 | Component.onCompleted: { |
|
56 | 56 | __intervalCoefficient = Math.random() + 0.1; |
|
57 | 57 | |
|
58 | 58 | for (var i = 0; i < 20; i++) |
|
59 | 59 | wheelOfFortune.append("", 1); |
|
60 | 60 | |
|
61 | 61 | var interval = 1; |
|
62 | 62 | for (var j = 0; interval < 800; j++) { |
|
63 | 63 | interval = __intervalCoefficient * j * j; |
|
64 | 64 | splineSeries.append(j, interval); |
|
65 | 65 | } |
|
66 | 66 | chartView.axisX(scatterSeries).max = j; |
|
67 | 67 | chartView.axisY(scatterSeries).max = 1000; |
|
68 | 68 | } |
|
69 | 69 | //![2] |
|
70 | 70 | |
|
71 | 71 | Timer { |
|
72 | 72 | triggeredOnStart: true |
|
73 | 73 | running: true |
|
74 | 74 | repeat: true |
|
75 | 75 | interval: 100 |
|
76 | 76 | onTriggered: { |
|
77 | 77 | var index = __activeIndex % wheelOfFortune.count; |
|
78 | 78 | if (interval < 700) { |
|
79 | 79 | //![3] |
|
80 | 80 | wheelOfFortune.at(index).exploded = false; |
|
81 | 81 | __activeIndex++; |
|
82 | 82 | index = __activeIndex % wheelOfFortune.count; |
|
83 | 83 | wheelOfFortune.at(index).exploded = true; |
|
84 | 84 | //![3] |
|
85 | 85 | interval = splineSeries.at(__activeIndex).y; |
|
86 | 86 | //![4] |
|
87 | 87 | scatterSeries.clear(); |
|
88 | 88 | scatterSeries.append(__activeIndex, interval); |
|
89 | 89 | scatterSeries.color = Qt.tint(scatterSeries.color, "#05FF0000"); |
|
90 | 90 | scatterSeries.markerSize += 0.5; |
|
91 | 91 | //![4] |
|
92 | 92 | } else { |
|
93 | 93 | //![5] |
|
94 | 94 | // Switch the colors of the slice and the border |
|
95 | 95 | wheelOfFortune.at(index).borderWidth = 2; |
|
96 | 96 | var borderColor = wheelOfFortune.at(index).borderColor; |
|
97 | 97 | wheelOfFortune.at(index).borderColor = wheelOfFortune.at(index).color; |
|
98 | 98 | wheelOfFortune.at(index).color = borderColor; |
|
99 | 99 | //![5] |
|
100 | 100 | } |
|
101 | 101 | } |
|
102 | 102 | } |
|
103 | 103 | } |
@@ -1,101 +1,101 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | id: chartViewSelector |
|
27 | 27 | width: parent.width |
|
28 | 28 | height: parent.height |
|
29 | 29 | signal seriesAdded(string seriesName, color seriesColor) |
|
30 | 30 | |
|
31 | 31 | function highlightSeries(seriesName) { |
|
32 | 32 | if (seriesName == "") { |
|
33 | 33 | if (state != "") |
|
34 | 34 | state = ""; |
|
35 | 35 | |
|
36 | 36 | for (var i = 0; i < chartViewStacked.count; i++) |
|
37 | 37 | chartViewStacked.series(i).opacity = 1.0; |
|
38 | 38 | } else { |
|
39 | 39 | var targetOpacity = 0.1; |
|
40 | 40 | for (var j = 0; j < chartViewStacked.count; j++) { |
|
41 | 41 | if (chartViewStacked.series(j).name != seriesName) |
|
42 | 42 | chartViewStacked.series(j).opacity = 0.25; |
|
43 | 43 | else if (state == "highlight") |
|
44 | 44 | chartViewSelected.selectedSeries = chartViewStacked.series(j); |
|
45 | 45 | } |
|
46 | 46 | } |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | function selectSeries(seriesName) { |
|
50 | 50 | for (var i = 0; i < chartViewStacked.count; i++) { |
|
51 | 51 | if (chartViewStacked.series(i).name == seriesName) { |
|
52 | 52 | chartViewSelected.selectedSeries = chartViewStacked.series(i); |
|
53 | 53 | if (chartViewSelector.state == "") |
|
54 | 54 | chartViewSelector.state = "highlighted"; |
|
55 | 55 | else |
|
56 | 56 | chartViewSelector.state = ""; |
|
57 | 57 | } |
|
58 | 58 | } |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | ChartViewStacked { |
|
62 | 62 | id: chartViewStacked |
|
63 | 63 | anchors.left: parent.left |
|
64 | 64 | anchors.leftMargin: 0 |
|
65 | 65 | width: parent.width |
|
66 | 66 | height: parent.height |
|
67 | 67 | onSeriesAdded: chartViewSelector.seriesAdded(series.name, series.color); |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | ChartViewHighlighted { |
|
71 | 71 | id: chartViewSelected |
|
72 | 72 | anchors.left: chartViewStacked.right |
|
73 | 73 | width: parent.width |
|
74 | 74 | height: parent.height |
|
75 | 75 | |
|
76 | 76 | opacity: 0.0 |
|
77 | 77 | onClicked: { |
|
78 | 78 | chartViewSelector.state = ""; |
|
79 | 79 | } |
|
80 | 80 | } |
|
81 | 81 | |
|
82 | 82 | states: State { |
|
83 | 83 | name: "highlighted" |
|
84 | 84 | PropertyChanges { |
|
85 | 85 | target: chartViewSelected |
|
86 | 86 | opacity: 1.0 |
|
87 | 87 | } |
|
88 | 88 | PropertyChanges { |
|
89 | 89 | target: chartViewStacked |
|
90 | 90 | anchors.leftMargin: -chartViewStacked.width |
|
91 | 91 | opacity: 0.0 |
|
92 | 92 | } |
|
93 | 93 | } |
|
94 | 94 | |
|
95 | 95 | transitions: Transition { |
|
96 | 96 | PropertyAnimation { |
|
97 | 97 | properties: "width, height, opacity, anchors.leftMargin" |
|
98 | 98 | duration: 400 |
|
99 | 99 | } |
|
100 | 100 | } |
|
101 | 101 | } |
@@ -1,67 +1,67 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | id: main |
|
27 | 27 | width: 400 |
|
28 | 28 | height: 320 |
|
29 | 29 | |
|
30 | 30 | Column { |
|
31 | 31 | id: column |
|
32 | 32 | anchors.fill: parent |
|
33 | 33 | anchors.bottomMargin: 10 |
|
34 | 34 | spacing: 0 |
|
35 | 35 | |
|
36 | 36 | ChartViewSelector { |
|
37 | 37 | id: chartViewSelector |
|
38 | 38 | width: parent.width |
|
39 | 39 | height: parent.height - customLegend.height - anchors.bottomMargin |
|
40 | 40 | onSeriesAdded: customLegend.addSeries(seriesName, seriesColor); |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 43 | CustomLegend { |
|
44 | 44 | id: customLegend |
|
45 | 45 | width: parent.width |
|
46 | 46 | height: 50 |
|
47 | 47 | anchors.horizontalCenter: parent.horizontalCenter |
|
48 | 48 | onEntered: chartViewSelector.highlightSeries(seriesName); |
|
49 | 49 | onExited: chartViewSelector.highlightSeries(""); |
|
50 | 50 | onSelected: chartViewSelector.selectSeries(seriesName); |
|
51 | 51 | } |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | states: State { |
|
55 | 55 | name: "highlighted" |
|
56 | 56 | PropertyChanges { |
|
57 | 57 | target: chartViewHighlighted |
|
58 | 58 | width: column.width |
|
59 | 59 | height: (column.height - column.anchors.margins * 2 - customLegend.height) |
|
60 | 60 | } |
|
61 | 61 | PropertyChanges { |
|
62 | 62 | target: chartViewStacked |
|
63 | 63 | width: 1 |
|
64 | 64 | height: 1 |
|
65 | 65 | } |
|
66 | 66 | } |
|
67 | 67 | } |
@@ -1,96 +1,96 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | import QtQuick.XmlListModel 2.0 |
|
25 | 25 | |
|
26 | Rectangle { | |
|
26 | Item { | |
|
27 | 27 | width: 400 |
|
28 | 28 | height: 300 |
|
29 | 29 | property int currentIndex: -1 |
|
30 | 30 | |
|
31 | 31 | //![1] |
|
32 | 32 | ChartView { |
|
33 | 33 | id: chartView |
|
34 | 34 | title: "Driver Speeds, lap 1" |
|
35 | 35 | anchors.fill: parent |
|
36 | 36 | legend.alignment: Qt.AlignTop |
|
37 | 37 | animationOptions: ChartView.SeriesAnimations |
|
38 | 38 | antialiasing: true |
|
39 | 39 | } |
|
40 | 40 | //![1] |
|
41 | 41 | |
|
42 | 42 | //![2] |
|
43 | 43 | // An example XmlListModel containing F1 legend drivers' speeds at speed traps |
|
44 | 44 | SpeedsXml { |
|
45 | 45 | id: speedsXml |
|
46 | 46 | onStatusChanged: { |
|
47 | 47 | if (status == XmlListModel.Ready) { |
|
48 | 48 | timer.start(); |
|
49 | 49 | } |
|
50 | 50 | } |
|
51 | 51 | } |
|
52 | 52 | //![2] |
|
53 | 53 | |
|
54 | 54 | //![3] |
|
55 | 55 | // A timer to mimic refreshing the data dynamically |
|
56 | 56 | Timer { |
|
57 | 57 | id: timer |
|
58 | 58 | interval: 700 |
|
59 | 59 | repeat: true |
|
60 | 60 | triggeredOnStart: true |
|
61 | 61 | running: false |
|
62 | 62 | onTriggered: { |
|
63 | 63 | currentIndex++; |
|
64 | 64 | if (currentIndex < speedsXml.count) { |
|
65 | 65 | // Check if there is a series for the data already (we are using driver name to identify series) |
|
66 | 66 | var lineSeries = chartView.series(speedsXml.get(currentIndex).driver); |
|
67 | 67 | if (!lineSeries) { |
|
68 | 68 | lineSeries = chartView.createSeries(ChartView.SeriesTypeLine, speedsXml.get(currentIndex).driver); |
|
69 | 69 | chartView.axisY().min = 0; |
|
70 | 70 | chartView.axisY().max = 250; |
|
71 | 71 | chartView.axisY().tickCount = 6; |
|
72 | 72 | chartView.axisY().titleText = "speed (kph)"; |
|
73 | 73 | chartView.axisX().titleText = "speed trap"; |
|
74 | 74 | chartView.axisX().labelFormat = "%.0f"; |
|
75 | 75 | } |
|
76 | 76 | lineSeries.append(speedsXml.get(currentIndex).speedTrap, speedsXml.get(currentIndex).speed); |
|
77 | 77 | |
|
78 | 78 | if (speedsXml.get(currentIndex).speedTrap > 3) { |
|
79 | 79 | chartView.axisX().max = Number(speedsXml.get(currentIndex).speedTrap) + 1; |
|
80 | 80 | chartView.axisX().min = chartView.axisX().max - 5; |
|
81 | 81 | } else { |
|
82 | 82 | chartView.axisX().max = 5; |
|
83 | 83 | chartView.axisX().min = 0; |
|
84 | 84 | } |
|
85 | 85 | chartView.axisX().tickCount = chartView.axisX().max - chartView.axisX().min + 1; |
|
86 | 86 | } else { |
|
87 | 87 | // No more data, change x-axis range to show all the data |
|
88 | 88 | timer.stop(); |
|
89 | 89 | chartView.animationOptions = ChartView.AllAnimations; |
|
90 | 90 | chartView.axisX().min = 0; |
|
91 | 91 | chartView.axisX().max = speedsXml.get(currentIndex - 1).speedTrap; |
|
92 | 92 | } |
|
93 | 93 | } |
|
94 | 94 | } |
|
95 | 95 | //![3] |
|
96 | 96 | } |
@@ -1,57 +1,58 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | #include <QtWidgets/QApplication> |
|
23 | 23 | #include <QtQml/QQmlContext> |
|
24 | 24 | #include <QtQuick/QQuickView> |
|
25 | 25 | #include <QtQml/QQmlEngine> |
|
26 | 26 | #include <QtCore/QDir> |
|
27 | 27 | #include "datasource.h" |
|
28 | 28 | |
|
29 | 29 | int main(int argc, char *argv[]) |
|
30 | 30 | { |
|
31 | 31 | // Qt Charts uses Qt Graphics View Framework for drawing, therefore QApplication must be used. |
|
32 | 32 | QApplication app(argc, argv); |
|
33 | 33 | |
|
34 | 34 | QQuickView viewer; |
|
35 | 35 | |
|
36 | 36 | // The following are needed to make examples run without having to install the module |
|
37 | 37 | // in desktop environments. |
|
38 | 38 | #ifdef Q_OS_WIN |
|
39 | 39 | QString extraImportPath(QStringLiteral("%1/../../../../%2")); |
|
40 | 40 | #else |
|
41 | 41 | QString extraImportPath(QStringLiteral("%1/../../../%2")); |
|
42 | 42 | #endif |
|
43 | 43 | viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), |
|
44 | 44 | QString::fromLatin1("qml"))); |
|
45 | 45 | QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close); |
|
46 | 46 | |
|
47 | 47 | viewer.setTitle(QStringLiteral("QML Oscilloscope")); |
|
48 | 48 | |
|
49 | 49 | DataSource dataSource(&viewer); |
|
50 | 50 | viewer.rootContext()->setContextProperty("dataSource", &dataSource); |
|
51 | 51 | |
|
52 | 52 | viewer.setSource(QUrl("qrc:/qml/qmloscilloscope/main.qml")); |
|
53 | 53 | viewer.setResizeMode(QQuickView::SizeRootObjectToView); |
|
54 | viewer.setColor(QColor("#404040")); | |
|
54 | 55 | viewer.show(); |
|
55 | 56 | |
|
56 | 57 | return app.exec(); |
|
57 | 58 | } |
@@ -1,68 +1,67 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | |
|
24 | 24 | //![1] |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | id: main |
|
27 | 27 | width: 600 |
|
28 | 28 | height: 400 |
|
29 | color: "#404040" | |
|
30 | 29 | |
|
31 | 30 | ControlPanel { |
|
32 | 31 | id: controlPanel |
|
33 | 32 | anchors.top: parent.top |
|
34 | 33 | anchors.topMargin: 10 |
|
35 | 34 | anchors.bottom: parent.bottom |
|
36 | 35 | anchors.left: parent.left |
|
37 | 36 | anchors.leftMargin: 10 |
|
38 | 37 | //![1] |
|
39 | 38 | |
|
40 | 39 | onSignalSourceChanged: { |
|
41 | 40 | if (source == "sin") |
|
42 | 41 | dataSource.generateData(0, signalCount, sampleCount); |
|
43 | 42 | else |
|
44 | 43 | dataSource.generateData(1, signalCount, sampleCount); |
|
45 | 44 | scopeView.axisX().max = sampleCount; |
|
46 | 45 | } |
|
47 | 46 | onSeriesTypeChanged: scopeView.changeSeriesType(type); |
|
48 | 47 | onRefreshRateChanged: scopeView.changeRefreshRate(rate); |
|
49 | 48 | onAntialiasingEnabled: scopeView.antialiasing = enabled; |
|
50 | 49 | onOpenGlChanged: { |
|
51 | 50 | scopeView.openGL = enabled; |
|
52 | 51 | antialiasButton.enabled = !enabled; |
|
53 | 52 | antialiasButton.currentSelection = 0; |
|
54 | 53 | } |
|
55 | 54 | } |
|
56 | 55 | |
|
57 | 56 | //![2] |
|
58 | 57 | ScopeView { |
|
59 | 58 | id: scopeView |
|
60 | 59 | anchors.top: parent.top |
|
61 | 60 | anchors.bottom: parent.bottom |
|
62 | 61 | anchors.right: parent.right |
|
63 | 62 | anchors.left: controlPanel.right |
|
64 | 63 | height: main.height |
|
65 | 64 | } |
|
66 | 65 | //![2] |
|
67 | 66 | |
|
68 | 67 | } |
@@ -1,70 +1,70 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | //![1] |
|
28 | 28 | PolarChartView { |
|
29 | 29 | title: "Two Series, Common Axes" |
|
30 | 30 | anchors.fill: parent |
|
31 | 31 | legend.visible: false |
|
32 | 32 | antialiasing: true |
|
33 | 33 | |
|
34 | 34 | ValueAxis { |
|
35 | 35 | id: axisAngular |
|
36 | 36 | min: 0 |
|
37 | 37 | max: 20 |
|
38 | 38 | tickCount: 9 |
|
39 | 39 | } |
|
40 | 40 | |
|
41 | 41 | ValueAxis { |
|
42 | 42 | id: axisRadial |
|
43 | 43 | min: -0.5 |
|
44 | 44 | max: 1.5 |
|
45 | 45 | } |
|
46 | 46 | |
|
47 | 47 | SplineSeries { |
|
48 | 48 | id: series1 |
|
49 | 49 | axisAngular: axisAngular |
|
50 | 50 | axisRadial: axisRadial |
|
51 | 51 | pointsVisible: true |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | ScatterSeries { |
|
55 | 55 | id: series2 |
|
56 | 56 | axisAngular: axisAngular |
|
57 | 57 | axisRadial: axisRadial |
|
58 | 58 | markerSize: 10 |
|
59 | 59 | } |
|
60 | 60 | } |
|
61 | 61 | |
|
62 | 62 | // Add data dynamically to the series |
|
63 | 63 | Component.onCompleted: { |
|
64 | 64 | for (var i = 0; i <= 20; i++) { |
|
65 | 65 | series1.append(i, Math.random()); |
|
66 | 66 | series2.append(i, Math.random()); |
|
67 | 67 | } |
|
68 | 68 | } |
|
69 | 69 | //![1] |
|
70 | 70 | } |
@@ -1,91 +1,91 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | PolarChartView { |
|
30 | 30 | title: "Historical Area Series" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.visible: false |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | DateTimeAxis { |
|
36 | 36 | id: axis1 |
|
37 | 37 | format: "yyyy MMM" |
|
38 | 38 | tickCount: 13 |
|
39 | 39 | } |
|
40 | 40 | ValueAxis { |
|
41 | 41 | id: axis2 |
|
42 | 42 | } |
|
43 | 43 | LineSeries { |
|
44 | 44 | id: lowerLine |
|
45 | 45 | axisAngular: axis1 |
|
46 | 46 | axisRadial: axis2 |
|
47 | 47 | |
|
48 | 48 | // Please note that month in JavaScript months are zero based, so 2 means March |
|
49 | 49 | XYPoint { x: toMsecsSinceEpoch(new Date(1950, 0, 1)); y: 15 } |
|
50 | 50 | XYPoint { x: toMsecsSinceEpoch(new Date(1962, 4, 1)); y: 35 } |
|
51 | 51 | XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 } |
|
52 | 52 | XYPoint { x: toMsecsSinceEpoch(new Date(1978, 2, 1)); y: 75 } |
|
53 | 53 | XYPoint { x: toMsecsSinceEpoch(new Date(1987, 11, 1)); y: 102 } |
|
54 | 54 | XYPoint { x: toMsecsSinceEpoch(new Date(1992, 1, 1)); y: 132 } |
|
55 | 55 | XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 } |
|
56 | 56 | XYPoint { x: toMsecsSinceEpoch(new Date(2002, 4, 1)); y: 120 } |
|
57 | 57 | XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 1)); y: 140 } |
|
58 | 58 | XYPoint { x: toMsecsSinceEpoch(new Date(2013, 5, 1)); y: 150 } |
|
59 | 59 | } |
|
60 | 60 | LineSeries { |
|
61 | 61 | id: upperLine |
|
62 | 62 | axisAngular: axis1 |
|
63 | 63 | axisRadial: axis2 |
|
64 | 64 | |
|
65 | 65 | // Please note that month in JavaScript months are zero based, so 2 means March |
|
66 | 66 | XYPoint { x: toMsecsSinceEpoch(new Date(1950, 0, 1)); y: 30 } |
|
67 | 67 | XYPoint { x: toMsecsSinceEpoch(new Date(1962, 4, 1)); y: 55 } |
|
68 | 68 | XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 80 } |
|
69 | 69 | XYPoint { x: toMsecsSinceEpoch(new Date(1978, 2, 1)); y: 105 } |
|
70 | 70 | XYPoint { x: toMsecsSinceEpoch(new Date(1987, 11, 1)); y: 125 } |
|
71 | 71 | XYPoint { x: toMsecsSinceEpoch(new Date(1992, 1, 1)); y: 160 } |
|
72 | 72 | XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 140 } |
|
73 | 73 | XYPoint { x: toMsecsSinceEpoch(new Date(2002, 4, 1)); y: 140 } |
|
74 | 74 | XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 1)); y: 170 } |
|
75 | 75 | XYPoint { x: toMsecsSinceEpoch(new Date(2013, 5, 1)); y: 200 } |
|
76 | 76 | } |
|
77 | 77 | AreaSeries { |
|
78 | 78 | axisAngular: axis1 |
|
79 | 79 | axisRadial: axis2 |
|
80 | 80 | lowerSeries: lowerLine |
|
81 | 81 | upperSeries: upperLine |
|
82 | 82 | } |
|
83 | 83 | } |
|
84 | 84 | // DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to |
|
85 | 85 | // milliseconds since epoch to make them match the DateTimeAxis values |
|
86 | 86 | function toMsecsSinceEpoch(date) { |
|
87 | 87 | var msecs = date.getTime(); |
|
88 | 88 | return msecs; |
|
89 | 89 | } |
|
90 | 90 | //![1] |
|
91 | 91 | } |
@@ -1,78 +1,78 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | import QtCharts 2.0 |
|
24 | 24 | |
|
25 | Rectangle { | |
|
25 | Item { | |
|
26 | 26 | anchors.fill: parent |
|
27 | 27 | |
|
28 | 28 | //![1] |
|
29 | 29 | PolarChartView { |
|
30 | 30 | title: "Numerical Data for Dummies" |
|
31 | 31 | anchors.fill: parent |
|
32 | 32 | legend.visible: false |
|
33 | 33 | antialiasing: true |
|
34 | 34 | |
|
35 | 35 | LineSeries { |
|
36 | 36 | axisRadial: CategoryAxis { |
|
37 | 37 | min: 0 |
|
38 | 38 | max: 30 |
|
39 | 39 | CategoryRange { |
|
40 | 40 | label: "critical" |
|
41 | 41 | endValue: 2 |
|
42 | 42 | } |
|
43 | 43 | CategoryRange { |
|
44 | 44 | label: "low" |
|
45 | 45 | endValue: 7 |
|
46 | 46 | } |
|
47 | 47 | CategoryRange { |
|
48 | 48 | label: "normal" |
|
49 | 49 | endValue: 12 |
|
50 | 50 | } |
|
51 | 51 | CategoryRange { |
|
52 | 52 | label: "high" |
|
53 | 53 | endValue: 18 |
|
54 | 54 | } |
|
55 | 55 | CategoryRange { |
|
56 | 56 | label: "extremely high" |
|
57 | 57 | endValue: 30 |
|
58 | 58 | } |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | axisAngular: ValueAxis { |
|
62 | 62 | tickCount: 13 |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | XYPoint { x: 0; y: 4.3 } |
|
66 | 66 | XYPoint { x: 1; y: 4.1 } |
|
67 | 67 | XYPoint { x: 2; y: 4.7 } |
|
68 | 68 | XYPoint { x: 3; y: 3.9 } |
|
69 | 69 | XYPoint { x: 4; y: 5.2 } |
|
70 | 70 | XYPoint { x: 5; y: 5.3 } |
|
71 | 71 | XYPoint { x: 6; y: 6.1 } |
|
72 | 72 | XYPoint { x: 7; y: 7.7 } |
|
73 | 73 | XYPoint { x: 8; y: 12.9 } |
|
74 | 74 | XYPoint { x: 9; y: 19.2 } |
|
75 | 75 | } |
|
76 | 76 | } |
|
77 | 77 | //![1] |
|
78 | 78 | } |
@@ -1,81 +1,81 | |||
|
1 | 1 | /****************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
|
4 | 4 | ** Contact: http://www.qt.io/licensing/ |
|
5 | 5 | ** |
|
6 | 6 | ** This file is part of the Qt Charts module. |
|
7 | 7 | ** |
|
8 | 8 | ** $QT_BEGIN_LICENSE:COMM$ |
|
9 | 9 | ** |
|
10 | 10 | ** Commercial License Usage |
|
11 | 11 | ** Licensees holding valid commercial Qt licenses may use this file in |
|
12 | 12 | ** accordance with the commercial license agreement provided with the |
|
13 | 13 | ** Software or, alternatively, in accordance with the terms contained in |
|
14 | 14 | ** a written agreement between you and The Qt Company. For licensing terms |
|
15 | 15 | ** and conditions see http://www.qt.io/terms-conditions. For further |
|
16 | 16 | ** information use the contact form at http://www.qt.io/contact-us. |
|
17 | 17 | ** |
|
18 | 18 | ** $QT_END_LICENSE$ |
|
19 | 19 | ** |
|
20 | 20 | ******************************************************************************/ |
|
21 | 21 | |
|
22 | 22 | import QtQuick 2.0 |
|
23 | 23 | |
|
24 | Rectangle { | |
|
24 | Item { | |
|
25 | 25 | width: 800 |
|
26 | 26 | height: 600 |
|
27 | 27 | property bool sourceLoaded: false |
|
28 | 28 | |
|
29 | 29 | ListView { |
|
30 | 30 | id: root |
|
31 | 31 | focus: true |
|
32 | 32 | anchors.fill: parent |
|
33 | 33 | snapMode: ListView.SnapOneItem |
|
34 | 34 | highlightRangeMode: ListView.StrictlyEnforceRange |
|
35 | 35 | highlightMoveDuration: 250 |
|
36 | 36 | orientation: ListView.Horizontal |
|
37 | 37 | boundsBehavior: Flickable.StopAtBounds |
|
38 | 38 | |
|
39 | 39 | onCurrentIndexChanged: { |
|
40 | 40 | if (infoText.opacity > 0.0) { |
|
41 | 41 | if (sourceLoaded) |
|
42 | 42 | infoText.opacity = 0.0; |
|
43 | 43 | else if (currentIndex != 0) |
|
44 | 44 | currentIndex = 0; |
|
45 | 45 | } |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | model: ListModel { |
|
49 | 49 | ListElement {component: "View1.qml"} |
|
50 | 50 | ListElement {component: "View2.qml"} |
|
51 | 51 | ListElement {component: "View3.qml"} |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | 54 | delegate: Loader { |
|
55 | 55 | width: root.width |
|
56 | 56 | height: root.height |
|
57 | 57 | |
|
58 | 58 | source: component |
|
59 | 59 | asynchronous: true |
|
60 | 60 | |
|
61 | 61 | onLoaded: sourceLoaded = true |
|
62 | 62 | } |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | Rectangle { |
|
66 | 66 | id: infoText |
|
67 | 67 | anchors.centerIn: parent |
|
68 | 68 | width: parent.width |
|
69 | 69 | height: 40 |
|
70 | 70 | color: "black" |
|
71 | 71 | Text { |
|
72 | 72 | color: "white" |
|
73 | 73 | anchors.centerIn: parent |
|
74 | 74 | text: "You can navigate between views using swipe or arrow keys" |
|
75 | 75 | } |
|
76 | 76 | |
|
77 | 77 | Behavior on opacity { |
|
78 | 78 | NumberAnimation { duration: 400 } |
|
79 | 79 | } |
|
80 | 80 | } |
|
81 | 81 | } |
General Comments 0
You need to be logged in to leave comments.
Login now