@@ -0,0 +1,57 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.0 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | Chart { | |||
|
28 | title: "Scatters" | |||
|
29 | anchors.fill: parent | |||
|
30 | theme: Chart.ChartThemeBlueCerulean | |||
|
31 | ||||
|
32 | ScatterSeries { | |||
|
33 | id: scatter1 | |||
|
34 | name: "Scatter1" | |||
|
35 | points: [ | |||
|
36 | XyPoint { x: 1.5; y: 1.5 }, | |||
|
37 | XyPoint { x: 1.5; y: 1.6 }, | |||
|
38 | XyPoint { x: 1.57; y: 1.55 }, | |||
|
39 | XyPoint { x: 1.8; y: 1.8 }, | |||
|
40 | XyPoint { x: 1.9; y: 1.6 }, | |||
|
41 | XyPoint { x: 2.1; y: 1.3 }, | |||
|
42 | XyPoint { x: 2.5; y: 2.1 } | |||
|
43 | ] | |||
|
44 | } | |||
|
45 | ScatterSeries { | |||
|
46 | name: "Scatter2" | |||
|
47 | points: [ | |||
|
48 | XyPoint { x: 2.0; y: 2.0 }, | |||
|
49 | XyPoint { x: 2.0; y: 2.1 }, | |||
|
50 | XyPoint { x: 2.07; y: 2.05 }, | |||
|
51 | XyPoint { x: 2.2; y: 2.9 }, | |||
|
52 | XyPoint { x: 2.4; y: 2.7 }, | |||
|
53 | XyPoint { x: 2.67; y: 2.65 } | |||
|
54 | ] | |||
|
55 | } | |||
|
56 | } | |||
|
57 | } |
@@ -1,89 +1,89 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativebarseries.h" |
|
21 | #include "declarativebarseries.h" | |
22 | #include "declarativechart.h" |
|
22 | #include "declarativechart.h" | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qbarseries.h" |
|
24 | #include "qbarseries.h" | |
25 | #include "qbarset.h" |
|
25 | #include "qbarset.h" | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 | DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) : |
|
29 | DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) : | |
30 | QDeclarativeItem(parent) |
|
30 | QDeclarativeItem(parent) | |
31 | { |
|
31 | { | |
32 | setFlag(QGraphicsItem::ItemHasNoContents, false); |
|
32 | setFlag(QGraphicsItem::ItemHasNoContents, false); | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | void DeclarativeBarSeries::componentComplete() |
|
35 | void DeclarativeBarSeries::componentComplete() | |
36 | { |
|
36 | { | |
37 | if (!m_series) { |
|
37 | if (!m_series) { | |
38 | DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent()); |
|
38 | DeclarativeChart *declarativeChart = qobject_cast<DeclarativeChart *>(parent()); | |
39 |
|
39 | |||
40 | if (declarativeChart) { |
|
40 | if (declarativeChart) { | |
41 | QChart *chart = qobject_cast<QChart *>(declarativeChart->m_chart); |
|
41 | QChart *chart = qobject_cast<QChart *>(declarativeChart->m_chart); | |
42 | Q_ASSERT(chart); |
|
42 | Q_ASSERT(chart); | |
43 |
|
43 | |||
44 | // QStringList categories; |
|
44 | // QStringList categories; | |
45 | // categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; |
|
45 | // categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
46 | // m_series = new QBarSeries(categories); |
|
46 | // m_series = new QBarSeries(categories); | |
47 | // m_series = new QBarSeries(m_categories); |
|
47 | // m_series = new QBarSeries(m_categories); | |
48 | m_series = new QBarSeries(m_categories); |
|
48 | m_series = new QBarSeries(m_categories); | |
49 |
|
49 | |||
50 | // TODO: use data from model |
|
50 | // TODO: use data from model | |
51 | QBarSet *set0 = new QBarSet("Bub"); |
|
51 | QBarSet *set0 = new QBarSet("Bub"); | |
52 | QBarSet *set1 = new QBarSet("Bob"); |
|
52 | QBarSet *set1 = new QBarSet("Bob"); | |
53 | QBarSet *set2 = new QBarSet("Guybrush"); |
|
53 | QBarSet *set2 = new QBarSet("Guybrush"); | |
54 |
|
54 | |||
55 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; |
|
55 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; | |
56 |
*set1 << 5 << |
|
56 | *set1 << 5 << 1 << 2 << 4 << 1 << 7; | |
57 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; |
|
57 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
58 |
|
58 | |||
59 | m_series->appendBarSet(set0); |
|
59 | m_series->appendBarSet(set0); | |
60 | m_series->appendBarSet(set1); |
|
60 | m_series->appendBarSet(set1); | |
61 | m_series->appendBarSet(set2); |
|
61 | m_series->appendBarSet(set2); | |
62 |
|
62 | |||
63 | chart->addSeries(m_series); |
|
63 | chart->addSeries(m_series); | |
64 | } |
|
64 | } | |
65 | } |
|
65 | } | |
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | void DeclarativeBarSeries::setBarCategories(QStringList categories) |
|
68 | void DeclarativeBarSeries::setBarCategories(QStringList categories) | |
69 | { |
|
69 | { | |
70 | m_categories = categories; |
|
70 | m_categories = categories; | |
71 | if (m_series) { |
|
71 | if (m_series) { | |
72 | // Replace categories of the QBarSeries with the new categories |
|
72 | // Replace categories of the QBarSeries with the new categories | |
73 | for (int i(0); i < m_categories.count(); i++) { |
|
73 | for (int i(0); i < m_categories.count(); i++) { | |
74 | if (m_series->categories().at(i) != m_categories.at(i)) |
|
74 | if (m_series->categories().at(i) != m_categories.at(i)) | |
75 | m_series->insertCategory(m_series->categoryCount(), m_categories.at(i)); |
|
75 | m_series->insertCategory(m_series->categoryCount(), m_categories.at(i)); | |
76 | } |
|
76 | } | |
77 | while (m_series->categoryCount() > m_categories.count()) |
|
77 | while (m_series->categoryCount() > m_categories.count()) | |
78 | m_series->removeCategory(m_series->categoryCount() - 1); |
|
78 | m_series->removeCategory(m_series->categoryCount() - 1); | |
79 | } |
|
79 | } | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | QStringList DeclarativeBarSeries::barCategories() |
|
82 | QStringList DeclarativeBarSeries::barCategories() | |
83 | { |
|
83 | { | |
84 | return m_categories; |
|
84 | return m_categories; | |
85 | } |
|
85 | } | |
86 |
|
86 | |||
87 | #include "moc_declarativebarseries.cpp" |
|
87 | #include "moc_declarativebarseries.cpp" | |
88 |
|
88 | |||
89 | QTCOMMERCIALCHART_END_NAMESPACE |
|
89 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,58 +1,61 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVECHART_H |
|
21 | #ifndef DECLARATIVECHART_H | |
22 | #define DECLARATIVECHART_H |
|
22 | #define DECLARATIVECHART_H | |
23 |
|
23 | |||
24 | #include <QtCore/QtGlobal> |
|
24 | #include <QtCore/QtGlobal> | |
25 | #include <QDeclarativeItem> |
|
25 | #include <QDeclarativeItem> | |
26 | #include <qchart.h> |
|
26 | #include <qchart.h> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | // TODO: Derive from QChart for easier definition of properties? |
|
30 | // TODO: Derive from QChart for easier definition of properties? | |
31 | class DeclarativeChart : public QDeclarativeItem |
|
31 | class DeclarativeChart : public QDeclarativeItem | |
32 | // TODO: for QTQUICK2: extend QQuickPainterItem instead |
|
32 | // TODO: for QTQUICK2: extend QQuickPainterItem instead | |
33 | //class DeclarativeChart : public QQuickPaintedItem, public Chart |
|
33 | //class DeclarativeChart : public QQuickPaintedItem, public Chart | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) |
|
36 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) | |
|
37 | Q_PROPERTY(QString title READ title WRITE setTitle) | |||
37 |
|
38 | |||
38 | public: |
|
39 | public: | |
39 | DeclarativeChart(QDeclarativeItem *parent = 0); |
|
40 | DeclarativeChart(QDeclarativeItem *parent = 0); | |
40 | ~DeclarativeChart(); |
|
41 | ~DeclarativeChart(); | |
41 |
|
42 | |||
42 | public: // From QDeclarativeItem/QGraphicsItem |
|
43 | public: // From QDeclarativeItem/QGraphicsItem | |
43 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); |
|
44 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); | |
44 | void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
45 | void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); | |
45 |
|
46 | |||
46 | public: |
|
47 | public: | |
47 | void setTheme(QChart::ChartTheme theme) {m_chart->setTheme(theme);} |
|
48 | void setTheme(QChart::ChartTheme theme) {m_chart->setTheme(theme);} | |
48 | QChart::ChartTheme theme(); |
|
49 | QChart::ChartTheme theme(); | |
|
50 | void setTitle(QString title) {m_chart->setTitle(title);} | |||
|
51 | QString title() { return m_chart->title();} | |||
49 |
|
52 | |||
50 | public: |
|
53 | public: | |
51 | // Extending QChart with DeclarativeChart is not possible because QObject does not support |
|
54 | // Extending QChart with DeclarativeChart is not possible because QObject does not support | |
52 | // multi inheritance, so we now have a QChart as a member instead |
|
55 | // multi inheritance, so we now have a QChart as a member instead | |
53 | QChart *m_chart; |
|
56 | QChart *m_chart; | |
54 | }; |
|
57 | }; | |
55 |
|
58 | |||
56 | QTCOMMERCIALCHART_END_NAMESPACE |
|
59 | QTCOMMERCIALCHART_END_NAMESPACE | |
57 |
|
60 | |||
58 | #endif // DECLARATIVECHART_H |
|
61 | #endif // DECLARATIVECHART_H |
@@ -1,74 +1,51 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | width: parent.width |
|
25 | anchors.fill: parent | |
26 | height: parent.height |
|
|||
27 |
|
||||
28 | // Another option for QML data api: |
|
|||
29 | // ListModel { |
|
|||
30 | // id: listModelForPie |
|
|||
31 | // // PieDataElement |
|
|||
32 | // ListElement { |
|
|||
33 | // label: "Apple" |
|
|||
34 | // value: 4.3 |
|
|||
35 | // } |
|
|||
36 | // ListElement { |
|
|||
37 | // label: "Blackberry" |
|
|||
38 | // value: 15.1 |
|
|||
39 | // } |
|
|||
40 | // } |
|
|||
41 |
|
||||
42 | Component.onCompleted: { |
|
|||
43 | // console.log("model:" + myModel.item(0)); |
|
|||
44 | // myModel.insert(1, {"time":1.4; "speed":41.1 }); |
|
|||
45 | // scatter.appendData(); |
|
|||
46 | // chart1.theme = Chart.ThemeHighContrast; |
|
|||
47 | // chart2.theme = Chart.ThemeHighContrast; |
|
|||
48 | } |
|
|||
49 |
|
26 | |||
50 | Chart { |
|
27 | Chart { | |
51 | id: chart1 |
|
28 | title: "Car brand shares in Finland" | |
52 | anchors.fill: parent |
|
29 | anchors.fill: parent | |
53 |
theme: Chart.ChartTheme |
|
30 | theme: Chart.ChartThemeLight | |
54 |
|
||||
55 | BarSeries { |
|
|||
56 | barCategories: [ "2008", "2009", "2010", "2011", "2012" ] |
|
|||
57 | // TBD: data |
|
|||
58 | } |
|
|||
59 |
|
31 | |||
60 | PieSeries { |
|
32 | PieSeries { | |
61 | horizontalPosition: 0.2 |
|
33 | horizontalPosition: 0.2 | |
62 | verticalPosition: 0.3 |
|
34 | verticalPosition: 0.3 | |
63 | size: 0.4 |
|
35 | size: 0.4 | |
64 | endAngle: 0.52 * 360 // The share of "others" is 52% |
|
|||
65 |
|
|
36 | slices: [ | |
66 | PieSlice { label: "Volkswagen"; value: 13.5 }, |
|
37 | PieSlice { label: "Volkswagen"; value: 13.5 }, | |
67 | PieSlice { label: "Toyota"; value: 10.9 }, |
|
38 | PieSlice { label: "Toyota"; value: 10.9 }, | |
68 | PieSlice { label: "Ford"; value: 8.6 }, |
|
39 | PieSlice { label: "Ford"; value: 8.6 }, | |
69 | PieSlice { label: "Skoda"; value: 8.2 }, |
|
40 | PieSlice { label: "Skoda"; value: 8.2 }, | |
70 | PieSlice { label: "Volvo"; value: 6.8 } |
|
41 | PieSlice { label: "Volvo"; value: 6.8 }, | |
|
42 | PieSlice { label: "Others"; value: 52.0 } | |||
71 | ] |
|
43 | ] | |
72 | } |
|
44 | } | |
|
45 | ||||
|
46 | BarSeries { | |||
|
47 | barCategories: [ "2008", "2009", "2010", "2011", "2012" ] | |||
|
48 | // data implementation missing | |||
|
49 | } | |||
73 | } |
|
50 | } | |
74 | } |
|
51 | } |
@@ -1,51 +1,57 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | Chart { |
|
27 | Chart { | |
|
28 | title: "Line&Spline" | |||
28 | anchors.fill: parent |
|
29 | anchors.fill: parent | |
29 | theme: Chart.ChartThemeBrownSand |
|
30 | theme: Chart.ChartThemeBrownSand | |
30 |
|
31 | |||
31 | LineSeries { |
|
32 | LineSeries { | |
32 | name: "Line" |
|
33 | name: "Line" | |
33 | points: [ |
|
34 | points: [ | |
34 | XyPoint { x: 0.0; y: 0.0 }, |
|
35 | XyPoint { x: 0.0; y: 0.0 }, | |
35 | XyPoint { x: 1.1; y: 2.1 }, |
|
36 | XyPoint { x: 1.1; y: 2.1 }, | |
|
37 | XyPoint { x: 1.9; y: 3.3 }, | |||
36 | XyPoint { x: 2.9; y: 4.9 }, |
|
38 | XyPoint { x: 2.9; y: 4.9 }, | |
37 | XyPoint { x: 3.2; y: 3.0 } |
|
39 | XyPoint { x: 3.2; y: 3.0 }, | |
|
40 | XyPoint { x: 4.0; y: 3.3 } | |||
38 | ] |
|
41 | ] | |
39 | } |
|
42 | } | |
40 |
|
43 | |||
41 | SplineSeries { |
|
44 | SplineSeries { | |
42 | name: "Spline" |
|
45 | name: "Spline" | |
43 | points: [ |
|
46 | points: [ | |
44 | XyPoint { x: 0.0; y: 0.3 }, |
|
47 | XyPoint { x: 0.0; y: 0.3 }, | |
45 | XyPoint { x: 1.1; y: 3.2 }, |
|
48 | XyPoint { x: 1.1; y: 3.2 }, | |
46 |
XyPoint { x: |
|
49 | XyPoint { x: 1.7; y: 2.4 }, | |
47 |
XyPoint { x: |
|
50 | XyPoint { x: 2.1; y: 2.1 }, | |
|
51 | XyPoint { x: 2.9; y: 2.6 }, | |||
|
52 | XyPoint { x: 3.4; y: 2.3 }, | |||
|
53 | XyPoint { x: 4.1; y: 3.1 } | |||
48 | ] |
|
54 | ] | |
49 | } |
|
55 | } | |
50 | } |
|
56 | } | |
51 | } |
|
57 | } |
@@ -1,70 +1,128 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | anchors.fill: parent |
|
25 | anchors.fill: parent | |
26 |
|
26 | |||
27 | Chart { |
|
27 | Chart { | |
|
28 | title: "NHL All-Star Team Players" | |||
28 | anchors.fill: parent |
|
29 | anchors.fill: parent | |
29 | theme: Chart.ChartThemeHighContrast |
|
30 | theme: Chart.ChartThemeHighContrast | |
30 |
|
31 | |||
31 | AreaSeries { |
|
32 | AreaSeries { | |
32 |
name: " |
|
33 | name: "Finnish" | |
33 | points: [ |
|
34 | points: [ | |
34 |
XyPoint { x: 0 |
|
35 | XyPoint { x: 0; y: 0 }, | |
35 |
XyPoint { x: |
|
36 | XyPoint { x: 1; y: 0 }, | |
36 |
XyPoint { x: |
|
37 | XyPoint { x: 2; y: 0 }, | |
|
38 | XyPoint { x: 3; y: 0 }, | |||
|
39 | XyPoint { x: 4; y: 0 }, | |||
|
40 | XyPoint { x: 5; y: 0 }, | |||
|
41 | XyPoint { x: 6; y: 1 }, | |||
|
42 | XyPoint { x: 7; y: 0 }, | |||
|
43 | XyPoint { x: 8; y: 0 }, | |||
|
44 | XyPoint { x: 9; y: 0 }, | |||
|
45 | XyPoint { x: 10; y: 0 }, | |||
|
46 | XyPoint { x: 11; y: 1 } | |||
37 | ] |
|
47 | ] | |
38 | lowerPoints: [ |
|
48 | lowerPoints: [ | |
39 |
XyPoint { x: 0 |
|
49 | XyPoint { x: 0; y: 0 }, | |
40 |
XyPoint { x: |
|
50 | XyPoint { x: 1; y: 0 }, | |
41 |
XyPoint { x: |
|
51 | XyPoint { x: 2; y: 0 }, | |
|
52 | XyPoint { x: 3; y: 0 }, | |||
|
53 | XyPoint { x: 4; y: 0 }, | |||
|
54 | XyPoint { x: 5; y: 0 }, | |||
|
55 | XyPoint { x: 6; y: 0 }, | |||
|
56 | XyPoint { x: 7; y: 0 }, | |||
|
57 | XyPoint { x: 8; y: 0 }, | |||
|
58 | XyPoint { x: 9; y: 0 }, | |||
|
59 | XyPoint { x: 10; y: 0 }, | |||
|
60 | XyPoint { x: 11; y: 0 } | |||
42 | ] |
|
61 | ] | |
43 | } |
|
62 | } | |
44 |
|
63 | |||
45 |
|
|
64 | AreaSeries { | |
46 |
name: " |
|
65 | name: "Russian" | |
47 | points: [ |
|
66 | points: [ | |
48 |
XyPoint { x: |
|
67 | XyPoint { x: 0; y: 1 }, | |
49 |
XyPoint { x: 1 |
|
68 | XyPoint { x: 1; y: 1 }, | |
50 |
XyPoint { x: |
|
69 | XyPoint { x: 2; y: 1 }, | |
|
70 | XyPoint { x: 3; y: 1 }, | |||
|
71 | XyPoint { x: 4; y: 1 }, | |||
|
72 | XyPoint { x: 5; y: 0 }, | |||
|
73 | XyPoint { x: 6; y: 1 }, | |||
|
74 | XyPoint { x: 7; y: 1 }, | |||
|
75 | XyPoint { x: 8; y: 4 }, | |||
|
76 | XyPoint { x: 9; y: 3 }, | |||
|
77 | XyPoint { x: 10; y: 2 }, | |||
|
78 | XyPoint { x: 11; y: 1 } | |||
51 | ] |
|
79 | ] | |
52 | } |
|
80 | lowerPoints: [ | |
53 | ScatterSeries { |
|
81 | XyPoint { x: 0; y: 0 }, | |
54 | name: "Scatter2" |
|
82 | XyPoint { x: 1; y: 0 }, | |
55 |
|
|
83 | XyPoint { x: 2; y: 0 }, | |
56 |
XyPoint { x: |
|
84 | XyPoint { x: 3; y: 0 }, | |
57 |
XyPoint { x: |
|
85 | XyPoint { x: 4; y: 0 }, | |
58 |
XyPoint { x: |
|
86 | XyPoint { x: 5; y: 0 }, | |
|
87 | XyPoint { x: 6; y: 0 }, | |||
|
88 | XyPoint { x: 7; y: 0 }, | |||
|
89 | XyPoint { x: 8; y: 0 }, | |||
|
90 | XyPoint { x: 9; y: 0 }, | |||
|
91 | XyPoint { x: 10; y: 0 }, | |||
|
92 | XyPoint { x: 11; y: 0 } | |||
59 | ] |
|
93 | ] | |
60 | } |
|
94 | } | |
61 | ScatterSeries { |
|
95 | ||
62 | name: "Scatter3" |
|
96 | AreaSeries { | |
|
97 | name: "Swedish" | |||
63 | points: [ |
|
98 | points: [ | |
64 |
XyPoint { x: |
|
99 | XyPoint { x: 0; y: 1 }, | |
65 |
XyPoint { x: |
|
100 | XyPoint { x: 1; y: 1 }, | |
66 |
XyPoint { x: 2 |
|
101 | XyPoint { x: 2; y: 3 }, | |
|
102 | XyPoint { x: 3; y: 3 }, | |||
|
103 | XyPoint { x: 4; y: 2 }, | |||
|
104 | XyPoint { x: 5; y: 0 }, | |||
|
105 | XyPoint { x: 6; y: 2 }, | |||
|
106 | XyPoint { x: 7; y: 1 }, | |||
|
107 | XyPoint { x: 8; y: 2 }, | |||
|
108 | XyPoint { x: 9; y: 1 }, | |||
|
109 | XyPoint { x: 10; y: 3 }, | |||
|
110 | XyPoint { x: 11; y: 3 } | |||
|
111 | ] | |||
|
112 | lowerPoints: [ | |||
|
113 | XyPoint { x: 0; y: 0 }, | |||
|
114 | XyPoint { x: 1; y: 0 }, | |||
|
115 | XyPoint { x: 2; y: 0 }, | |||
|
116 | XyPoint { x: 3; y: 0 }, | |||
|
117 | XyPoint { x: 4; y: 0 }, | |||
|
118 | XyPoint { x: 5; y: 0 }, | |||
|
119 | XyPoint { x: 6; y: 0 }, | |||
|
120 | XyPoint { x: 7; y: 0 }, | |||
|
121 | XyPoint { x: 8; y: 0 }, | |||
|
122 | XyPoint { x: 9; y: 0 }, | |||
|
123 | XyPoint { x: 10; y: 0 }, | |||
|
124 | XyPoint { x: 11; y: 0 } | |||
67 | ] |
|
125 | ] | |
68 | } |
|
126 | } | |
69 | } |
|
127 | } | |
70 | } |
|
128 | } |
@@ -1,54 +1,53 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
23 |
|
23 | |||
24 | Rectangle { |
|
24 | Rectangle { | |
25 | width: parent.width |
|
25 | width: parent.width | |
26 | height: parent.height |
|
26 | height: parent.height | |
27 | property int __viewNumber: 0 |
|
27 | property int __viewNumber: 0 | |
28 |
|
28 | |||
29 | Timer { |
|
29 | Timer { | |
30 | id: timer |
|
30 | id: timer | |
31 | running: true |
|
31 | running: true | |
32 | repeat: true |
|
32 | repeat: true | |
33 | interval: 5000 |
|
33 | interval: 5000 | |
34 |
triggeredOnStart: |
|
34 | triggeredOnStart: false | |
35 | onTriggered: { |
|
35 | onTriggered: { | |
36 | loader.source = "View" + (__viewNumber % 3 + 1) + ".qml"; |
|
|||
37 | __viewNumber++; |
|
36 | __viewNumber++; | |
38 | } |
|
37 | } | |
39 | } |
|
38 | } | |
40 |
|
39 | |||
41 | Loader { |
|
40 | Loader { | |
42 | id: loader |
|
41 | id: loader | |
43 | anchors.fill: parent |
|
42 | anchors.fill: parent | |
|
43 | source: "View" + (__viewNumber % 4 + 1) + ".qml"; | |||
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | MouseArea { |
|
46 | MouseArea { | |
47 | anchors.fill: parent |
|
47 | anchors.fill: parent | |
48 | onClicked: { |
|
48 | onClicked: { | |
49 | timer.restart(); |
|
49 | timer.restart(); | |
50 | loader.source = "View" + (__viewNumber % 3 + 1) + ".qml"; |
|
|||
51 | __viewNumber++; |
|
50 | __viewNumber++; | |
52 | } |
|
51 | } | |
53 | } |
|
52 | } | |
54 | } |
|
53 | } |
@@ -1,9 +1,10 | |||||
1 | <RCC> |
|
1 | <RCC> | |
2 | <qresource prefix="/"> |
|
2 | <qresource prefix="/"> | |
3 | <file>qml/qmlchart/loader.qml</file> |
|
3 | <file>qml/qmlchart/loader.qml</file> | |
4 | <file>qml/qmlchart/main.qml</file> |
|
4 | <file>qml/qmlchart/main.qml</file> | |
5 | <file>qml/qmlchart/View1.qml</file> |
|
5 | <file>qml/qmlchart/View1.qml</file> | |
6 | <file>qml/qmlchart/View2.qml</file> |
|
6 | <file>qml/qmlchart/View2.qml</file> | |
7 | <file>qml/qmlchart/View3.qml</file> |
|
7 | <file>qml/qmlchart/View3.qml</file> | |
|
8 | <file>qml/qmlchart/View4.qml</file> | |||
8 | </qresource> |
|
9 | </qresource> | |
9 | </RCC> |
|
10 | </RCC> |
General Comments 0
You need to be logged in to leave comments.
Login now