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