@@ -0,0 +1,55 | |||
|
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 | ||
|
25 | Flow { | |
|
26 | id: flow | |
|
27 | spacing: 5 | |
|
28 | flow: Flow.TopToBottom | |
|
29 | property variant series | |
|
30 | ||
|
31 | Button { | |
|
32 | text: "color" | |
|
33 | onClicked: series.color = main.nextColor(); | |
|
34 | } | |
|
35 | Button { | |
|
36 | text: "borderColor" | |
|
37 | onClicked: series.borderColor = main.nextColor(); | |
|
38 | } | |
|
39 | Button { | |
|
40 | text: "upper color" | |
|
41 | onClicked: series.upperSeries.color = main.nextColor(); | |
|
42 | } | |
|
43 | Button { | |
|
44 | text: "lower color" | |
|
45 | onClicked: series.lowerSeries.color = main.nextColor(); | |
|
46 | } | |
|
47 | Button { | |
|
48 | text: "upper points visible" | |
|
49 | onClicked: series.upperSeries.pointsVisible = !series.pointsVisible; | |
|
50 | } | |
|
51 | Button { | |
|
52 | text: "lower points visible" | |
|
53 | onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible; | |
|
54 | } | |
|
55 | } |
@@ -0,0 +1,51 | |||
|
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 | ||
|
25 | Flow { | |
|
26 | id: flow | |
|
27 | spacing: 5 | |
|
28 | flow: Flow.TopToBottom | |
|
29 | property variant series | |
|
30 | ||
|
31 | Button { | |
|
32 | text: "color" | |
|
33 | onClicked: series.color = main.nextColor(); | |
|
34 | } | |
|
35 | Button { | |
|
36 | text: "borderColor" | |
|
37 | onClicked: series.borderColor = main.nextColor(); | |
|
38 | } | |
|
39 | Button { | |
|
40 | text: "markerSize +" | |
|
41 | onClicked: series.markerSize += 1.0; | |
|
42 | } | |
|
43 | Button { | |
|
44 | text: "markerSize -" | |
|
45 | onClicked: series.markerSize -= 1.0; | |
|
46 | } | |
|
47 | Button { | |
|
48 | text: "markerShape" | |
|
49 | onClicked: series.markerShape = ((series.markerShape + 1) % 2); | |
|
50 | } | |
|
51 | } |
@@ -1,55 +1,79 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "declarativeareaseries.h" |
|
22 | 22 | #include "declarativechart.h" |
|
23 | 23 | #include "qchart.h" |
|
24 | 24 | #include "qxymodelmapper.h" |
|
25 | 25 | |
|
26 | 26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 27 | |
|
28 | 28 | DeclarativeAreaSeries::DeclarativeAreaSeries(QObject *parent) : |
|
29 | 29 | QAreaSeries(parent) |
|
30 | 30 | { |
|
31 | 31 | } |
|
32 | 32 | |
|
33 | 33 | void DeclarativeAreaSeries::setUpperSeries(DeclarativeLineSeries* series) |
|
34 | 34 | { |
|
35 | 35 | QAreaSeries::setUpperSeries(series); |
|
36 | 36 | } |
|
37 | 37 | |
|
38 | 38 | DeclarativeLineSeries* DeclarativeAreaSeries::upperSeries() const |
|
39 | 39 | { |
|
40 | 40 | return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::upperSeries()); |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 43 | void DeclarativeAreaSeries::setLowerSeries(DeclarativeLineSeries* series) |
|
44 | 44 | { |
|
45 | 45 | QAreaSeries::setLowerSeries(series); |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | DeclarativeLineSeries* DeclarativeAreaSeries::lowerSeries() const |
|
49 | 49 | { |
|
50 | 50 | return qobject_cast<DeclarativeLineSeries *>(QAreaSeries::lowerSeries()); |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | QColor DeclarativeAreaSeries::penColor() const | |
|
54 | { | |
|
55 | return pen().color(); | |
|
56 | } | |
|
57 | ||
|
58 | void DeclarativeAreaSeries::setPenColor(QColor color) | |
|
59 | { | |
|
60 | QPen p = pen(); | |
|
61 | p.setColor(color); | |
|
62 | setPen(p); | |
|
63 | } | |
|
64 | ||
|
65 | QColor DeclarativeAreaSeries::brushColor() const | |
|
66 | { | |
|
67 | return brush().color(); | |
|
68 | } | |
|
69 | ||
|
70 | void DeclarativeAreaSeries::setBrushColor(QColor color) | |
|
71 | { | |
|
72 | QBrush b = brush(); | |
|
73 | b.setColor(color); | |
|
74 | setBrush(b); | |
|
75 | } | |
|
76 | ||
|
53 | 77 | #include "moc_declarativeareaseries.cpp" |
|
54 | 78 | |
|
55 | 79 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,51 +1,52 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef DECLARATIVEAREASERIES_H |
|
22 | 22 | #define DECLARATIVEAREASERIES_H |
|
23 | 23 | |
|
24 | 24 | #include "qchartglobal.h" |
|
25 | 25 | #include "qareaseries.h" |
|
26 | 26 | #include "declarativelineseries.h" |
|
27 | 27 | |
|
28 | 28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 29 | |
|
30 | 30 | class DeclarativeAreaSeries : public QAreaSeries |
|
31 | 31 | { |
|
32 | 32 | Q_OBJECT |
|
33 | 33 | Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries) |
|
34 | 34 | Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries) |
|
35 | Q_PROPERTY(QColor color READ brushColor WRITE setBrushColor) | |
|
36 | Q_PROPERTY(QColor borderColor READ penColor WRITE setPenColor) | |
|
35 | 37 | |
|
36 | 38 | public: |
|
37 | 39 | explicit DeclarativeAreaSeries(QObject *parent = 0); |
|
38 | ||
|
39 | public: | |
|
40 | QXYModelMapper* upperModelMapper() const; | |
|
41 | QXYModelMapper* lowerModelMapper() const; | |
|
42 | public: | |
|
43 | 40 | void setUpperSeries(DeclarativeLineSeries* series); |
|
44 | 41 | DeclarativeLineSeries* upperSeries() const; |
|
45 | 42 | void setLowerSeries(DeclarativeLineSeries* series); |
|
46 | 43 | DeclarativeLineSeries* lowerSeries() const; |
|
44 | QColor penColor() const; | |
|
45 | void setPenColor(QColor color); | |
|
46 | QColor brushColor() const; | |
|
47 | void setBrushColor(QColor color); | |
|
47 | 48 | }; |
|
48 | 49 | |
|
49 | 50 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | 51 | |
|
51 | 52 | #endif // DECLARATIVEAREASERIES_H |
@@ -1,91 +1,90 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | //#include "DeclarativeXySeries.h" |
|
22 | 22 | #include "declarativexyseries.h" |
|
23 | 23 | #include "declarativechart.h" |
|
24 | 24 | #include <QXYSeries> |
|
25 | 25 | #include <QVXYModelMapper> |
|
26 | 26 | #include <QHXYModelMapper> |
|
27 | 27 | #include <QDeclarativeListProperty> |
|
28 | 28 | |
|
29 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 30 | |
|
31 | 31 | DeclarativeXySeries::DeclarativeXySeries() |
|
32 | 32 | { |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | DeclarativeXySeries::~DeclarativeXySeries() |
|
36 | 36 | { |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | void DeclarativeXySeries::classBegin() |
|
40 | 40 | { |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 43 | void DeclarativeXySeries::componentComplete() |
|
44 | 44 | { |
|
45 | 45 | // All the inherited objects must be of type QXYSeries, so it is safe to cast |
|
46 | 46 | QXYSeries *series = reinterpret_cast<QXYSeries *>(this); |
|
47 | 47 | foreach(QObject *child, series->children()) { |
|
48 | 48 | if (qobject_cast<DeclarativeXyPoint *>(child)) { |
|
49 | 49 | // TODO: |
|
50 | 50 | // series->append(qobject_cast<DeclarativeXyPoint *>(child)); |
|
51 | 51 | } else if(qobject_cast<QVXYModelMapper *>(child)) { |
|
52 | 52 | QVXYModelMapper *mapper = qobject_cast<QVXYModelMapper *>(child); |
|
53 | 53 | mapper->setSeries(series); |
|
54 | 54 | } else if(qobject_cast<QHXYModelMapper *>(child)) { |
|
55 | 55 | QHXYModelMapper *mapper = qobject_cast<QHXYModelMapper *>(child); |
|
56 | 56 | mapper->setSeries(series); |
|
57 | 57 | } |
|
58 | 58 | } |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | ||
|
62 | 61 | QColor DeclarativeXySeries::penColor() |
|
63 | 62 | { |
|
64 | 63 | // All the inherited objects must be of type QXYSeries, so it is safe to cast |
|
65 | 64 | QXYSeries *series = reinterpret_cast<QXYSeries *>(this); |
|
66 | 65 | return series->pen().color(); |
|
67 | 66 | } |
|
68 | 67 | |
|
69 | 68 | void DeclarativeXySeries::setPenColor(QColor color) |
|
70 | 69 | { |
|
71 | 70 | QXYSeries *series = reinterpret_cast<QXYSeries *>(this); |
|
72 | 71 | QPen pen = series->pen(); |
|
73 | 72 | pen.setColor(color); |
|
74 | 73 | series->setPen(pen); |
|
75 | 74 | } |
|
76 | 75 | |
|
77 | 76 | DeclarativeXyPoint *DeclarativeXySeries::at(int index) |
|
78 | 77 | { |
|
79 | 78 | QXYSeries *series = reinterpret_cast<QXYSeries *>(this); |
|
80 | 79 | if (index < series->count()) { |
|
81 | 80 | QPointF point = series->points().at(index); |
|
82 | 81 | DeclarativeXyPoint *xyPoint = new DeclarativeXyPoint(series); |
|
83 | 82 | xyPoint->setX(point.x()); |
|
84 | 83 | xyPoint->setY(point.y()); |
|
85 | 84 | return xyPoint; |
|
86 | 85 | } |
|
87 | 86 | return 0; |
|
88 | 87 | } |
|
89 | 88 | |
|
90 | 89 | |
|
91 | 90 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,71 +1,72 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef QAREASERIES_H |
|
22 | 22 | #define QAREASERIES_H |
|
23 | 23 | |
|
24 | 24 | #include <qchartglobal.h> |
|
25 | 25 | #include <qabstractseries.h> |
|
26 | 26 | #include <QPen> |
|
27 | 27 | #include <QBrush> |
|
28 | 28 | |
|
29 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 30 | class QLineSeries; |
|
31 | 31 | class QAreaSeriesPrivate; |
|
32 | 32 | |
|
33 | 33 | class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QAbstractSeries |
|
34 | 34 | { |
|
35 | 35 | Q_OBJECT |
|
36 | ||
|
36 | 37 | public: |
|
37 | 38 | explicit QAreaSeries(QObject *parent = 0); |
|
38 | 39 | explicit QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0); |
|
39 | 40 | ~QAreaSeries(); |
|
40 | 41 | |
|
41 | 42 | public: |
|
42 | 43 | QAbstractSeries::SeriesType type() const; |
|
43 | 44 | |
|
44 | 45 | void setUpperSeries(QLineSeries* series); |
|
45 | 46 | QLineSeries* upperSeries() const; |
|
46 | 47 | void setLowerSeries(QLineSeries* series); |
|
47 | 48 | QLineSeries* lowerSeries() const; |
|
48 | 49 | |
|
49 | 50 | void setPen(const QPen &pen); |
|
50 | 51 | QPen pen() const; |
|
51 | 52 | |
|
52 | 53 | void setBrush(const QBrush &brush); |
|
53 | 54 | QBrush brush() const; |
|
54 | 55 | |
|
55 | 56 | void setPointsVisible(bool visible = true); |
|
56 | 57 | bool pointsVisible() const; |
|
57 | 58 | |
|
58 | 59 | Q_SIGNALS: |
|
59 | 60 | void clicked(const QPointF &point); |
|
60 | 61 | void selected(); |
|
61 | 62 | |
|
62 | 63 | private: |
|
63 | 64 | Q_DECLARE_PRIVATE(QAreaSeries); |
|
64 | 65 | Q_DISABLE_COPY(QAreaSeries); |
|
65 | 66 | friend class AreaLegendMarker; |
|
66 | 67 | friend class AreaChartItem; |
|
67 | 68 | }; |
|
68 | 69 | |
|
69 | 70 | QTCOMMERCIALCHART_END_NAMESPACE |
|
70 | 71 | |
|
71 | 72 | #endif |
@@ -1,84 +1,86 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef BARSERIES_H |
|
22 | 22 | #define BARSERIES_H |
|
23 | 23 | |
|
24 | 24 | #include <qabstractseries.h> |
|
25 | 25 | #include <QStringList> |
|
26 | 26 | |
|
27 | 27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | 28 | |
|
29 | 29 | typedef QStringList QBarCategories; |
|
30 | 30 | |
|
31 | 31 | class QBarSet; |
|
32 | 32 | class BarCategory; |
|
33 | 33 | class QBarSeriesPrivate; |
|
34 | 34 | |
|
35 | 35 | // Container for series |
|
36 | 36 | class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractSeries |
|
37 | 37 | { |
|
38 | 38 | Q_OBJECT |
|
39 | Q_PROPERTY(qreal barMargin READ barMargin WRITE setBarMargin) | |
|
39 | 40 | Q_PROPERTY(int count READ barsetCount) // TODO: categoryCount to be removed |
|
41 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible) | |
|
40 | 42 | Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible) |
|
41 | 43 | |
|
42 | 44 | public: |
|
43 | 45 | explicit QBarSeries(QObject *parent = 0); |
|
44 | 46 | virtual ~QBarSeries(); |
|
45 | 47 | |
|
46 | 48 | QAbstractSeries::SeriesType type() const; |
|
47 | 49 | void setCategories(QBarCategories categories); |
|
48 | 50 | |
|
49 | 51 | void setBarMargin(qreal margin); |
|
50 | 52 | qreal barMargin() const; |
|
51 | 53 | |
|
52 | 54 | bool append(QBarSet *set); |
|
53 | 55 | bool remove(QBarSet *set); |
|
54 | 56 | bool append(QList<QBarSet* > sets); |
|
55 | 57 | bool remove(QList<QBarSet* > sets); |
|
56 | 58 | int barsetCount() const; |
|
57 | 59 | int categoryCount() const; |
|
58 | 60 | QList<QBarSet*> barSets() const; |
|
59 | 61 | QBarCategories categories() const; |
|
60 | 62 | void clear(); |
|
61 | 63 | |
|
62 | 64 | void setVisible(bool visible = true); |
|
63 | 65 | bool isVisible() const; |
|
64 | 66 | void setLabelsVisible(bool visible = true); |
|
65 | 67 | bool isLabelsVisible() const; |
|
66 | 68 | |
|
67 | 69 | protected: |
|
68 | 70 | explicit QBarSeries(QBarSeriesPrivate &d,QObject *parent = 0); |
|
69 | 71 | |
|
70 | 72 | Q_SIGNALS: |
|
71 | 73 | void clicked(QBarSet *barset, QString category); |
|
72 | 74 | void hovered(QBarSet* barset, bool status); |
|
73 | 75 | |
|
74 | 76 | protected: |
|
75 | 77 | Q_DECLARE_PRIVATE(QBarSeries) |
|
76 | 78 | friend class BarChartItem; |
|
77 | 79 | friend class PercentBarChartItem; |
|
78 | 80 | friend class StackedBarChartItem; |
|
79 | 81 | friend class GroupedBarChartItem; |
|
80 | 82 | }; |
|
81 | 83 | |
|
82 | 84 | QTCOMMERCIALCHART_END_NAMESPACE |
|
83 | 85 | |
|
84 | 86 | #endif // BARSERIES_H |
@@ -1,87 +1,91 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef QBARSET_H |
|
22 | 22 | #define QBARSET_H |
|
23 | 23 | |
|
24 | 24 | #include <qchartglobal.h> |
|
25 | 25 | #include <QPen> |
|
26 | 26 | #include <QBrush> |
|
27 | 27 | #include <QFont> |
|
28 | 28 | |
|
29 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 30 | class QBarSetPrivate; |
|
31 | 31 | |
|
32 | 32 | class QTCOMMERCIALCHART_EXPORT QBarSet : public QObject |
|
33 | 33 | { |
|
34 | 34 | Q_OBJECT |
|
35 | 35 | Q_PROPERTY(QString name READ name WRITE setName) |
|
36 | Q_PROPERTY(QPen pen READ pen WRITE setPen) | |
|
37 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush) | |
|
38 | Q_PROPERTY(QBrush labelBrush READ labelBrush WRITE setLabelBrush) | |
|
39 | Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont) | |
|
36 | 40 | |
|
37 | 41 | public: |
|
38 | 42 | explicit QBarSet(const QString name, QObject *parent = 0); |
|
39 | 43 | virtual ~QBarSet(); |
|
40 | 44 | |
|
41 | 45 | void setName(const QString name); |
|
42 | 46 | QString name() const; |
|
43 | 47 | |
|
44 | 48 | void append(const QPointF value); |
|
45 | 49 | void append(const QList<QPointF> values); |
|
46 | 50 | void append(const qreal value); |
|
47 | 51 | void append(const QList<qreal> values); |
|
48 | 52 | |
|
49 | 53 | QBarSet& operator << (const qreal &value); |
|
50 | 54 | QBarSet& operator << (const QPointF &value); |
|
51 | 55 | |
|
52 | 56 | void insert(const int index, const qreal value); |
|
53 | 57 | void remove(const int index); |
|
54 | 58 | void replace(const int index, const qreal value); |
|
55 | 59 | QPointF at(const int index) const; |
|
56 | 60 | QPointF operator [] (const int index) const; |
|
57 | 61 | int count() const; |
|
58 | 62 | qreal sum() const; |
|
59 | 63 | |
|
60 | 64 | void setPen(const QPen &pen); |
|
61 | 65 | QPen pen() const; |
|
62 | 66 | |
|
63 | 67 | void setBrush(const QBrush &brush); |
|
64 | 68 | QBrush brush() const; |
|
65 | 69 | |
|
66 | 70 | void setLabelBrush(const QBrush &brush); |
|
67 | 71 | QBrush labelBrush() const; |
|
68 | 72 | |
|
69 | 73 | void setLabelFont(const QFont &font); |
|
70 | 74 | QFont labelFont() const; |
|
71 | 75 | |
|
72 | 76 | //Q_SIGNALS: |
|
73 | 77 | // void clicked(QString category); |
|
74 | 78 | // void hovered(bool status); |
|
75 | 79 | |
|
76 | 80 | private: |
|
77 | 81 | QScopedPointer<QBarSetPrivate> d_ptr; |
|
78 | 82 | Q_DISABLE_COPY(QBarSet) |
|
79 | 83 | friend class QBarSeries; |
|
80 | 84 | friend class BarLegendMarker; |
|
81 | 85 | friend class BarChartItem; |
|
82 | 86 | friend class QBarSeriesPrivate; |
|
83 | 87 | }; |
|
84 | 88 | |
|
85 | 89 | QTCOMMERCIALCHART_END_NAMESPACE |
|
86 | 90 | |
|
87 | 91 | #endif // QBARSET_H |
@@ -1,87 +1,88 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef QXYSERIES_H |
|
22 | 22 | #define QXYSERIES_H |
|
23 | 23 | |
|
24 | 24 | #include <qchartglobal.h> |
|
25 | 25 | #include <qabstractseries.h> |
|
26 | 26 | #include <QPen> |
|
27 | 27 | #include <QBrush> |
|
28 | 28 | |
|
29 | 29 | class QModelIndex; |
|
30 | 30 | |
|
31 | 31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | 32 | |
|
33 | 33 | class QXYSeriesPrivate; |
|
34 | 34 | class QXYModelMapper; |
|
35 | 35 | |
|
36 | 36 | class QTCOMMERCIALCHART_EXPORT QXYSeries : public QAbstractSeries |
|
37 | 37 | { |
|
38 | 38 | Q_OBJECT |
|
39 | 39 | Q_PROPERTY(bool pointsVisible READ pointsVisible WRITE setPointsVisible) |
|
40 | Q_PROPERTY(int count READ count) | |
|
40 | 41 | |
|
41 | 42 | protected: |
|
42 | 43 | explicit QXYSeries(QXYSeriesPrivate &d,QObject *parent = 0); |
|
43 | 44 | |
|
44 | 45 | public: |
|
45 | 46 | ~QXYSeries(); |
|
46 | 47 | void append(qreal x, qreal y); |
|
47 | 48 | void append(const QPointF &point); |
|
48 | 49 | void append(const QList<QPointF> &points); |
|
49 | 50 | void replace(qreal oldX,qreal oldY,qreal newX,qreal newY); |
|
50 | 51 | void replace(const QPointF &oldPoint,const QPointF &newPoint); |
|
51 | 52 | void remove(qreal x, qreal y); |
|
52 | 53 | void remove(const QPointF &point); |
|
53 | 54 | void removeAll(); |
|
54 | 55 | void insert(int index, const QPointF &point); |
|
55 | 56 | void clear(); |
|
56 | 57 | |
|
57 | 58 | int count() const; |
|
58 | 59 | QList<QPointF> points() const; |
|
59 | 60 | |
|
60 | 61 | QXYSeries& operator << (const QPointF &point); |
|
61 | 62 | QXYSeries& operator << (const QList<QPointF> &points); |
|
62 | 63 | |
|
63 | 64 | void setPen(const QPen &pen); |
|
64 | 65 | QPen pen() const; |
|
65 | 66 | |
|
66 | 67 | void setBrush(const QBrush &brush); |
|
67 | 68 | QBrush brush() const; |
|
68 | 69 | |
|
69 | 70 | void setPointsVisible(bool visible = true); |
|
70 | 71 | bool pointsVisible() const; |
|
71 | 72 | |
|
72 | 73 | Q_SIGNALS: |
|
73 | 74 | void clicked(const QPointF &point); |
|
74 | 75 | void pointReplaced(int index); |
|
75 | 76 | void pointRemoved(int index); |
|
76 | 77 | void pointAdded(int index); |
|
77 | 78 | |
|
78 | 79 | private: |
|
79 | 80 | Q_DECLARE_PRIVATE(QXYSeries) |
|
80 | 81 | Q_DISABLE_COPY(QXYSeries) |
|
81 | 82 | friend class XYLegendMarker; |
|
82 | 83 | friend class XYChart; |
|
83 | 84 | }; |
|
84 | 85 | |
|
85 | 86 | QTCOMMERCIALCHART_END_NAMESPACE |
|
86 | 87 | |
|
87 | 88 | #endif |
@@ -1,45 +1,66 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | import QtCommercial.Chart 1.0 |
|
23 | 23 | |
|
24 | 24 | Flow { |
|
25 | 25 | id: flow |
|
26 | 26 | spacing: 5 |
|
27 | flow: Flow.TopToBottom | |
|
27 | 28 | property variant series |
|
28 | 29 | |
|
29 | 30 | Button { |
|
30 | 31 | text: "set 1 color" |
|
31 | 32 | onClicked: series.at(0).color = main.nextColor(); |
|
32 | 33 | } |
|
33 | 34 | Button { |
|
34 | 35 | text: "set 1 border color" |
|
35 | 36 | onClicked: series.at(0).borderColor = main.nextColor(); |
|
36 | 37 | } |
|
37 | 38 | Button { |
|
38 | 39 | text: "set 1 label color" |
|
39 | 40 | onClicked: series.at(0).labelColor = main.nextColor(); |
|
40 | 41 | } |
|
41 | 42 | Button { |
|
43 | text: "visible" | |
|
44 | onClicked: series.visible = !series.visible; | |
|
45 | } | |
|
46 | Button { | |
|
42 | 47 | text: "labels visible" |
|
43 | 48 | onClicked: series.labelsVisible = !series.labelsVisible; |
|
44 | 49 | } |
|
50 | Button { | |
|
51 | text: "bar margin +" | |
|
52 | onClicked: series.barMargin += 0.1; | |
|
53 | } | |
|
54 | Button { | |
|
55 | text: "bar margin -" | |
|
56 | onClicked: series.barMargin -= 0.1; | |
|
57 | } | |
|
58 | Button { | |
|
59 | text: "set 1 font size +" | |
|
60 | onClicked: series.at(0).labelFont.pixelSize += 1; | |
|
61 | } | |
|
62 | Button { | |
|
63 | text: "set 1 font size -" | |
|
64 | onClicked: series.at(0).labelFont.pixelSize -= 1; | |
|
65 | } | |
|
45 | 66 | } |
@@ -1,69 +1,69 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | |
|
23 | 23 | Rectangle { |
|
24 | 24 | id: button |
|
25 |
height: |
|
|
26 |
width: 1 |
|
|
25 | height: 25 | |
|
26 | width: 110 | |
|
27 | 27 | color: "#afafaf" |
|
28 | 28 | radius: 5 |
|
29 | 29 | |
|
30 | 30 | property string text: "button" |
|
31 | 31 | signal clicked |
|
32 | 32 | |
|
33 | 33 | Text { |
|
34 | 34 | id: buttonText |
|
35 | 35 | anchors.centerIn: parent |
|
36 | 36 | text: button.text |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | MouseArea { |
|
40 | 40 | anchors.fill: parent |
|
41 | 41 | onClicked: { |
|
42 | 42 | button.clicked(); |
|
43 | 43 | } |
|
44 | 44 | onPressedChanged: { |
|
45 | 45 | if (pressed) { |
|
46 | 46 | button.color = "#efefef"; |
|
47 | 47 | } else { |
|
48 | 48 | button.color = "#afafaf"; |
|
49 | 49 | } |
|
50 | 50 | } |
|
51 | 51 | onPressAndHold: { |
|
52 | 52 | repeatTimer.start(); |
|
53 | 53 | } |
|
54 | 54 | onReleased: { |
|
55 | 55 | repeatTimer.stop(); |
|
56 | 56 | } |
|
57 | 57 | } |
|
58 | 58 | |
|
59 | 59 | Timer { |
|
60 | 60 | id: repeatTimer |
|
61 | 61 | interval: 200 |
|
62 | 62 | repeat: true |
|
63 | 63 | triggeredOnStart: false |
|
64 | 64 | running: false |
|
65 | 65 | onTriggered: { |
|
66 | 66 | button.clicked(); |
|
67 | 67 | } |
|
68 | 68 | } |
|
69 | 69 | } |
@@ -1,38 +1,39 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | import QtCommercial.Chart 1.0 |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 | Flow { |
|
26 | 26 | id: flow |
|
27 | 27 | spacing: 5 |
|
28 | flow: Flow.TopToBottom | |
|
28 | 29 | property variant series |
|
29 | 30 | |
|
30 | 31 | Button { |
|
31 | 32 | text: "color" |
|
32 | 33 | onClicked: series.color = main.nextColor(); |
|
33 | 34 | } |
|
34 | 35 | Button { |
|
35 | 36 | text: "points visible" |
|
36 | 37 | onClicked: series.pointsVisible = !series.pointsVisible |
|
37 | 38 | } |
|
38 | 39 | } |
@@ -1,57 +1,114 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | import QtCommercial.Chart 1.0 |
|
23 | 23 | |
|
24 | 24 | Flow { |
|
25 | 25 | id: flow |
|
26 | 26 | spacing: 5 |
|
27 | flow: Flow.TopToBottom | |
|
27 | 28 | property variant series |
|
28 | 29 | |
|
29 | 30 | Button { |
|
30 | 31 | text: "slice color" |
|
31 | 32 | onClicked: series.at(0).color = main.nextColor(); |
|
32 | 33 | } |
|
33 | 34 | Button { |
|
34 | 35 | text: "slice border color" |
|
35 | 36 | onClicked: series.at(0).borderColor = main.nextColor(); |
|
36 | 37 | } |
|
37 | 38 | Button { |
|
38 | 39 | text: "slice border width +" |
|
39 | 40 | onClicked: series.at(0).borderWidth++; |
|
40 | 41 | } |
|
41 | 42 | Button { |
|
42 | 43 | text: "slice border width -" |
|
43 | 44 | onClicked: series.at(0).borderWidth--; |
|
44 | 45 | } |
|
45 | 46 | Button { |
|
46 | 47 | text: "slice label visible" |
|
47 | 48 | onClicked: series.at(0).labelVisible = !series.at(0).labelVisible; |
|
48 | 49 | } |
|
49 | 50 | Button { |
|
51 | text: "slice label arm len +" | |
|
52 | onClicked: series.at(0).labelArmLengthFactor += 0.1; | |
|
53 | } | |
|
54 | Button { | |
|
55 | text: "slice label arm len -" | |
|
56 | onClicked: series.at(0).labelArmLengthFactor -= 0.1; | |
|
57 | } | |
|
58 | Button { | |
|
50 | 59 | text: "slice label color" |
|
51 | 60 | onClicked: series.at(0).labelColor = main.nextColor(); |
|
52 | 61 | } |
|
53 | 62 | Button { |
|
54 | 63 | text: "slice exploded" |
|
55 | 64 | onClicked: series.at(0).exploded = !series.at(0).exploded; |
|
56 | 65 | } |
|
66 | Button { | |
|
67 | text: "slice explode dist +" | |
|
68 | onClicked: series.at(0).explodeDistanceFactor += 0.1; | |
|
69 | } | |
|
70 | Button { | |
|
71 | text: "slice explode dist -" | |
|
72 | onClicked: series.at(0).explodeDistanceFactor -= 0.1; | |
|
73 | } | |
|
74 | Button { | |
|
75 | text: "series hpos +" | |
|
76 | onClicked: series.horizontalPosition += 0.1; | |
|
77 | } | |
|
78 | Button { | |
|
79 | text: "series hpos -" | |
|
80 | onClicked: series.horizontalPosition -= 0.1; | |
|
81 | } | |
|
82 | Button { | |
|
83 | text: "series vpos +" | |
|
84 | onClicked: series.verticalPosition += 0.1; | |
|
85 | } | |
|
86 | Button { | |
|
87 | text: "series vpos -" | |
|
88 | onClicked: series.verticalPosition -= 0.1; | |
|
89 | } | |
|
90 | Button { | |
|
91 | text: "series size +" | |
|
92 | onClicked: series.size += 0.1; | |
|
93 | } | |
|
94 | Button { | |
|
95 | text: "series size -" | |
|
96 | onClicked: series.size -= 0.1; | |
|
97 | } | |
|
98 | Button { | |
|
99 | text: "series start angle +" | |
|
100 | onClicked: series.startAngle += 0.1; | |
|
101 | } | |
|
102 | Button { | |
|
103 | text: "series start angle -" | |
|
104 | onClicked: series.startAngle -= 0.1; | |
|
105 | } | |
|
106 | Button { | |
|
107 | text: "series end angle +" | |
|
108 | onClicked: series.endAngle += 0.1; | |
|
109 | } | |
|
110 | Button { | |
|
111 | text: "series end angle -" | |
|
112 | onClicked: series.endAngle -= 0.1; | |
|
113 | } | |
|
57 | 114 | } |
@@ -1,145 +1,136 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | import QtQuick 1.0 |
|
22 | 22 | import QtCommercial.Chart 1.0 |
|
23 | 23 | |
|
24 | 24 | Rectangle { |
|
25 | 25 | id: main |
|
26 | 26 | width: parent.width |
|
27 | 27 | height: parent.height |
|
28 | 28 | property int viewNumber: 0 |
|
29 | 29 | property int viewCount: 6 |
|
30 | 30 | property variant colors: ["#637D74", "#403D3A", "#8C3B3B", "#AB6937", "#D4A960"] |
|
31 | 31 | property int colorIndex: 0 |
|
32 | 32 | |
|
33 | 33 | function nextColor() { |
|
34 | 34 | colorIndex++; |
|
35 | 35 | console.log("color: " + colors[colorIndex % colors.length]); |
|
36 | 36 | return colors[colorIndex % colors.length]; |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | onViewNumberChanged: { |
|
40 | 40 | if (viewNumber == 0) { |
|
41 | 41 | chartLoader.source = "PieChart.qml"; |
|
42 | 42 | editorLoader.source = "PieEditor.qml"; |
|
43 | 43 | } else if (viewNumber == 1) { |
|
44 | 44 | chartLoader.source = "LineChart.qml"; |
|
45 | 45 | editorLoader.source = "LineEditor.qml"; |
|
46 | 46 | } else if (viewNumber == 2) { |
|
47 | 47 | chartLoader.source = "SplineChart.qml"; |
|
48 | 48 | editorLoader.source = "LineEditor.qml"; |
|
49 | 49 | } else if (viewNumber == 3) { |
|
50 | 50 | chartLoader.source = "ScatterChart.qml"; |
|
51 |
editorLoader.source = " |
|
|
51 | editorLoader.source = "ScatterEditor.qml"; | |
|
52 | 52 |
|
|
53 | 53 | chartLoader.source = "AreaChart.qml"; |
|
54 |
editorLoader.source = " |
|
|
54 | editorLoader.source = "AreaEditor.qml"; | |
|
55 | 55 |
|
|
56 | 56 | chartLoader.source = "BarChart.qml"; |
|
57 | 57 | editorLoader.source = "BarEditor.qml"; |
|
58 | 58 | } else { |
|
59 | 59 | console.log("Illegal view number"); |
|
60 | 60 | } |
|
61 | 61 | } |
|
62 | 62 | |
|
63 | 63 | Row { |
|
64 | 64 | anchors.top: parent.top |
|
65 | 65 | anchors.bottom: buttonRow.top |
|
66 | 66 | anchors.left: parent.left |
|
67 | 67 | anchors.right: parent.right |
|
68 | 68 | |
|
69 | 69 | Loader { |
|
70 | 70 | id: chartLoader |
|
71 | 71 | width: main.width - editorLoader.width |
|
72 | 72 | height: parent.height |
|
73 | 73 | source: "PieChart.qml" |
|
74 | 74 | onStatusChanged: { |
|
75 | 75 | console.log("chartLoader.status: " + status + " " + source); |
|
76 | 76 | if (status == Loader.Ready && editorLoader.status == Loader.Ready) |
|
77 | 77 | editorLoader.item.series = chartLoader.item.series; |
|
78 | 78 | } |
|
79 | 79 | } |
|
80 | 80 | |
|
81 | 81 | Loader { |
|
82 | 82 | id: editorLoader |
|
83 |
width: |
|
|
83 | width: 230 | |
|
84 | 84 | height: parent.height |
|
85 | 85 | source: "PieEditor.qml" |
|
86 | 86 | onStatusChanged: { |
|
87 | 87 | console.log("editorLoader.status: " + status + " " + source); |
|
88 | 88 | if (status == Loader.Ready && chartLoader.status == Loader.Ready) |
|
89 | 89 | editorLoader.item.series = chartLoader.item.series; |
|
90 | 90 | } |
|
91 | 91 | } |
|
92 | 92 | } |
|
93 | 93 | |
|
94 | // Loader { | |
|
95 | // id: loader | |
|
96 | // anchors.top: parent.top | |
|
97 | // anchors.bottom: buttonRow.top | |
|
98 | // anchors.left: parent.left | |
|
99 | // anchors.right: parent.right | |
|
100 | // source: "View" + viewNumber + ".qml"; | |
|
101 | // } | |
|
102 | ||
|
103 | 94 | Row { |
|
104 | 95 | id: buttonRow |
|
105 | 96 | height: 100 |
|
106 | 97 | anchors.bottom: parent.bottom |
|
107 | 98 | anchors.bottomMargin: 10 |
|
108 | 99 | anchors.horizontalCenter: parent.horizontalCenter |
|
109 | 100 | spacing: 10 |
|
110 | 101 | |
|
111 | 102 | Rectangle { |
|
112 | 103 | height: buttonRow.height |
|
113 | 104 | width: 100 |
|
114 | 105 | color: "#afafaf" |
|
115 | 106 | radius: 5 |
|
116 | 107 | Text { |
|
117 | 108 | anchors.centerIn: parent |
|
118 | 109 | text: "previous" |
|
119 | 110 | } |
|
120 | 111 | MouseArea { |
|
121 | 112 | anchors.fill: parent |
|
122 | 113 | onClicked: { |
|
123 | 114 | viewNumber = (viewNumber + viewCount - 1) % viewCount; |
|
124 | 115 | } |
|
125 | 116 | } |
|
126 | 117 | } |
|
127 | 118 | |
|
128 | 119 | Rectangle { |
|
129 | 120 | height: buttonRow.height |
|
130 | 121 | width: 100 |
|
131 | 122 | color: "#afafaf" |
|
132 | 123 | radius: 5 |
|
133 | 124 | Text { |
|
134 | 125 | anchors.centerIn: parent |
|
135 | 126 | text: "next" |
|
136 | 127 | } |
|
137 | 128 | MouseArea { |
|
138 | 129 | anchors.fill: parent |
|
139 | 130 | onClicked: { |
|
140 | 131 | viewNumber = (viewNumber + 1) % viewCount; |
|
141 | 132 | } |
|
142 | 133 | } |
|
143 | 134 | } |
|
144 | 135 | } |
|
145 | 136 | } |
@@ -1,16 +1,18 | |||
|
1 | 1 | <RCC> |
|
2 | 2 | <qresource prefix="/"> |
|
3 | 3 | <file>qml/qmlchartproperties/loader.qml</file> |
|
4 | 4 | <file>qml/qmlchartproperties/main.qml</file> |
|
5 | 5 | <file>qml/qmlchartproperties/Button.qml</file> |
|
6 | 6 | <file>qml/qmlchartproperties/PieChart.qml</file> |
|
7 | 7 | <file>qml/qmlchartproperties/PieEditor.qml</file> |
|
8 | 8 | <file>qml/qmlchartproperties/LineChart.qml</file> |
|
9 | 9 | <file>qml/qmlchartproperties/LineEditor.qml</file> |
|
10 | 10 | <file>qml/qmlchartproperties/SplineChart.qml</file> |
|
11 | 11 | <file>qml/qmlchartproperties/ScatterChart.qml</file> |
|
12 | 12 | <file>qml/qmlchartproperties/AreaChart.qml</file> |
|
13 | 13 | <file>qml/qmlchartproperties/BarChart.qml</file> |
|
14 | 14 | <file>qml/qmlchartproperties/BarEditor.qml</file> |
|
15 | <file>qml/qmlchartproperties/ScatterEditor.qml</file> | |
|
16 | <file>qml/qmlchartproperties/AreaEditor.qml</file> | |
|
15 | 17 | </qresource> |
|
16 | 18 | </RCC> |
General Comments 0
You need to be logged in to leave comments.
Login now