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