##// END OF EJS Templates
QML api pie slice added/removed signals
Tero Ahola -
r1503:873325dbfe57
parent child
Show More
@@ -1,96 +1,123
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 "declarativepieseries.h"
21 #include "declarativepieseries.h"
22 #include "declarativechart.h"
22 #include "declarativechart.h"
23 #include "qchart.h"
23 #include "qchart.h"
24 #include <qdeclarativelist.h>
24 #include <qdeclarativelist.h>
25 #include <QVPieModelMapper>
25 #include <QVPieModelMapper>
26 #include <QHPieModelMapper>
26 #include <QHPieModelMapper>
27
27
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29
29
30 DeclarativePieSeries::DeclarativePieSeries(QObject *parent) :
30 DeclarativePieSeries::DeclarativePieSeries(QObject *parent) :
31 QPieSeries(parent)
31 QPieSeries(parent)
32 {
32 {
33 connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>)));
34 connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>)));
33 }
35 }
34
36
35 void DeclarativePieSeries::classBegin()
37 void DeclarativePieSeries::classBegin()
36 {
38 {
37 }
39 }
38
40
39 void DeclarativePieSeries::componentComplete()
41 void DeclarativePieSeries::componentComplete()
40 {
42 {
41 foreach(QObject *child, children()) {
43 foreach(QObject *child, children()) {
42 if (qobject_cast<QPieSlice *>(child)) {
44 if (qobject_cast<QPieSlice *>(child)) {
43 QPieSeries::append(qobject_cast<QPieSlice *>(child));
45 QPieSeries::append(qobject_cast<QPieSlice *>(child));
44 } else if(qobject_cast<QVPieModelMapper *>(child)) {
46 } else if(qobject_cast<QVPieModelMapper *>(child)) {
45 QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child);
47 QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child);
46 mapper->setSeries(this);
48 mapper->setSeries(this);
47 } else if(qobject_cast<QHPieModelMapper *>(child)) {
49 } else if(qobject_cast<QHPieModelMapper *>(child)) {
48 QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child);
50 QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child);
49 mapper->setSeries(this);
51 mapper->setSeries(this);
50 }
52 }
51 }
53 }
52 }
54 }
53
55
54 QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren()
56 QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren()
55 {
57 {
56 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren);
58 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren);
57 }
59 }
58
60
59 void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
61 void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element)
60 {
62 {
61 // Empty implementation; the children are parsed in componentComplete instead
63 // Empty implementation; the children are parsed in componentComplete instead
62 Q_UNUSED(list);
64 Q_UNUSED(list);
63 Q_UNUSED(element);
65 Q_UNUSED(element);
64 }
66 }
65
67
66 QPieSlice *DeclarativePieSeries::at(int index)
68 QPieSlice *DeclarativePieSeries::at(int index)
67 {
69 {
68 QList<QPieSlice*> sliceList = slices();
70 QList<QPieSlice*> sliceList = slices();
69 if (index < sliceList.count())
71 if (index >= 0 && index < sliceList.count())
70 return sliceList[index];
72 return sliceList[index];
71
73
72 return 0;
74 return 0;
73 }
75 }
74
76
75 QPieSlice* DeclarativePieSeries::find(QString label)
77 QPieSlice* DeclarativePieSeries::find(QString label)
76 {
78 {
77 foreach (QPieSlice *slice, slices()) {
79 foreach (QPieSlice *slice, slices()) {
78 if (slice->label() == label)
80 if (slice->label() == label)
79 return slice;
81 return slice;
80 }
82 }
81 return 0;
83 return 0;
82 }
84 }
83
85
84 QPieSlice* DeclarativePieSeries::append(QString label, qreal value)
86 QPieSlice* DeclarativePieSeries::append(QString label, qreal value)
85 {
87 {
86 // TODO: parameter order is wrong, switch it:
88 // TODO: parameter order is wrong, switch it:
87 QPieSlice *slice = new QPieSlice(this);
89 QPieSlice *slice = new QPieSlice(this);
88 slice->setLabel(label);
90 slice->setLabel(label);
89 slice->setValue(value);
91 slice->setValue(value);
90 QPieSeries::append(slice);
92 QPieSeries::append(slice);
91 return slice;
93 return slice;
92 }
94 }
93
95
96 bool DeclarativePieSeries::remove(int index)
97 {
98 QPieSlice *slice = at(index);
99 if (slice)
100 return QPieSeries::remove(slice);
101 return false;
102 }
103
104 void DeclarativePieSeries::clear()
105 {
106 QPieSeries::clear();
107 }
108
109 void DeclarativePieSeries::handleAdded(QList<QPieSlice*> slices)
110 {
111 foreach(QPieSlice *slice, slices)
112 emit sliceAdded(slice);
113 }
114
115 void DeclarativePieSeries::handleRemoved(QList<QPieSlice*> slices)
116 {
117 foreach(QPieSlice *slice, slices)
118 emit sliceRemoved(slice);
119 }
120
94 #include "moc_declarativepieseries.cpp"
121 #include "moc_declarativepieseries.cpp"
95
122
96 QTCOMMERCIALCHART_END_NAMESPACE
123 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,59 +1,67
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 DECLARATIVEPIESERIES_H
21 #ifndef DECLARATIVEPIESERIES_H
22 #define DECLARATIVEPIESERIES_H
22 #define DECLARATIVEPIESERIES_H
23
23
24 #include "qchartglobal.h"
24 #include "qchartglobal.h"
25 #include <QPieSlice>
25 #include <QPieSlice>
26 #include <QPieSeries>
26 #include <QPieSeries>
27 #include <QDeclarativeParserStatus>
27 #include <QDeclarativeParserStatus>
28 #include <QDeclarativeListProperty>
28 #include <QDeclarativeListProperty>
29 #include <QAbstractItemModel>
29 #include <QAbstractItemModel>
30
30
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32
32
33 class QChart;
33 class QChart;
34
34
35 class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus
35 class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus
36 {
36 {
37 Q_OBJECT
37 Q_OBJECT
38 Q_INTERFACES(QDeclarativeParserStatus)
38 Q_INTERFACES(QDeclarativeParserStatus)
39 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
39 Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren)
40 Q_CLASSINFO("DefaultProperty", "seriesChildren")
40 Q_CLASSINFO("DefaultProperty", "seriesChildren")
41
41
42 public:
42 public:
43 explicit DeclarativePieSeries(QObject *parent = 0);
43 explicit DeclarativePieSeries(QObject *parent = 0);
44 QDeclarativeListProperty<QObject> seriesChildren();
44 QDeclarativeListProperty<QObject> seriesChildren();
45 Q_INVOKABLE QPieSlice *at(int index);
45 Q_INVOKABLE QPieSlice *at(int index);
46 Q_INVOKABLE QPieSlice *find(QString label);
46 Q_INVOKABLE QPieSlice *find(QString label);
47 Q_INVOKABLE QPieSlice *append(QString label, qreal value);
47 Q_INVOKABLE QPieSlice *append(QString label, qreal value);
48 Q_INVOKABLE bool remove(int index);
49 Q_INVOKABLE void clear();
48
50
49 public:
51 public:
50 void classBegin();
52 void classBegin();
51 void componentComplete();
53 void componentComplete();
52
54
55 Q_SIGNALS:
56 void sliceAdded(QPieSlice* slice);
57 void sliceRemoved(QPieSlice* slice);
58
53 public Q_SLOTS:
59 public Q_SLOTS:
54 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
60 static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element);
61 void handleAdded(QList<QPieSlice*> slices);
62 void handleRemoved(QList<QPieSlice*> slices);
55 };
63 };
56
64
57 QTCOMMERCIALCHART_END_NAMESPACE
65 QTCOMMERCIALCHART_END_NAMESPACE
58
66
59 #endif // DECLARATIVEPIESERIES_H
67 #endif // DECLARATIVEPIESERIES_H
@@ -1,654 +1,660
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 "qpieseries.h"
21 #include "qpieseries.h"
22 #include "qpieseries_p.h"
22 #include "qpieseries_p.h"
23 #include "qpieslice.h"
23 #include "qpieslice.h"
24 #include "qpieslice_p.h"
24 #include "qpieslice_p.h"
25 #include "pieslicedata_p.h"
25 #include "pieslicedata_p.h"
26 #include "chartdataset_p.h"
26 #include "chartdataset_p.h"
27 #include "charttheme_p.h"
27 #include "charttheme_p.h"
28 #include "chartanimator_p.h"
28 #include "chartanimator_p.h"
29 #include "legendmarker_p.h"
29 #include "legendmarker_p.h"
30
30
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
31 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32
32
33 /*!
33 /*!
34 \class QPieSeries
34 \class QPieSeries
35 \brief Pie series API for QtCommercial Charts
35 \brief Pie series API for QtCommercial Charts
36
36
37 The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects.
37 The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects.
38 The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices.
38 The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices.
39 The actual slice size is determined by that relative value.
39 The actual slice size is determined by that relative value.
40
40
41 Pie size and position on the chart is controlled by using relative values which range from 0.0 to 1.0
41 Pie size and position on the chart is controlled by using relative values which range from 0.0 to 1.0
42 These relate to the actual chart rectangle.
42 These relate to the actual chart rectangle.
43
43
44 By default the pie is defined as a full pie but it can also be a partial pie.
44 By default the pie is defined as a full pie but it can also be a partial pie.
45 This can be done by setting a starting angle and angle span to the series.
45 This can be done by setting a starting angle and angle span to the series.
46 Full pie is 360 degrees where 0 is at 12 a'clock.
46 Full pie is 360 degrees where 0 is at 12 a'clock.
47
47
48 See the \l {PieChart Example} {pie chart example} to learn how to create a simple pie chart.
48 See the \l {PieChart Example} {pie chart example} to learn how to create a simple pie chart.
49 \image examples_piechart.png
49 \image examples_piechart.png
50 */
50 */
51 /*!
51 /*!
52 \qmlclass PieSeries QPieSeries
52 \qmlclass PieSeries QPieSeries
53
53
54 The following QML shows how to create a simple pie chart.
54 The following QML shows how to create a simple pie chart.
55 \snippet ../demos/qmlchart/qml/qmlchart/View1.qml 1
55 \snippet ../demos/qmlchart/qml/qmlchart/View1.qml 1
56 \beginfloatleft
56 \beginfloatleft
57 \image demos_qmlchart1.png
57 \image demos_qmlchart1.png
58 \endfloat
58 \endfloat
59 \clearfloat
59 \clearfloat
60 */
60 */
61
61
62 /*!
62 /*!
63 \property QPieSeries::horizontalPosition
63 \property QPieSeries::horizontalPosition
64 \brief Defines the horizontal position of the pie.
64 \brief Defines the horizontal position of the pie.
65 The value is a relative value to the chart rectangle where:
65 The value is a relative value to the chart rectangle where:
66 \list
66 \list
67 \o 0.0 is the absolute left.
67 \o 0.0 is the absolute left.
68 \o 1.0 is the absolute right.
68 \o 1.0 is the absolute right.
69 \endlist
69 \endlist
70 Default value is 0.5 (center).
70 Default value is 0.5 (center).
71 \sa verticalPosition
71 \sa verticalPosition
72 */
72 */
73 /*!
73 /*!
74 \qmlproperty real PieSeries::horizontalPosition
74 \qmlproperty real PieSeries::horizontalPosition
75 Defines the horizontal position of the pie. The value is a relative value to the chart rectangle where:
75 Defines the horizontal position of the pie. The value is a relative value to the chart rectangle where:
76 \list
76 \list
77 \o 0.0 is the absolute left.
77 \o 0.0 is the absolute left.
78 \o 1.0 is the absolute right.
78 \o 1.0 is the absolute right.
79 \endlist
79 \endlist
80 Default value is 0.5 (center).
80 Default value is 0.5 (center).
81 \sa verticalPosition
81 \sa verticalPosition
82 */
82 */
83
83
84 /*!
84 /*!
85 \property QPieSeries::verticalPosition
85 \property QPieSeries::verticalPosition
86 \brief Defines the vertical position of the pie.
86 \brief Defines the vertical position of the pie.
87 The value is a relative value to the chart rectangle where:
87 The value is a relative value to the chart rectangle where:
88 \list
88 \list
89 \o 0.0 is the absolute top.
89 \o 0.0 is the absolute top.
90 \o 1.0 is the absolute bottom.
90 \o 1.0 is the absolute bottom.
91 \endlist
91 \endlist
92 Default value is 0.5 (center).
92 Default value is 0.5 (center).
93 \sa horizontalPosition
93 \sa horizontalPosition
94 */
94 */
95 /*!
95 /*!
96 \qmlproperty real PieSeries::verticalPosition
96 \qmlproperty real PieSeries::verticalPosition
97 Defines the vertical position of the pie. The value is a relative value to the chart rectangle where:
97 Defines the vertical position of the pie. The value is a relative value to the chart rectangle where:
98 \list
98 \list
99 \o 0.0 is the absolute top.
99 \o 0.0 is the absolute top.
100 \o 1.0 is the absolute bottom.
100 \o 1.0 is the absolute bottom.
101 \endlist
101 \endlist
102 Default value is 0.5 (center).
102 Default value is 0.5 (center).
103 \sa horizontalPosition
103 \sa horizontalPosition
104 */
104 */
105
105
106 /*!
106 /*!
107 \property QPieSeries::size
107 \property QPieSeries::size
108 \brief Defines the pie size.
108 \brief Defines the pie size.
109
109
110 The value is a relative value to the chart rectangle where:
110 The value is a relative value to the chart rectangle where:
111
111
112 \list
112 \list
113 \o 0.0 is the minimum size (pie not drawn).
113 \o 0.0 is the minimum size (pie not drawn).
114 \o 1.0 is the maximum size that can fit the chart.
114 \o 1.0 is the maximum size that can fit the chart.
115 \endlist
115 \endlist
116
116
117 Default value is 0.7.
117 Default value is 0.7.
118 */
118 */
119
119
120 /*!
120 /*!
121 \property QPieSeries::startAngle
121 \property QPieSeries::startAngle
122 \brief Defines the starting angle of the pie.
122 \brief Defines the starting angle of the pie.
123
123
124 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
124 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
125
125
126 Default is value is 0.
126 Default is value is 0.
127 */
127 */
128
128
129 /*!
129 /*!
130 \property QPieSeries::endAngle
130 \property QPieSeries::endAngle
131 \brief Defines the ending angle of the pie.
131 \brief Defines the ending angle of the pie.
132
132
133 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
133 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
134
134
135 Default is value is 360.
135 Default is value is 360.
136 */
136 */
137
137
138 /*!
138 /*!
139 \property QPieSeries::count
139 \property QPieSeries::count
140
140
141 Number of slices in the series.
141 Number of slices in the series.
142 */
142 */
143
143
144 /*!
144 /*!
145 \fn void QPieSeries::countChanged()
145 \fn void QPieSeries::countChanged()
146
146
147 Emitted when the slice count has changed.
147 Emitted when the slice count has changed.
148
148
149 \sa count
149 \sa count
150 */
150 */
151
151
152 /*!
152 /*!
153 \property QPieSeries::sum
153 \property QPieSeries::sum
154
154
155 Sum of all slices.
155 Sum of all slices.
156
156
157 The series keeps track of the sum of all slices it holds.
157 The series keeps track of the sum of all slices it holds.
158 */
158 */
159
159
160 /*!
160 /*!
161 \fn void QPieSeries::sumChanged()
161 \fn void QPieSeries::sumChanged()
162
162
163 Emitted when the sum of all slices has changed.
163 Emitted when the sum of all slices has changed.
164
164
165 \sa sum
165 \sa sum
166 */
166 */
167
167
168 /*!
168 /*!
169 \fn void QPieSeries::added(QList<QPieSlice*> slices)
169 \fn void QPieSeries::added(QList<QPieSlice*> slices)
170
170
171 This signal is emitted when \a slices have been added to the series.
171 This signal is emitted when \a slices have been added to the series.
172
172
173 \sa append(), insert()
173 \sa append(), insert()
174 */
174 */
175 /*!
176 \qmlsignal PieSeries::added(PieSlice slice)
177 Emitted when \a slice has been added to the series.
178 */
175
179
176 /*!
180 /*!
177 \fn void QPieSeries::removed(QList<QPieSlice*> slices)
181 \fn void QPieSeries::removed(QList<QPieSlice*> slices)
178
179 This signal is emitted when \a slices have been removed from the series.
182 This signal is emitted when \a slices have been removed from the series.
180
181 \sa remove()
183 \sa remove()
182 */
184 */
185 /*!
186 \qmlsignal PieSeries::removed(PieSlice slice)
187 Emitted when \a slice has been removed from the series.
188 */
183
189
184 /*!
190 /*!
185 \fn void QPieSeries::clicked(QPieSlice* slice)
191 \fn void QPieSeries::clicked(QPieSlice* slice)
186
192
187 This signal is emitted when a \a slice has been clicked.
193 This signal is emitted when a \a slice has been clicked.
188
194
189 \sa QPieSlice::clicked()
195 \sa QPieSlice::clicked()
190 */
196 */
191
197
192 /*!
198 /*!
193 \fn void QPieSeries::hovered(QPieSlice* slice, bool state)
199 \fn void QPieSeries::hovered(QPieSlice* slice, bool state)
194
200
195 This signal is emitted when user has hovered over or away from the \a slice.
201 This signal is emitted when user has hovered over or away from the \a slice.
196
202
197 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
203 \a state is true when user has hovered over the slice and false when hover has moved away from the slice.
198
204
199 \sa QPieSlice::hovered()
205 \sa QPieSlice::hovered()
200 */
206 */
201
207
202 /*!
208 /*!
203 Constructs a series object which is a child of \a parent.
209 Constructs a series object which is a child of \a parent.
204 */
210 */
205 QPieSeries::QPieSeries(QObject *parent) :
211 QPieSeries::QPieSeries(QObject *parent) :
206 QAbstractSeries(*new QPieSeriesPrivate(this),parent)
212 QAbstractSeries(*new QPieSeriesPrivate(this),parent)
207 {
213 {
208
214
209 }
215 }
210
216
211 /*!
217 /*!
212 Destroys the series and its slices.
218 Destroys the series and its slices.
213 */
219 */
214 QPieSeries::~QPieSeries()
220 QPieSeries::~QPieSeries()
215 {
221 {
216 // NOTE: d_prt destroyed by QObject
222 // NOTE: d_prt destroyed by QObject
217 }
223 }
218
224
219 /*!
225 /*!
220 Returns QChartSeries::SeriesTypePie.
226 Returns QChartSeries::SeriesTypePie.
221 */
227 */
222 QAbstractSeries::SeriesType QPieSeries::type() const
228 QAbstractSeries::SeriesType QPieSeries::type() const
223 {
229 {
224 return QAbstractSeries::SeriesTypePie;
230 return QAbstractSeries::SeriesTypePie;
225 }
231 }
226
232
227 /*!
233 /*!
228 Appends a single \a slice to the series.
234 Appends a single \a slice to the series.
229 Slice ownership is passed to the series.
235 Slice ownership is passed to the series.
230
236
231 Returns true if append was succesfull.
237 Returns true if append was succesfull.
232 */
238 */
233 bool QPieSeries::append(QPieSlice* slice)
239 bool QPieSeries::append(QPieSlice* slice)
234 {
240 {
235 return append(QList<QPieSlice*>() << slice);
241 return append(QList<QPieSlice*>() << slice);
236 }
242 }
237
243
238 /*!
244 /*!
239 Appends an array of \a slices to the series.
245 Appends an array of \a slices to the series.
240 Slice ownership is passed to the series.
246 Slice ownership is passed to the series.
241
247
242 Returns true if append was successfull.
248 Returns true if append was successfull.
243 */
249 */
244 bool QPieSeries::append(QList<QPieSlice*> slices)
250 bool QPieSeries::append(QList<QPieSlice*> slices)
245 {
251 {
246 Q_D(QPieSeries);
252 Q_D(QPieSeries);
247
253
248 if (slices.count() == 0)
254 if (slices.count() == 0)
249 return false;
255 return false;
250
256
251 foreach (QPieSlice* s, slices) {
257 foreach (QPieSlice* s, slices) {
252 if (!s || d->m_slices.contains(s))
258 if (!s || d->m_slices.contains(s))
253 return false;
259 return false;
254 if (s->series()) // already added to some series
260 if (s->series()) // already added to some series
255 return false;
261 return false;
256 }
262 }
257
263
258 foreach (QPieSlice* s, slices) {
264 foreach (QPieSlice* s, slices) {
259 s->setParent(this);
265 s->setParent(this);
260 QPieSlicePrivate::fromSlice(s)->m_series = this;
266 QPieSlicePrivate::fromSlice(s)->m_series = this;
261 d->m_slices << s;
267 d->m_slices << s;
262 }
268 }
263
269
264 d->updateDerivativeData();
270 d->updateDerivativeData();
265
271
266 foreach (QPieSlice* s, slices) {
272 foreach (QPieSlice* s, slices) {
267 connect(s, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
273 connect(s, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
268 connect(s, SIGNAL(clicked()), d, SLOT(sliceClicked()));
274 connect(s, SIGNAL(clicked()), d, SLOT(sliceClicked()));
269 connect(s, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
275 connect(s, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
270 }
276 }
271
277
272 emit added(slices);
278 emit added(slices);
273 emit countChanged();
279 emit countChanged();
274
280
275 return true;
281 return true;
276 }
282 }
277
283
278 /*!
284 /*!
279 Appends a single \a slice to the series and returns a reference to the series.
285 Appends a single \a slice to the series and returns a reference to the series.
280 Slice ownership is passed to the series.
286 Slice ownership is passed to the series.
281 */
287 */
282 QPieSeries& QPieSeries::operator << (QPieSlice* slice)
288 QPieSeries& QPieSeries::operator << (QPieSlice* slice)
283 {
289 {
284 append(slice);
290 append(slice);
285 return *this;
291 return *this;
286 }
292 }
287
293
288
294
289 /*!
295 /*!
290 Appends a single slice to the series with give \a value and \a label.
296 Appends a single slice to the series with give \a value and \a label.
291 Slice ownership is passed to the series.
297 Slice ownership is passed to the series.
292 */
298 */
293 QPieSlice* QPieSeries::append(QString label, qreal value)
299 QPieSlice* QPieSeries::append(QString label, qreal value)
294 {
300 {
295 QPieSlice* slice = new QPieSlice(label, value);
301 QPieSlice* slice = new QPieSlice(label, value);
296 append(slice);
302 append(slice);
297 return slice;
303 return slice;
298 }
304 }
299
305
300 /*!
306 /*!
301 Inserts a single \a slice to the series before the slice at \a index position.
307 Inserts a single \a slice to the series before the slice at \a index position.
302 Slice ownership is passed to the series.
308 Slice ownership is passed to the series.
303
309
304 Returns true if insert was successfull.
310 Returns true if insert was successfull.
305 */
311 */
306 bool QPieSeries::insert(int index, QPieSlice* slice)
312 bool QPieSeries::insert(int index, QPieSlice* slice)
307 {
313 {
308 Q_D(QPieSeries);
314 Q_D(QPieSeries);
309
315
310 if (index < 0 || index > d->m_slices.count())
316 if (index < 0 || index > d->m_slices.count())
311 return false;
317 return false;
312
318
313 if (!slice || d->m_slices.contains(slice))
319 if (!slice || d->m_slices.contains(slice))
314 return false;
320 return false;
315
321
316 if (slice->series()) // already added to some series
322 if (slice->series()) // already added to some series
317 return false;
323 return false;
318
324
319 slice->setParent(this);
325 slice->setParent(this);
320 QPieSlicePrivate::fromSlice(slice)->m_series = this;
326 QPieSlicePrivate::fromSlice(slice)->m_series = this;
321 d->m_slices.insert(index, slice);
327 d->m_slices.insert(index, slice);
322
328
323 d->updateDerivativeData();
329 d->updateDerivativeData();
324
330
325 connect(slice, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
331 connect(slice, SIGNAL(valueChanged()), d, SLOT(sliceValueChanged()));
326 connect(slice, SIGNAL(clicked()), d, SLOT(sliceClicked()));
332 connect(slice, SIGNAL(clicked()), d, SLOT(sliceClicked()));
327 connect(slice, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
333 connect(slice, SIGNAL(hovered(bool)), d, SLOT(sliceHovered(bool)));
328
334
329 emit added(QList<QPieSlice*>() << slice);
335 emit added(QList<QPieSlice*>() << slice);
330 emit countChanged();
336 emit countChanged();
331
337
332 return true;
338 return true;
333 }
339 }
334
340
335 /*!
341 /*!
336 Removes a single \a slice from the series and deletes the slice.
342 Removes a single \a slice from the series and deletes the slice.
337
343
338 Do not reference the pointer after this call.
344 Do not reference the pointer after this call.
339
345
340 Returns true if remove was successfull.
346 Returns true if remove was successfull.
341 */
347 */
342 bool QPieSeries::remove(QPieSlice* slice)
348 bool QPieSeries::remove(QPieSlice* slice)
343 {
349 {
344 Q_D(QPieSeries);
350 Q_D(QPieSeries);
345
351
346 if (!d->m_slices.removeOne(slice))
352 if (!d->m_slices.removeOne(slice))
347 return false;
353 return false;
348
354
349 d->updateDerivativeData();
355 d->updateDerivativeData();
350
356
351 emit removed(QList<QPieSlice*>() << slice);
357 emit removed(QList<QPieSlice*>() << slice);
352 emit countChanged();
358 emit countChanged();
353
359
354 delete slice;
360 delete slice;
355 slice = 0;
361 slice = 0;
356
362
357 return true;
363 return true;
358 }
364 }
359
365
360 /*!
366 /*!
361 Clears all slices from the series.
367 Clears all slices from the series.
362 */
368 */
363 void QPieSeries::clear()
369 void QPieSeries::clear()
364 {
370 {
365 Q_D(QPieSeries);
371 Q_D(QPieSeries);
366 if (d->m_slices.count() == 0)
372 if (d->m_slices.count() == 0)
367 return;
373 return;
368
374
369 QList<QPieSlice*> slices = d->m_slices;
375 QList<QPieSlice*> slices = d->m_slices;
370 foreach (QPieSlice* s, d->m_slices) {
376 foreach (QPieSlice* s, d->m_slices) {
371 d->m_slices.removeOne(s);
377 d->m_slices.removeOne(s);
372 delete s;
378 delete s;
373 }
379 }
374
380
375 d->updateDerivativeData();
381 d->updateDerivativeData();
376
382
377 emit removed(slices);
383 emit removed(slices);
378 emit countChanged();
384 emit countChanged();
379 }
385 }
380
386
381 /*!
387 /*!
382 Returns a list of slices that belong to this series.
388 Returns a list of slices that belong to this series.
383 */
389 */
384 QList<QPieSlice*> QPieSeries::slices() const
390 QList<QPieSlice*> QPieSeries::slices() const
385 {
391 {
386 Q_D(const QPieSeries);
392 Q_D(const QPieSeries);
387 return d->m_slices;
393 return d->m_slices;
388 }
394 }
389
395
390 /*!
396 /*!
391 returns the number of the slices in this series.
397 returns the number of the slices in this series.
392 */
398 */
393 int QPieSeries::count() const
399 int QPieSeries::count() const
394 {
400 {
395 Q_D(const QPieSeries);
401 Q_D(const QPieSeries);
396 return d->m_slices.count();
402 return d->m_slices.count();
397 }
403 }
398
404
399 /*!
405 /*!
400 Returns true is the series is empty.
406 Returns true is the series is empty.
401 */
407 */
402 bool QPieSeries::isEmpty() const
408 bool QPieSeries::isEmpty() const
403 {
409 {
404 Q_D(const QPieSeries);
410 Q_D(const QPieSeries);
405 return d->m_slices.isEmpty();
411 return d->m_slices.isEmpty();
406 }
412 }
407
413
408 /*!
414 /*!
409 Returns the sum of all slice values in this series.
415 Returns the sum of all slice values in this series.
410
416
411 \sa QPieSlice::value(), QPieSlice::setValue(), QPieSlice::percentage()
417 \sa QPieSlice::value(), QPieSlice::setValue(), QPieSlice::percentage()
412 */
418 */
413 qreal QPieSeries::sum() const
419 qreal QPieSeries::sum() const
414 {
420 {
415 Q_D(const QPieSeries);
421 Q_D(const QPieSeries);
416 return d->m_sum;
422 return d->m_sum;
417 }
423 }
418
424
419 void QPieSeries::setHorizontalPosition(qreal relativePosition)
425 void QPieSeries::setHorizontalPosition(qreal relativePosition)
420 {
426 {
421 Q_D(QPieSeries);
427 Q_D(QPieSeries);
422
428
423 if (relativePosition < 0.0)
429 if (relativePosition < 0.0)
424 relativePosition = 0.0;
430 relativePosition = 0.0;
425 if (relativePosition > 1.0)
431 if (relativePosition > 1.0)
426 relativePosition = 1.0;
432 relativePosition = 1.0;
427
433
428 if (!qFuzzyIsNull(d->m_pieRelativeHorPos - relativePosition)) {
434 if (!qFuzzyIsNull(d->m_pieRelativeHorPos - relativePosition)) {
429 d->m_pieRelativeHorPos = relativePosition;
435 d->m_pieRelativeHorPos = relativePosition;
430 emit d->horizontalPositionChanged();
436 emit d->horizontalPositionChanged();
431 }
437 }
432 }
438 }
433
439
434 qreal QPieSeries::horizontalPosition() const
440 qreal QPieSeries::horizontalPosition() const
435 {
441 {
436 Q_D(const QPieSeries);
442 Q_D(const QPieSeries);
437 return d->m_pieRelativeHorPos;
443 return d->m_pieRelativeHorPos;
438 }
444 }
439
445
440 void QPieSeries::setVerticalPosition(qreal relativePosition)
446 void QPieSeries::setVerticalPosition(qreal relativePosition)
441 {
447 {
442 Q_D(QPieSeries);
448 Q_D(QPieSeries);
443
449
444 if (relativePosition < 0.0)
450 if (relativePosition < 0.0)
445 relativePosition = 0.0;
451 relativePosition = 0.0;
446 if (relativePosition > 1.0)
452 if (relativePosition > 1.0)
447 relativePosition = 1.0;
453 relativePosition = 1.0;
448
454
449 if (!qFuzzyIsNull(d->m_pieRelativeVerPos - relativePosition)) {
455 if (!qFuzzyIsNull(d->m_pieRelativeVerPos - relativePosition)) {
450 d->m_pieRelativeVerPos = relativePosition;
456 d->m_pieRelativeVerPos = relativePosition;
451 emit d->verticalPositionChanged();
457 emit d->verticalPositionChanged();
452 }
458 }
453 }
459 }
454
460
455 qreal QPieSeries::verticalPosition() const
461 qreal QPieSeries::verticalPosition() const
456 {
462 {
457 Q_D(const QPieSeries);
463 Q_D(const QPieSeries);
458 return d->m_pieRelativeVerPos;
464 return d->m_pieRelativeVerPos;
459 }
465 }
460
466
461 void QPieSeries::setPieSize(qreal relativeSize)
467 void QPieSeries::setPieSize(qreal relativeSize)
462 {
468 {
463 Q_D(QPieSeries);
469 Q_D(QPieSeries);
464
470
465 if (relativeSize < 0.0)
471 if (relativeSize < 0.0)
466 relativeSize = 0.0;
472 relativeSize = 0.0;
467 if (relativeSize > 1.0)
473 if (relativeSize > 1.0)
468 relativeSize = 1.0;
474 relativeSize = 1.0;
469
475
470 if (!qFuzzyIsNull(d->m_pieRelativeSize - relativeSize)) {
476 if (!qFuzzyIsNull(d->m_pieRelativeSize - relativeSize)) {
471 d->m_pieRelativeSize = relativeSize;
477 d->m_pieRelativeSize = relativeSize;
472 emit d->pieSizeChanged();
478 emit d->pieSizeChanged();
473 }
479 }
474 }
480 }
475
481
476 qreal QPieSeries::pieSize() const
482 qreal QPieSeries::pieSize() const
477 {
483 {
478 Q_D(const QPieSeries);
484 Q_D(const QPieSeries);
479 return d->m_pieRelativeSize;
485 return d->m_pieRelativeSize;
480 }
486 }
481
487
482
488
483 void QPieSeries::setPieStartAngle(qreal angle)
489 void QPieSeries::setPieStartAngle(qreal angle)
484 {
490 {
485 Q_D(QPieSeries);
491 Q_D(QPieSeries);
486 if (qFuzzyIsNull(d->m_pieStartAngle - angle))
492 if (qFuzzyIsNull(d->m_pieStartAngle - angle))
487 return;
493 return;
488 d->m_pieStartAngle = angle;
494 d->m_pieStartAngle = angle;
489 d->updateDerivativeData();
495 d->updateDerivativeData();
490 emit d->pieStartAngleChanged();
496 emit d->pieStartAngleChanged();
491 }
497 }
492
498
493 qreal QPieSeries::pieStartAngle() const
499 qreal QPieSeries::pieStartAngle() const
494 {
500 {
495 Q_D(const QPieSeries);
501 Q_D(const QPieSeries);
496 return d->m_pieStartAngle;
502 return d->m_pieStartAngle;
497 }
503 }
498
504
499 /*!
505 /*!
500 Sets the end angle of the pie.
506 Sets the end angle of the pie.
501
507
502 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
508 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
503
509
504 \a angle must be greater than start angle.
510 \a angle must be greater than start angle.
505
511
506 \sa pieEndAngle(), pieStartAngle(), setPieStartAngle()
512 \sa pieEndAngle(), pieStartAngle(), setPieStartAngle()
507 */
513 */
508 void QPieSeries::setPieEndAngle(qreal angle)
514 void QPieSeries::setPieEndAngle(qreal angle)
509 {
515 {
510 Q_D(QPieSeries);
516 Q_D(QPieSeries);
511 if (qFuzzyIsNull(d->m_pieEndAngle - angle))
517 if (qFuzzyIsNull(d->m_pieEndAngle - angle))
512 return;
518 return;
513 d->m_pieEndAngle = angle;
519 d->m_pieEndAngle = angle;
514 d->updateDerivativeData();
520 d->updateDerivativeData();
515 emit d->pieEndAngleChanged();
521 emit d->pieEndAngleChanged();
516 }
522 }
517
523
518 /*!
524 /*!
519 Returns the end angle of the pie.
525 Returns the end angle of the pie.
520
526
521 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
527 Full pie is 360 degrees where 0 degrees is at 12 a'clock.
522
528
523 \sa setPieEndAngle(), pieStartAngle(), setPieStartAngle()
529 \sa setPieEndAngle(), pieStartAngle(), setPieStartAngle()
524 */
530 */
525 qreal QPieSeries::pieEndAngle() const
531 qreal QPieSeries::pieEndAngle() const
526 {
532 {
527 Q_D(const QPieSeries);
533 Q_D(const QPieSeries);
528 return d->m_pieEndAngle;
534 return d->m_pieEndAngle;
529 }
535 }
530
536
531 /*!
537 /*!
532 Sets the all the slice labels \a visible or invisible.
538 Sets the all the slice labels \a visible or invisible.
533
539
534 Note that this affects only the current slices in the series.
540 Note that this affects only the current slices in the series.
535 If user adds a new slice the default label visibility is false.
541 If user adds a new slice the default label visibility is false.
536
542
537 \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible()
543 \sa QPieSlice::isLabelVisible(), QPieSlice::setLabelVisible()
538 */
544 */
539 void QPieSeries::setLabelsVisible(bool visible)
545 void QPieSeries::setLabelsVisible(bool visible)
540 {
546 {
541 Q_D(QPieSeries);
547 Q_D(QPieSeries);
542 foreach (QPieSlice* s, d->m_slices)
548 foreach (QPieSlice* s, d->m_slices)
543 s->setLabelVisible(visible);
549 s->setLabelVisible(visible);
544 }
550 }
545
551
546 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
552 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
547
553
548
554
549 QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) :
555 QPieSeriesPrivate::QPieSeriesPrivate(QPieSeries *parent) :
550 QAbstractSeriesPrivate(parent),
556 QAbstractSeriesPrivate(parent),
551 m_pieRelativeHorPos(0.5),
557 m_pieRelativeHorPos(0.5),
552 m_pieRelativeVerPos(0.5),
558 m_pieRelativeVerPos(0.5),
553 m_pieRelativeSize(0.7),
559 m_pieRelativeSize(0.7),
554 m_pieStartAngle(0),
560 m_pieStartAngle(0),
555 m_pieEndAngle(360),
561 m_pieEndAngle(360),
556 m_sum(0)
562 m_sum(0)
557 {
563 {
558 }
564 }
559
565
560 QPieSeriesPrivate::~QPieSeriesPrivate()
566 QPieSeriesPrivate::~QPieSeriesPrivate()
561 {
567 {
562 }
568 }
563
569
564 void QPieSeriesPrivate::updateDerivativeData()
570 void QPieSeriesPrivate::updateDerivativeData()
565 {
571 {
566 // calculate sum of all slices
572 // calculate sum of all slices
567 qreal sum = 0;
573 qreal sum = 0;
568 foreach (QPieSlice* s, m_slices)
574 foreach (QPieSlice* s, m_slices)
569 sum += s->value();
575 sum += s->value();
570
576
571 if (!qFuzzyIsNull(m_sum - sum)) {
577 if (!qFuzzyIsNull(m_sum - sum)) {
572 m_sum = sum;
578 m_sum = sum;
573 emit q_func()->sumChanged();
579 emit q_func()->sumChanged();
574 }
580 }
575
581
576 // nothing to show..
582 // nothing to show..
577 if (qFuzzyIsNull(m_sum))
583 if (qFuzzyIsNull(m_sum))
578 return;
584 return;
579
585
580 // update slice attributes
586 // update slice attributes
581 qreal sliceAngle = m_pieStartAngle;
587 qreal sliceAngle = m_pieStartAngle;
582 qreal pieSpan = m_pieEndAngle - m_pieStartAngle;
588 qreal pieSpan = m_pieEndAngle - m_pieStartAngle;
583 QVector<QPieSlice*> changed;
589 QVector<QPieSlice*> changed;
584 foreach (QPieSlice* s, m_slices) {
590 foreach (QPieSlice* s, m_slices) {
585 QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
591 QPieSlicePrivate *d = QPieSlicePrivate::fromSlice(s);
586 d->setPercentage(s->value() / m_sum);
592 d->setPercentage(s->value() / m_sum);
587 d->setStartAngle(sliceAngle);
593 d->setStartAngle(sliceAngle);
588 d->setAngleSpan(pieSpan * s->percentage());
594 d->setAngleSpan(pieSpan * s->percentage());
589 sliceAngle += s->angleSpan();
595 sliceAngle += s->angleSpan();
590 }
596 }
591
597
592
598
593 emit calculatedDataChanged();
599 emit calculatedDataChanged();
594 }
600 }
595
601
596 QPieSeriesPrivate* QPieSeriesPrivate::fromSeries(QPieSeries *series)
602 QPieSeriesPrivate* QPieSeriesPrivate::fromSeries(QPieSeries *series)
597 {
603 {
598 return series->d_func();
604 return series->d_func();
599 }
605 }
600
606
601 void QPieSeriesPrivate::sliceValueChanged()
607 void QPieSeriesPrivate::sliceValueChanged()
602 {
608 {
603 Q_ASSERT(m_slices.contains(qobject_cast<QPieSlice *>(sender())));
609 Q_ASSERT(m_slices.contains(qobject_cast<QPieSlice *>(sender())));
604 updateDerivativeData();
610 updateDerivativeData();
605 }
611 }
606
612
607 void QPieSeriesPrivate::sliceClicked()
613 void QPieSeriesPrivate::sliceClicked()
608 {
614 {
609 QPieSlice* slice = qobject_cast<QPieSlice *>(sender());
615 QPieSlice* slice = qobject_cast<QPieSlice *>(sender());
610 Q_ASSERT(m_slices.contains(slice));
616 Q_ASSERT(m_slices.contains(slice));
611 Q_Q(QPieSeries);
617 Q_Q(QPieSeries);
612 emit q->clicked(slice);
618 emit q->clicked(slice);
613 }
619 }
614
620
615 void QPieSeriesPrivate::sliceHovered(bool state)
621 void QPieSeriesPrivate::sliceHovered(bool state)
616 {
622 {
617 QPieSlice* slice = qobject_cast<QPieSlice *>(sender());
623 QPieSlice* slice = qobject_cast<QPieSlice *>(sender());
618 Q_ASSERT(m_slices.contains(slice));
624 Q_ASSERT(m_slices.contains(slice));
619 Q_Q(QPieSeries);
625 Q_Q(QPieSeries);
620 emit q->hovered(slice, state);
626 emit q->hovered(slice, state);
621 }
627 }
622
628
623 void QPieSeriesPrivate::scaleDomain(Domain& domain)
629 void QPieSeriesPrivate::scaleDomain(Domain& domain)
624 {
630 {
625 Q_UNUSED(domain);
631 Q_UNUSED(domain);
626 // does not apply to pie
632 // does not apply to pie
627 }
633 }
628
634
629 Chart* QPieSeriesPrivate::createGraphics(ChartPresenter* presenter)
635 Chart* QPieSeriesPrivate::createGraphics(ChartPresenter* presenter)
630 {
636 {
631 Q_Q(QPieSeries);
637 Q_Q(QPieSeries);
632 PieChartItem* pie = new PieChartItem(q,presenter);
638 PieChartItem* pie = new PieChartItem(q,presenter);
633 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
639 if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) {
634 presenter->animator()->addAnimation(pie);
640 presenter->animator()->addAnimation(pie);
635 }
641 }
636 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
642 presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q));
637 return pie;
643 return pie;
638 }
644 }
639
645
640 QList<LegendMarker*> QPieSeriesPrivate::createLegendMarker(QLegend* legend)
646 QList<LegendMarker*> QPieSeriesPrivate::createLegendMarker(QLegend* legend)
641 {
647 {
642 Q_Q(QPieSeries);
648 Q_Q(QPieSeries);
643 QList<LegendMarker*> markers;
649 QList<LegendMarker*> markers;
644 foreach(QPieSlice* slice, q->slices()) {
650 foreach(QPieSlice* slice, q->slices()) {
645 PieLegendMarker* marker = new PieLegendMarker(q,slice,legend);
651 PieLegendMarker* marker = new PieLegendMarker(q,slice,legend);
646 markers << marker;
652 markers << marker;
647 }
653 }
648 return markers;
654 return markers;
649 }
655 }
650
656
651 #include "moc_qpieseries.cpp"
657 #include "moc_qpieseries.cpp"
652 #include "moc_qpieseries_p.cpp"
658 #include "moc_qpieseries_p.cpp"
653
659
654 QTCOMMERCIALCHART_END_NAMESPACE
660 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,66 +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 import QtQuick 1.0
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
22 import QtCommercial.Chart 1.0
23
23
24 ChartView {
24 ChartView {
25 title: "area series"
25 title: "area series"
26 anchors.fill: parent
26 anchors.fill: parent
27 axisXLabels: ["0", "2000", "1", "2001", "2", "2002", "3", "2003", "4", "2004", "5", "2005",
27 axisXLabels: ["0", "2000", "1", "2001", "2", "2002", "3", "2003", "4", "2004", "5", "2005",
28 "6", "2006", "7", "2007", "8", "2008", "9", "2009", "10", "2010", "11", "2011"]
28 "6", "2006", "7", "2007", "8", "2008", "9", "2009", "10", "2010", "11", "2011"]
29
29
30 property variant series: daSeries
30 property variant series: areaSeries
31
31
32 AreaSeries {
32 AreaSeries {
33 id: daSeries
33 id: areaSeries
34 name: "area 1"
34 name: "area 1"
35 onSelected: console.log("areaSeries.onSelected");
36 onClicked: console.log("areaSeries.onClicked: " + point.x + ", " + point.y);
37 upperSeries: LineSeries {
35 upperSeries: LineSeries {
38 XyPoint { x: 0; y: 1 }
36 XyPoint { x: 0; y: 1 }
39 XyPoint { x: 1; y: 1 }
37 XyPoint { x: 1; y: 1 }
40 XyPoint { x: 2; y: 3 }
38 XyPoint { x: 2; y: 3 }
41 XyPoint { x: 3; y: 3 }
39 XyPoint { x: 3; y: 3 }
42 XyPoint { x: 4; y: 2 }
40 XyPoint { x: 4; y: 2 }
43 XyPoint { x: 5; y: 0 }
41 XyPoint { x: 5; y: 0 }
44 XyPoint { x: 6; y: 2 }
42 XyPoint { x: 6; y: 2 }
45 XyPoint { x: 7; y: 1 }
43 XyPoint { x: 7; y: 1 }
46 XyPoint { x: 8; y: 2 }
44 XyPoint { x: 8; y: 2 }
47 XyPoint { x: 9; y: 1 }
45 XyPoint { x: 9; y: 1 }
48 XyPoint { x: 10; y: 3 }
46 XyPoint { x: 10; y: 3 }
49 XyPoint { x: 11; y: 3 }
47 XyPoint { x: 11; y: 3 }
50 }
48 }
51 lowerSeries: LineSeries {
49 lowerSeries: LineSeries {
52 XyPoint { x: 0; y: 0 }
50 XyPoint { x: 0; y: 0 }
53 XyPoint { x: 1; y: 0 }
51 XyPoint { x: 1; y: 0 }
54 XyPoint { x: 2; y: 0 }
52 XyPoint { x: 2; y: 0 }
55 XyPoint { x: 3; y: 0 }
53 XyPoint { x: 3; y: 0 }
56 XyPoint { x: 4; y: 0 }
54 XyPoint { x: 4; y: 0 }
57 XyPoint { x: 5; y: 0 }
55 XyPoint { x: 5; y: 0 }
58 XyPoint { x: 6; y: 0 }
56 XyPoint { x: 6; y: 0 }
59 XyPoint { x: 7; y: 0 }
57 XyPoint { x: 7; y: 0 }
60 XyPoint { x: 8; y: 0 }
58 XyPoint { x: 8; y: 0 }
61 XyPoint { x: 9; y: 0 }
59 XyPoint { x: 9; y: 0 }
62 XyPoint { x: 10; y: 0 }
60 XyPoint { x: 10; y: 0 }
63 XyPoint { x: 11; y: 0 }
61 XyPoint { x: 11; y: 0 }
64 }
62 }
63
64 onNameChanged: console.log("areaSeries.onNameChanged: " + name);
65 onVisibleChanged: console.log("areaSeries.onVisibleChanged: " + visible);
66 onClicked: console.log("areaSeries.onClicked: " + point.x + ", " + point.y);
67 onSelected: console.log("areaSeries.onSelected");
68 onColorChanged: console.log("areaSeries.onColorChanged: " + color);
69 onBorderColorChanged: console.log("areaSeries.onBorderColorChanged: " + borderColor);
70 // onCountChanged: console.log("areaSeries.onCountChanged: " + count);
65 }
71 }
66 }
72 }
@@ -1,77 +1,59
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 flow: Flow.TopToBottom
29 property variant series
29 property variant series
30
30
31 onSeriesChanged: {
32 if (series && series.name == "area 1") {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
37 }
38
39 Connections {
40 id: seriesConnections
41 target: null
42 onNameChanged: console.log("series.onNameChanged: " + series.name);
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onColorChanged: console.log("series.onColorChanged: " + series.color);
45 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
46 onCountChanged: console.log("series.onCountChanged: " + series.count);
47 }
48
49 Button {
31 Button {
50 text: "visible"
32 text: "visible"
51 onClicked: series.visible = !series.visible;
33 onClicked: series.visible = !series.visible;
52 }
34 }
53 Button {
35 Button {
54 text: "color"
36 text: "color"
55 onClicked: series.color = main.nextColor();
37 onClicked: series.color = main.nextColor();
56 }
38 }
57 Button {
39 Button {
58 text: "borderColor"
40 text: "borderColor"
59 onClicked: series.borderColor = main.nextColor();
41 onClicked: series.borderColor = main.nextColor();
60 }
42 }
61 Button {
43 Button {
62 text: "upper color"
44 text: "upper color"
63 onClicked: series.upperSeries.color = main.nextColor();
45 onClicked: series.upperSeries.color = main.nextColor();
64 }
46 }
65 Button {
47 Button {
66 text: "lower color"
48 text: "lower color"
67 onClicked: series.lowerSeries.color = main.nextColor();
49 onClicked: series.lowerSeries.color = main.nextColor();
68 }
50 }
69 Button {
51 Button {
70 text: "upper points visible"
52 text: "upper points visible"
71 onClicked: series.upperSeries.pointsVisible = !series.pointsVisible;
53 onClicked: series.upperSeries.pointsVisible = !series.pointsVisible;
72 }
54 }
73 Button {
55 Button {
74 text: "lower points visible"
56 text: "lower points visible"
75 onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible;
57 onClicked: series.lowerSeries.pointsVisible = !series.pointsVisible;
76 }
58 }
77 }
59 }
@@ -1,45 +1,54
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 ChartView {
24 ChartView {
25 title: "Bar series"
25 title: "Bar series"
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend.alignment: Qt.AlignBottom
28 legend.alignment: Qt.AlignBottom
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30
30
31 property variant series: daSeries
31 property variant series: barSeries
32
32
33 BarSeries {
33 BarSeries {
34 id: daSeries
34 id: barSeries
35 name: "bar"
35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
37 onHovered: console.log("onHovered: " + barset + " " + status);
38 BarSet { label: "Bob"; values: [4, 7, 3, 10, 5, 6]
36 BarSet { label: "Bob"; values: [4, 7, 3, 10, 5, 6]
39 onClicked: console.log("barset.onClicked: " + index);
37 onClicked: console.log("barset.onClicked: " + index);
40 onHovered: console.log("barset.onHovered: " + status);
38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
41 }
43 }
42 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 8] }
44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 8] }
43 BarSet { label: "James"; values: [3, 5, 8, 5, 4, 7] }
45 BarSet { label: "James"; values: [3, 5, 8, 5, 4, 7] }
46
47 onNameChanged: console.log("barSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("barSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("barSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("barSeries.onCountChanged: " + count);
44 }
53 }
45 }
54 }
@@ -1,94 +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 flow: Flow.TopToBottom
28 property variant series
28 property variant series
29
29
30 onSeriesChanged: {
31 if (series && series.name == "bar") {
32 seriesConnections.target = series;
33 setConnections.target = series.at(0);
34 } else {
35 seriesConnections.target = null;
36 setConnections.target = null;
37 }
38 }
39
40 Connections {
41 id: seriesConnections
42 target: null
43 onNameChanged: console.log("series.onNameChanged: " + series.name);
44 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
45 onLabelsVisibleChanged: console.log("series.onLabelsVisibleChanged: " + series.labelsVisible);
46 onCountChanged: console.log("series.onCountChanged: " + count);
47 }
48
49 Connections {
50 id: setConnections
51 target: null
52 onColorChanged: console.log("series.onColorChanged: " + color);
53 onBorderColorChanged: console.log("series.onBorderColorChanged: " + color);
54 onLabelColorChanged: console.log("series.onLabelColorChanged: " + color);
55 onCountChanged: console.log("series.onCountChanged: " + count);
56 }
57
58 Button {
30 Button {
59 text: "visible"
31 text: "visible"
60 onClicked: series.visible = !series.visible;
32 onClicked: series.visible = !series.visible;
61 }
33 }
62 Button {
34 Button {
63 text: "labels visible"
35 text: "labels visible"
64 onClicked: series.labelsVisible = !series.labelsVisible;
36 onClicked: series.labelsVisible = !series.labelsVisible;
65 }
37 }
66 Button {
38 Button {
67 text: "bar width +"
39 text: "bar width +"
68 onClicked: series.barWidth += 0.1;
40 onClicked: series.barWidth += 0.1;
69 }
41 }
70 Button {
42 Button {
71 text: "bar width -"
43 text: "bar width -"
72 onClicked: series.barWidth -= 0.1;
44 onClicked: series.barWidth -= 0.1;
73 }
45 }
74 Button {
46 Button {
75 text: "set 1 color"
47 text: "set 1 color"
76 onClicked: series.at(0).color = main.nextColor();
48 onClicked: series.at(0).color = main.nextColor();
77 }
49 }
78 Button {
50 Button {
79 text: "set 1 border color"
51 text: "set 1 border color"
80 onClicked: series.at(0).borderColor = main.nextColor();
52 onClicked: series.at(0).borderColor = main.nextColor();
81 }
53 }
82 Button {
54 Button {
83 text: "set 1 label color"
55 text: "set 1 label color"
84 onClicked: series.at(0).labelColor = main.nextColor();
56 onClicked: series.at(0).labelColor = main.nextColor();
85 }
57 }
86 Button {
58 Button {
87 text: "set 1 font size +"
59 text: "set 1 font size +"
88 onClicked: series.at(0).labelFont.pixelSize += 1;
60 onClicked: series.at(0).labelFont.pixelSize += 1;
89 }
61 }
90 Button {
62 Button {
91 text: "set 1 font size -"
63 text: "set 1 font size -"
92 onClicked: series.at(0).labelFont.pixelSize -= 1;
64 onClicked: series.at(0).labelFont.pixelSize -= 1;
93 }
65 }
94 }
66 }
@@ -1,40 +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 import QtQuick 1.0
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
22 import QtCommercial.Chart 1.0
23
23
24 ChartView {
24 ChartView {
25 id: chartView
25 id: chartView
26 title: "chart"
26 title: "chart"
27 anchors.fill: parent
27 anchors.fill: parent
28 property variant series: chartView
28 property variant series: chartView
29
29
30 LineSeries {
30 LineSeries {
31 name: "line"
31 name: "line"
32 XyPoint { x: 0; y: 0 }
32 XyPoint { x: 0; y: 0 }
33 XyPoint { x: 1.1; y: 2.1 }
33 XyPoint { x: 1.1; y: 2.1 }
34 XyPoint { x: 1.9; y: 3.3 }
34 XyPoint { x: 1.9; y: 3.3 }
35 XyPoint { x: 2.1; y: 2.1 }
35 XyPoint { x: 2.1; y: 2.1 }
36 XyPoint { x: 2.9; y: 4.9 }
36 XyPoint { x: 2.9; y: 4.9 }
37 XyPoint { x: 3.4; y: 3.0 }
37 XyPoint { x: 3.4; y: 3.0 }
38 XyPoint { x: 4.1; y: 3.3 }
38 XyPoint { x: 4.1; y: 3.3 }
39 }
39 }
40
41 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
42 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
43 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
44 onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
45
46 legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
47 legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
48 legend.onColorChanged: console.log("legend.onColorChanged: " + color);
49 legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
50
51 axisX.onColorChanged: console.log("axisX.onColorChanged: " + color);
52 axisX.onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
53 axisX.onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
54 axisX.onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
55 axisX.onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
56 axisX.onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
57 axisX.onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
58 axisX.onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
59 axisX.onMinChanged: console.log("axisX.onMinChanged: " + min);
60 axisX.onMaxChanged: console.log("axisX.onMaxChanged: " + max);
61
62 axisY.onColorChanged: console.log("axisY.onColorChanged: " + color);
63 axisY.onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
64 axisY.onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
65 axisY.onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
66 axisY.onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
67 axisY.onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
68 axisY.onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
69 axisY.onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
70 axisY.onMinChanged: console.log("axisY.onMinChanged: " + min);
71 axisY.onMaxChanged: console.log("axisY.onMaxChanged: " + max);
40 }
72 }
@@ -1,316 +1,255
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 flow: Flow.TopToBottom
29 property variant series // TODO: rename to chart
29 property variant series // TODO: rename to chart
30
30
31 onSeriesChanged: {
32 if (series && series.name == "") {
33 chartConnections.target = series;
34 legendConnections.target = series.legend;
35 axisXConnections.target = series.axisX;
36 axisYConnections.target = series.axisY;
37 } else {
38 legendConnections.target = null;
39 axisXConnections.target = null;
40 axisYConnections.target = null;
41 }
42 }
43
44 Connections {
45 id: chartConnections
46 target: null
47 onVisibleChanged: console.log("chart.onVisibleChanged: " + series.visible);
48 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + series.titleColor);
49 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + series.backgroundColor);
50 onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
51 }
52
53 Connections {
54 id: legendConnections
55 target: null
56 onVisibleChanged: console.log("legend.onVisibleChanged: " + series.legend.visible);
57 onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
58 onColorChanged: console.log("legend.onColorChanged: " + color);
59 onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
60 }
61
62 Connections {
63 id: axisXConnections
64 target: null
65 onColorChanged: console.log("axisX.onColorChanged: " + color);
66 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
67 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
68 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
69 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
70 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
71 onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
72 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
73 onMinChanged: console.log("axisX.onMinChanged: " + min);
74 onMaxChanged: console.log("axisX.onMaxChanged: " + max);
75 }
76
77 Connections {
78 id: axisYConnections
79 target: null
80 onColorChanged: console.log("axisY.onColorChanged: " + color);
81 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
82 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
83 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
84 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
85 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
86 onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
87 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
88 onMinChanged: console.log("axisY.onMinChanged: " + min);
89 onMaxChanged: console.log("axisY.onMaxChanged: " + max);
90 }
91
92 Button {
31 Button {
93 text: "visible"
32 text: "visible"
94 onClicked: series.visible = !series.visible;
33 onClicked: series.visible = !series.visible;
95 }
34 }
96 Button {
35 Button {
97 text: "theme +"
36 text: "theme +"
98 onClicked: series.theme++;
37 onClicked: series.theme++;
99 }
38 }
100 Button {
39 Button {
101 text: "theme -"
40 text: "theme -"
102 onClicked: series.theme--;
41 onClicked: series.theme--;
103 }
42 }
104 Button {
43 Button {
105 text: "animation opt +"
44 text: "animation opt +"
106 onClicked: series.animationOptions++;
45 onClicked: series.animationOptions++;
107 }
46 }
108 Button {
47 Button {
109 text: "animation opt -"
48 text: "animation opt -"
110 onClicked: series.animationOptions--;
49 onClicked: series.animationOptions--;
111 }
50 }
112 Button {
51 Button {
113 text: "title color"
52 text: "title color"
114 onClicked: series.titleColor = main.nextColor();
53 onClicked: series.titleColor = main.nextColor();
115 }
54 }
116 Button {
55 Button {
117 text: "background color"
56 text: "background color"
118 onClicked: series.backgroundColor = main.nextColor();
57 onClicked: series.backgroundColor = main.nextColor();
119 }
58 }
120 Button {
59 Button {
121 text: "drop shadow enabled"
60 text: "drop shadow enabled"
122 onClicked: series.dropShadowEnabled = !series.dropShadowEnabled;
61 onClicked: series.dropShadowEnabled = !series.dropShadowEnabled;
123 }
62 }
124 Button {
63 Button {
125 text: "zoom +"
64 text: "zoom +"
126 onClicked: series.zoom(2);
65 onClicked: series.zoom(2);
127 }
66 }
128 Button {
67 Button {
129 text: "zoom -"
68 text: "zoom -"
130 onClicked: series.zoom(0.5);
69 onClicked: series.zoom(0.5);
131 }
70 }
132 Button {
71 Button {
133 text: "scroll left"
72 text: "scroll left"
134 onClicked: series.scrollLeft(10);
73 onClicked: series.scrollLeft(10);
135 }
74 }
136 Button {
75 Button {
137 text: "scroll right"
76 text: "scroll right"
138 onClicked: series.scrollRight(10);
77 onClicked: series.scrollRight(10);
139 }
78 }
140 Button {
79 Button {
141 text: "scroll up"
80 text: "scroll up"
142 onClicked: series.scrollUp(10);
81 onClicked: series.scrollUp(10);
143 }
82 }
144 Button {
83 Button {
145 text: "scroll down"
84 text: "scroll down"
146 onClicked: series.scrollDown(10);
85 onClicked: series.scrollDown(10);
147 }
86 }
148 Button {
87 Button {
149 text: "legend visible"
88 text: "legend visible"
150 onClicked: series.legend.visible = !series.legend.visible;
89 onClicked: series.legend.visible = !series.legend.visible;
151 }
90 }
152 Button {
91 Button {
153 text: "legend bckgrd visible"
92 text: "legend bckgrd visible"
154 onClicked: series.legend.backgroundVisible = !series.legend.backgroundVisible;
93 onClicked: series.legend.backgroundVisible = !series.legend.backgroundVisible;
155 }
94 }
156 Button {
95 Button {
157 text: "legend color"
96 text: "legend color"
158 onClicked: series.legend.color = main.nextColor();
97 onClicked: series.legend.color = main.nextColor();
159 }
98 }
160 Button {
99 Button {
161 text: "legend border color"
100 text: "legend border color"
162 onClicked: series.legend.borderColor = main.nextColor();
101 onClicked: series.legend.borderColor = main.nextColor();
163 }
102 }
164 Button {
103 Button {
165 text: "legend top"
104 text: "legend top"
166 onClicked: series.legend.alignment ^= Qt.AlignTop;
105 onClicked: series.legend.alignment ^= Qt.AlignTop;
167 }
106 }
168 Button {
107 Button {
169 text: "legend bottom"
108 text: "legend bottom"
170 onClicked: series.legend.alignment ^= Qt.AlignBottom;
109 onClicked: series.legend.alignment ^= Qt.AlignBottom;
171 }
110 }
172 Button {
111 Button {
173 text: "legend left"
112 text: "legend left"
174 onClicked: series.legend.alignment ^= Qt.AlignLeft;
113 onClicked: series.legend.alignment ^= Qt.AlignLeft;
175 }
114 }
176 Button {
115 Button {
177 text: "legend right"
116 text: "legend right"
178 onClicked: series.legend.alignment ^= Qt.AlignRight;
117 onClicked: series.legend.alignment ^= Qt.AlignRight;
179 }
118 }
180 Button {
119 Button {
181 text: "axis X visible"
120 text: "axis X visible"
182 onClicked: series.axisX.visible = !series.axisX.visible;
121 onClicked: series.axisX.visible = !series.axisX.visible;
183 }
122 }
184 Button {
123 Button {
185 text: "axis X grid visible"
124 text: "axis X grid visible"
186 onClicked: series.axisX.gridVisible = !series.axisX.gridVisible;
125 onClicked: series.axisX.gridVisible = !series.axisX.gridVisible;
187 }
126 }
188 Button {
127 Button {
189 text: "axis X labels visible"
128 text: "axis X labels visible"
190 onClicked: series.axisX.labelsVisible = !series.axisX.labelsVisible;
129 onClicked: series.axisX.labelsVisible = !series.axisX.labelsVisible;
191 }
130 }
192 Button {
131 Button {
193 text: "axis X color"
132 text: "axis X color"
194 onClicked: series.axisX.color = main.nextColor();
133 onClicked: series.axisX.color = main.nextColor();
195 }
134 }
196 Button {
135 Button {
197 text: "axis X labels color"
136 text: "axis X labels color"
198 onClicked: series.axisX.labelsColor = main.nextColor();
137 onClicked: series.axisX.labelsColor = main.nextColor();
199 }
138 }
200 Button {
139 Button {
201 text: "axis X labels angle +"
140 text: "axis X labels angle +"
202 onClicked: series.axisX.labelsAngle += 5;
141 onClicked: series.axisX.labelsAngle += 5;
203 }
142 }
204 Button {
143 Button {
205 text: "axis X labels angle -"
144 text: "axis X labels angle -"
206 onClicked: series.axisX.labelsAngle -= 5;
145 onClicked: series.axisX.labelsAngle -= 5;
207 }
146 }
208 Button {
147 Button {
209 text: "axis X shades visible"
148 text: "axis X shades visible"
210 onClicked: series.axisX.shadesVisible = !series.axisX.shadesVisible;
149 onClicked: series.axisX.shadesVisible = !series.axisX.shadesVisible;
211 }
150 }
212 Button {
151 Button {
213 text: "axis X shades color"
152 text: "axis X shades color"
214 onClicked: series.axisX.shadesColor = main.nextColor();
153 onClicked: series.axisX.shadesColor = main.nextColor();
215 }
154 }
216 Button {
155 Button {
217 text: "axis X shades bcolor"
156 text: "axis X shades bcolor"
218 onClicked: series.axisX.shadesBorderColor = main.nextColor();
157 onClicked: series.axisX.shadesBorderColor = main.nextColor();
219 }
158 }
220 Button {
159 Button {
221 text: "axis X max +"
160 text: "axis X max +"
222 onClicked: series.axisX.max += 0.1;
161 onClicked: series.axisX.max += 0.1;
223 }
162 }
224 Button {
163 Button {
225 text: "axis X max -"
164 text: "axis X max -"
226 onClicked: series.axisX.max -= 0.1;
165 onClicked: series.axisX.max -= 0.1;
227 }
166 }
228 Button {
167 Button {
229 text: "axis X min +"
168 text: "axis X min +"
230 onClicked: series.axisX.min += 0.1;
169 onClicked: series.axisX.min += 0.1;
231 }
170 }
232 Button {
171 Button {
233 text: "axis X min -"
172 text: "axis X min -"
234 onClicked: series.axisX.min -= 0.1;
173 onClicked: series.axisX.min -= 0.1;
235 }
174 }
236 Button {
175 Button {
237 text: "axis X ticks count +"
176 text: "axis X ticks count +"
238 onClicked: series.axisX.ticksCount++;
177 onClicked: series.axisX.ticksCount++;
239 }
178 }
240 Button {
179 Button {
241 text: "axis X ticks count -"
180 text: "axis X ticks count -"
242 onClicked: series.axisX.ticksCount--;
181 onClicked: series.axisX.ticksCount--;
243 }
182 }
244 Button {
183 Button {
245 text: "axis X nice nmb"
184 text: "axis X nice nmb"
246 onClicked: series.axisX.niceNumbersEnabled = !series.axisX.niceNumbersEnabled;
185 onClicked: series.axisX.niceNumbersEnabled = !series.axisX.niceNumbersEnabled;
247 }
186 }
248 Button {
187 Button {
249 text: "axis Y visible"
188 text: "axis Y visible"
250 onClicked: series.axisY.visible = !series.axisY.visible;
189 onClicked: series.axisY.visible = !series.axisY.visible;
251 }
190 }
252 Button {
191 Button {
253 text: "axis Y grid visible"
192 text: "axis Y grid visible"
254 onClicked: series.axisY.gridVisible = !series.axisY.gridVisible;
193 onClicked: series.axisY.gridVisible = !series.axisY.gridVisible;
255 }
194 }
256 Button {
195 Button {
257 text: "axis Y labels visible"
196 text: "axis Y labels visible"
258 onClicked: series.axisY.labelsVisible = !series.axisY.labelsVisible;
197 onClicked: series.axisY.labelsVisible = !series.axisY.labelsVisible;
259 }
198 }
260 Button {
199 Button {
261 text: "axis Y color"
200 text: "axis Y color"
262 onClicked: series.axisY.color = main.nextColor();
201 onClicked: series.axisY.color = main.nextColor();
263 }
202 }
264 Button {
203 Button {
265 text: "axis Y labels color"
204 text: "axis Y labels color"
266 onClicked: series.axisY.labelsColor = main.nextColor();
205 onClicked: series.axisY.labelsColor = main.nextColor();
267 }
206 }
268 Button {
207 Button {
269 text: "axis Y labels angle +"
208 text: "axis Y labels angle +"
270 onClicked: series.axisY.labelsAngle += 5;
209 onClicked: series.axisY.labelsAngle += 5;
271 }
210 }
272 Button {
211 Button {
273 text: "axis Y labels angle -"
212 text: "axis Y labels angle -"
274 onClicked: series.axisY.labelsAngle -= 5;
213 onClicked: series.axisY.labelsAngle -= 5;
275 }
214 }
276 Button {
215 Button {
277 text: "axis Y shades visible"
216 text: "axis Y shades visible"
278 onClicked: series.axisY.shadesVisible = !series.axisY.shadesVisible;
217 onClicked: series.axisY.shadesVisible = !series.axisY.shadesVisible;
279 }
218 }
280 Button {
219 Button {
281 text: "axis Y shades color"
220 text: "axis Y shades color"
282 onClicked: series.axisY.shadesColor = main.nextColor();
221 onClicked: series.axisY.shadesColor = main.nextColor();
283 }
222 }
284 Button {
223 Button {
285 text: "axis Y shades bcolor"
224 text: "axis Y shades bcolor"
286 onClicked: series.axisY.shadesBorderColor = main.nextColor();
225 onClicked: series.axisY.shadesBorderColor = main.nextColor();
287 }
226 }
288 Button {
227 Button {
289 text: "axis Y max +"
228 text: "axis Y max +"
290 onClicked: series.axisY.max += 0.1;
229 onClicked: series.axisY.max += 0.1;
291 }
230 }
292 Button {
231 Button {
293 text: "axis Y max -"
232 text: "axis Y max -"
294 onClicked: series.axisY.max -= 0.1;
233 onClicked: series.axisY.max -= 0.1;
295 }
234 }
296 Button {
235 Button {
297 text: "axis Y min +"
236 text: "axis Y min +"
298 onClicked: series.axisY.min += 0.1;
237 onClicked: series.axisY.min += 0.1;
299 }
238 }
300 Button {
239 Button {
301 text: "axis Y min -"
240 text: "axis Y min -"
302 onClicked: series.axisY.min -= 0.1;
241 onClicked: series.axisY.min -= 0.1;
303 }
242 }
304 Button {
243 Button {
305 text: "axis Y ticks count +"
244 text: "axis Y ticks count +"
306 onClicked: series.axisY.ticksCount++;
245 onClicked: series.axisY.ticksCount++;
307 }
246 }
308 Button {
247 Button {
309 text: "axis Y ticks count -"
248 text: "axis Y ticks count -"
310 onClicked: series.axisY.ticksCount--;
249 onClicked: series.axisY.ticksCount--;
311 }
250 }
312 Button {
251 Button {
313 text: "axis Y nice nmb"
252 text: "axis Y nice nmb"
314 onClicked: series.axisY.niceNumbersEnabled = !series.axisY.niceNumbersEnabled;
253 onClicked: series.axisY.niceNumbersEnabled = !series.axisY.niceNumbersEnabled;
315 }
254 }
316 }
255 }
@@ -1,42 +1,54
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 ChartView {
24 ChartView {
25 title: "Grouped bar series"
25 title: "Grouped bar series"
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend.alignment: Qt.AlignBottom
28 legend.alignment: Qt.AlignBottom
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30
30
31 property variant series: daSeries
31 property variant series: barSeries
32
32
33 GroupedBarSeries {
33 GroupedBarSeries {
34 id: daSeries
34 id: barSeries
35 name: "bar"
35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
37 onHovered: console.log("onHovered: " + barset + " " + status);
37 onClicked: console.log("barset.onClicked: " + index);
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
43 }
39 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
45 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
46
47 onNameChanged: console.log("groupedBarSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("groupedBarSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("groupedBarSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("groupedBarSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("groupedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("groupedBarSeries.onCountChanged: " + count);
41 }
53 }
42 }
54 }
@@ -1,52 +1,60
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 ChartView {
24 ChartView {
25 property variant series: lineSeries
26
25 title: "line series"
27 title: "line series"
26 anchors.fill: parent
28 anchors.fill: parent
27
29
28 property variant series: daSeries
29
30 LineSeries {
30 LineSeries {
31 id: daSeries
31 id: lineSeries
32 name: "line 1"
32 name: "line 1"
33 onClicked: console.log("onClicked: " + point.x + ", " + point.y);
34 XyPoint { x: 0; y: 0 }
33 XyPoint { x: 0; y: 0 }
35 XyPoint { x: 1.1; y: 2.1 }
34 XyPoint { x: 1.1; y: 2.1 }
36 XyPoint { x: 1.9; y: 3.3 }
35 XyPoint { x: 1.9; y: 3.3 }
37 XyPoint { x: 2.1; y: 2.1 }
36 XyPoint { x: 2.1; y: 2.1 }
38 XyPoint { x: 2.9; y: 4.9 }
37 XyPoint { x: 2.9; y: 4.9 }
39 XyPoint { x: 3.4; y: 3.0 }
38 XyPoint { x: 3.4; y: 3.0 }
40 XyPoint { x: 4.1; y: 3.3 }
39 XyPoint { x: 4.1; y: 3.3 }
40
41 onNameChanged: console.log("lineSeries.onNameChanged: " + name);
42 onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible);
43 onClicked: console.log("lineSeries.onClicked: " + point.x + ", " + point.y);
44 onPointReplaced: console.log("lineSeries.onPointReplaced: " + index);
45 onPointRemoved: console.log("lineSeries.onPointRemoved: " + index);
46 onPointAdded: console.log("lineSeries.onPointAdded: " + index);
47 onColorChanged: console.log("lineSeries.onColorChanged: " + color);
48 onCountChanged: console.log("lineSeries.onCountChanged: " + count);
41 }
49 }
42
50
43 LineSeries {
51 LineSeries {
44 name: "line 2"
52 name: "line 2"
45 XyPoint { x: 1.1; y: 1.1 }
53 XyPoint { x: 1.1; y: 1.1 }
46 XyPoint { x: 1.9; y: 2.3 }
54 XyPoint { x: 1.9; y: 2.3 }
47 XyPoint { x: 2.1; y: 1.1 }
55 XyPoint { x: 2.1; y: 1.1 }
48 XyPoint { x: 2.9; y: 3.9 }
56 XyPoint { x: 2.9; y: 3.9 }
49 XyPoint { x: 3.4; y: 2.0 }
57 XyPoint { x: 3.4; y: 2.0 }
50 XyPoint { x: 4.1; y: 2.3 }
58 XyPoint { x: 4.1; y: 2.3 }
51 }
59 }
52 }
60 }
@@ -1,60 +1,43
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 flow: Flow.TopToBottom
29 property variant series
29 property variant series
30
30
31 onSeriesChanged: {
32 if (series && (series.name == "line 1" || series.name == "spline 1")) {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
37 }
38
39 Connections {
40 id: seriesConnections
41 target: null
42 onNameChanged: console.log("series.onNameChanged: " + series.name);
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onColorChanged: console.log("series.onColorChanged: " + series.color);
45 onCountChanged: console.log("series.onCountChanged: " + series.count);
46 }
47
48 Button {
31 Button {
49 text: "visible"
32 text: "visible"
50 onClicked: series.visible = !series.visible;
33 onClicked: series.visible = !series.visible;
51 }
34 }
52 Button {
35 Button {
53 text: "color"
36 text: "color"
54 onClicked: series.color = main.nextColor();
37 onClicked: series.color = main.nextColor();
55 }
38 }
56 Button {
39 Button {
57 text: "points visible"
40 text: "points visible"
58 onClicked: series.pointsVisible = !series.pointsVisible
41 onClicked: series.pointsVisible = !series.pointsVisible
59 }
42 }
60 }
43 }
@@ -1,42 +1,54
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 ChartView {
24 ChartView {
25 title: "Percent bar series"
25 title: "Percent bar series"
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend.alignment: Qt.AlignBottom
28 legend.alignment: Qt.AlignBottom
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30
30
31 property variant series: daSeries
31 property variant series: barSeries
32
32
33 PercentBarSeries {
33 PercentBarSeries {
34 id: daSeries
34 id: barSeries
35 name: "bar"
35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
37 onHovered: console.log("onHovered: " + barset + " " + status);
37 onClicked: console.log("barset.onClicked: " + index);
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
43 }
39 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
45 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
46
47 onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("percentBarSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("percentBarSeries.onCountChanged: " + count);
41 }
53 }
42 }
54 }
@@ -1,38 +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 ChartView {
24 ChartView {
25 id: chart
25 id: chart
26 title: "pie series"
26 title: "pie series"
27 animationOptions: ChartView.SeriesAnimations
27 animationOptions: ChartView.SeriesAnimations
28
28
29 property variant series: pieSeries
29 property variant series: pieSeries
30
30
31 PieSeries {
31 PieSeries {
32 id: pieSeries
32 id: pieSeries
33 name: "pie"
33 name: "pie"
34 PieSlice { label: "slice1"; value: 11 }
34 PieSlice { label: "slice1"; value: 11;
35 onValueChanged: console.log("slice.onValueChanged: " + value);
36 onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + labelVisible);
37 onPenChanged: console.log("slice.onPenChanged: " + pen);
38 onBorderColorChanged: console.log("slice.onBorderColorChanged: " + borderColor);
39 onBorderWidthChanged: console.log("slice.onBorderWidthChanged: " + borderWidth);
40 onBrushChanged: console.log("slice.onBrushChanged: " + brush);
41 onColorChanged: console.log("slice.onColorChanged: " + color);
42 onLabelColorChanged: console.log("slice.onLabelColorChanged: " + labelColor);
43 onLabelBrushChanged: console.log("slice.onLabelBrushChanged: " + labelBrush);
44 onLabelFontChanged: console.log("slice.onLabelFontChanged: " + labelFont);
45 onPercentageChanged: console.log("slice.onPercentageChanged: " + percentage);
46 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + startAngle);
47 onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + angleSpan);
48 onClicked: console.log("slice.onClicked: " + label);
49 onHovered: console.log("slice.onHovered: " + state);
50 }
35 PieSlice { label: "slice2"; value: 22 }
51 PieSlice { label: "slice2"; value: 22 }
36 PieSlice { label: "slice3"; value: 33 }
52 PieSlice { label: "slice3"; value: 33 }
53 PieSlice { label: "slice4"; value: 44 }
54
55 onNameChanged: console.log("pieSeries.onNameChanged: " + series.name);
56 onVisibleChanged: console.log("pieSeries.onVisibleChanged: " + series.visible);
57 onClicked: console.log("pieSeries.onClicked: " + slice.label);
58 onHovered: console.log("pieSeries.onHovered: " + slice.label);
59 onAdded: console.log("pieSeries.onAdded: " + slices);
60 onSliceAdded: console.log("pieSeries.onSliceAdded: " + slice.label);
61 onRemoved: console.log("pieSeries.onRemoved: " + slices);
62 onSliceRemoved: console.log("pieSeries.onSliceRemoved: " + slice.label);
63 onCountChanged: console.log("pieSeries.onCountChanged: " + series.count);
64 onSumChanged: console.log("pieSeries.onSumChanged: " + series.sum);
37 }
65 }
38 }
66 }
@@ -1,164 +1,130
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 flow: Flow.TopToBottom
28 property variant series
28 property variant series
29
29
30 onSeriesChanged: {
31 if (series && series.name == "pie") {
32 seriesConnections.target = series;
33 sliceConnections.target = series.at(0);
34 } else {
35 seriesConnections.target = null;
36 sliceConnections.target = null;
37 }
38 }
39
40 Connections {
41 id: seriesConnections
42 target: null
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onCountChanged: console.log("series.onCountChanged: " + series.count);
45 onSumChanged: console.log("series.onSumChanged: " + series.sum);
46 }
47
48 Connections {
49 id: sliceConnections
50 target: null
51 onValueChanged: console.log("slice.onValueChanged: " + series.at(0).value);
52 onLabelVisibleChanged: console.log("slice.onLabelVisibleChanged: " + series.at(0).labelVisible);
53 onPenChanged: console.log("slice.onPenChanged: " + series.at(0).pen);
54 onBorderColorChanged: console.log("slice.onBorderColorChanged: " + series.at(0).borderColor);
55 onBorderWidthChanged: console.log("slice.onBorderWidthChanged: " + series.at(0).borderWidth);
56 onBrushChanged: console.log("slice.onBrushChanged: " + series.at(0).brush);
57 onColorChanged: console.log("slice.onColorChanged: " + series.at(0).color);
58 onLabelColorChanged: console.log("slice.onLabelColorChanged: " + series.at(0).labelColor);
59 onLabelBrushChanged: console.log("slice.onLabelBrushChanged: " + series.at(0).labelBrush);
60 onLabelFontChanged: console.log("slice.onLabelFontChanged: " + series.at(0).labelFont);
61 onPercentageChanged: console.log("slice.onPercentageChanged: " + series.at(0).percentage);
62 onStartAngleChanged: console.log("slice.onStartAngleChanged: " + series.at(0).startAngle);
63 onAngleSpanChanged: console.log("slice.onAngleSpanChanged: " + series.at(0).angleSpan);
64 onClicked: console.log("slice.onClicked");
65 onHovered: console.log("slice.onHovered: " + state);
66 }
67
68 Button {
30 Button {
69 text: "visible"
31 text: "visible"
70 onClicked: series.visible = !series.visible;
32 onClicked: series.visible = !series.visible;
71 }
33 }
72 Button {
34 Button {
73 text: "series hpos +"
35 text: "series hpos +"
74 onClicked: series.horizontalPosition += 0.1;
36 onClicked: series.horizontalPosition += 0.1;
75 }
37 }
76 Button {
38 Button {
77 text: "series hpos -"
39 text: "series hpos -"
78 onClicked: series.horizontalPosition -= 0.1;
40 onClicked: series.horizontalPosition -= 0.1;
79 }
41 }
80 Button {
42 Button {
81 text: "series vpos +"
43 text: "series vpos +"
82 onClicked: series.verticalPosition += 0.1;
44 onClicked: series.verticalPosition += 0.1;
83 }
45 }
84 Button {
46 Button {
85 text: "series vpos -"
47 text: "series vpos -"
86 onClicked: series.verticalPosition -= 0.1;
48 onClicked: series.verticalPosition -= 0.1;
87 }
49 }
88 Button {
50 Button {
89 text: "series size +"
51 text: "series size +"
90 onClicked: series.size += 0.1;
52 onClicked: series.size += 0.1;
91 }
53 }
92 Button {
54 Button {
93 text: "series size -"
55 text: "series size -"
94 onClicked: series.size -= 0.1;
56 onClicked: series.size -= 0.1;
95 }
57 }
96 Button {
58 Button {
97 text: "series start angle +"
59 text: "series start angle +"
98 onClicked: series.startAngle += 1.1;
60 onClicked: series.startAngle += 1.1;
99 }
61 }
100 Button {
62 Button {
101 text: "series start angle -"
63 text: "series start angle -"
102 onClicked: series.startAngle -= 1.1;
64 onClicked: series.startAngle -= 1.1;
103 }
65 }
104 Button {
66 Button {
105 text: "series end angle +"
67 text: "series end angle +"
106 onClicked: series.endAngle += 1.1;
68 onClicked: series.endAngle += 1.1;
107 }
69 }
108 Button {
70 Button {
109 text: "series end angle -"
71 text: "series end angle -"
110 onClicked: series.endAngle -= 1.1;
72 onClicked: series.endAngle -= 1.1;
111 }
73 }
112 Button {
74 Button {
75 text: "remove slice"
76 onClicked: series.remove(series.count - 1);
77 }
78 Button {
113 text: "slice color"
79 text: "slice color"
114 onClicked: series.at(0).color = main.nextColor();
80 onClicked: series.at(0).color = main.nextColor();
115 }
81 }
116 Button {
82 Button {
117 text: "slice border color"
83 text: "slice border color"
118 onClicked: series.at(0).borderColor = main.nextColor();
84 onClicked: series.at(0).borderColor = main.nextColor();
119 }
85 }
120 Button {
86 Button {
121 text: "slice border width +"
87 text: "slice border width +"
122 onClicked: series.at(0).borderWidth++;
88 onClicked: series.at(0).borderWidth++;
123 }
89 }
124 Button {
90 Button {
125 text: "slice border width -"
91 text: "slice border width -"
126 onClicked: series.at(0).borderWidth--;
92 onClicked: series.at(0).borderWidth--;
127 }
93 }
128 Button {
94 Button {
129 text: "slice label visible"
95 text: "slice label visible"
130 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
96 onClicked: series.at(0).labelVisible = !series.at(0).labelVisible;
131 }
97 }
132 Button {
98 Button {
133 text: "slice label position inside"
99 text: "slice label position inside"
134 onClicked: series.at(0).labelPosition = PieSlice.LabelInside;
100 onClicked: series.at(0).labelPosition = PieSlice.LabelInside;
135 }
101 }
136 Button {
102 Button {
137 text: "slice label position outside"
103 text: "slice label position outside"
138 onClicked: series.at(0).labelPosition = PieSlice.LabelOutside;
104 onClicked: series.at(0).labelPosition = PieSlice.LabelOutside;
139 }
105 }
140 Button {
106 Button {
141 text: "slice label arm len +"
107 text: "slice label arm len +"
142 onClicked: series.at(0).labelArmLengthFactor += 0.1;
108 onClicked: series.at(0).labelArmLengthFactor += 0.1;
143 }
109 }
144 Button {
110 Button {
145 text: "slice label arm len -"
111 text: "slice label arm len -"
146 onClicked: series.at(0).labelArmLengthFactor -= 0.1;
112 onClicked: series.at(0).labelArmLengthFactor -= 0.1;
147 }
113 }
148 Button {
114 Button {
149 text: "slice label color"
115 text: "slice label color"
150 onClicked: series.at(0).labelColor = main.nextColor();
116 onClicked: series.at(0).labelColor = main.nextColor();
151 }
117 }
152 Button {
118 Button {
153 text: "slice exploded"
119 text: "slice exploded"
154 onClicked: series.at(0).exploded = !series.at(0).exploded;
120 onClicked: series.at(0).exploded = !series.at(0).exploded;
155 }
121 }
156 Button {
122 Button {
157 text: "slice explode dist +"
123 text: "slice explode dist +"
158 onClicked: series.at(0).explodeDistanceFactor += 0.1;
124 onClicked: series.at(0).explodeDistanceFactor += 0.1;
159 }
125 }
160 Button {
126 Button {
161 text: "slice explode dist -"
127 text: "slice explode dist -"
162 onClicked: series.at(0).explodeDistanceFactor -= 0.1;
128 onClicked: series.at(0).explodeDistanceFactor -= 0.1;
163 }
129 }
164 }
130 }
@@ -1,51 +1,57
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 import QtQuick 1.0
21 import QtQuick 1.0
22 import QtCommercial.Chart 1.0
22 import QtCommercial.Chart 1.0
23
23
24 ChartView {
24 ChartView {
25 title: "scatter series"
25 title: "scatter series"
26 axisX.max: 4
26 axisX.max: 4
27 axisY.max: 4
27 axisY.max: 4
28 property variant series: daSeries
28 property variant series: scatterSeries
29
29
30 ScatterSeries {
30 ScatterSeries {
31 id: daSeries
31 id: scatterSeries
32 name: "scatter 1"
32 name: "scatter 1"
33 XyPoint { x: 1.5; y: 1.5 }
33 XyPoint { x: 1.5; y: 1.5 }
34 XyPoint { x: 1.5; y: 1.6 }
34 XyPoint { x: 1.5; y: 1.6 }
35 XyPoint { x: 1.57; y: 1.55 }
35 XyPoint { x: 1.57; y: 1.55 }
36 XyPoint { x: 1.8; y: 1.8 }
36 XyPoint { x: 1.8; y: 1.8 }
37 XyPoint { x: 1.9; y: 1.6 }
37 XyPoint { x: 1.9; y: 1.6 }
38 XyPoint { x: 2.1; y: 1.3 }
38 XyPoint { x: 2.1; y: 1.3 }
39 XyPoint { x: 2.5; y: 2.1 }
39 XyPoint { x: 2.5; y: 2.1 }
40
41 onNameChanged: console.log("scatterSeries.onNameChanged: " + name);
42 onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
43 onColorChanged: console.log("scatterSeries.onColorChanged: " + color);
44 onBorderColorChanged: console.log("scatterSeries.onBorderColorChanged: " + borderColor);
45 onCountChanged: console.log("scatterSeries.onCountChanged: " + count);
40 }
46 }
41
47
42 ScatterSeries {
48 ScatterSeries {
43 name: "scatter2"
49 name: "scatter2"
44 XyPoint { x: 2.0; y: 2.0 }
50 XyPoint { x: 2.0; y: 2.0 }
45 XyPoint { x: 2.0; y: 2.1 }
51 XyPoint { x: 2.0; y: 2.1 }
46 XyPoint { x: 2.07; y: 2.05 }
52 XyPoint { x: 2.07; y: 2.05 }
47 XyPoint { x: 2.2; y: 2.9 }
53 XyPoint { x: 2.2; y: 2.9 }
48 XyPoint { x: 2.4; y: 2.7 }
54 XyPoint { x: 2.4; y: 2.7 }
49 XyPoint { x: 2.67; y: 2.65 }
55 XyPoint { x: 2.67; y: 2.65 }
50 }
56 }
51 }
57 }
@@ -1,73 +1,55
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 flow: Flow.TopToBottom
29 property variant series
29 property variant series
30
30
31 onSeriesChanged: {
32 if (series && series.name == "scatter 1") {
33 seriesConnections.target = series;
34 } else {
35 seriesConnections.target = null;
36 }
37 }
38
39 Connections {
40 id: seriesConnections
41 target: null
42 onNameChanged: console.log("series.onNameChanged: " + series.name);
43 onVisibleChanged: console.log("series.onVisibleChanged: " + series.visible);
44 onColorChanged: console.log("series.onColorChanged: " + series.color);
45 onBorderColorChanged: console.log("series.onBorderColorChanged: " + series.borderColor);
46 onCountChanged: console.log("series.onCountChanged: " + series.count);
47 }
48
49 Button {
31 Button {
50 text: "visible"
32 text: "visible"
51 onClicked: series.visible = !series.visible;
33 onClicked: series.visible = !series.visible;
52 }
34 }
53 Button {
35 Button {
54 text: "color"
36 text: "color"
55 onClicked: series.color = main.nextColor();
37 onClicked: series.color = main.nextColor();
56 }
38 }
57 Button {
39 Button {
58 text: "borderColor"
40 text: "borderColor"
59 onClicked: series.borderColor = main.nextColor();
41 onClicked: series.borderColor = main.nextColor();
60 }
42 }
61 Button {
43 Button {
62 text: "markerSize +"
44 text: "markerSize +"
63 onClicked: series.markerSize += 1.0;
45 onClicked: series.markerSize += 1.0;
64 }
46 }
65 Button {
47 Button {
66 text: "markerSize -"
48 text: "markerSize -"
67 onClicked: series.markerSize -= 1.0;
49 onClicked: series.markerSize -= 1.0;
68 }
50 }
69 Button {
51 Button {
70 text: "markerShape"
52 text: "markerShape"
71 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
53 onClicked: series.markerShape = ((series.markerShape + 1) % 2);
72 }
54 }
73 }
55 }
@@ -1,50 +1,59
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 ChartView {
24 ChartView {
25 title: "spline series"
25 title: "spline series"
26 anchors.fill: parent
26 anchors.fill: parent
27 property variant series: daSeries
27 property variant series: splineSeries
28
28
29 SplineSeries {
29 SplineSeries {
30 id: daSeries
30 id: splineSeries
31 name: "spline 1"
31 name: "spline 1"
32 XyPoint { x: 0; y: 0 }
32 XyPoint { x: 0; y: 0 }
33 XyPoint { x: 1.1; y: 2.1 }
33 XyPoint { x: 1.1; y: 2.1 }
34 XyPoint { x: 1.9; y: 3.3 }
34 XyPoint { x: 1.9; y: 3.3 }
35 XyPoint { x: 2.1; y: 2.1 }
35 XyPoint { x: 2.1; y: 2.1 }
36 XyPoint { x: 2.9; y: 4.9 }
36 XyPoint { x: 2.9; y: 4.9 }
37 XyPoint { x: 3.4; y: 3.0 }
37 XyPoint { x: 3.4; y: 3.0 }
38 XyPoint { x: 4.1; y: 3.3 }
38 XyPoint { x: 4.1; y: 3.3 }
39
40 onNameChanged: console.log("splineSeries.onNameChanged: " + name);
41 onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
42 onClicked: console.log("splineSeries.onClicked: " + point.x + ", " + point.y);
43 onPointReplaced: console.log("splineSeries.onPointReplaced: " + index);
44 onPointRemoved: console.log("splineSeries.onPointRemoved: " + index);
45 onPointAdded: console.log("splineSeries.onPointAdded: " + index);
46 onColorChanged: console.log("splineSeries.onColorChanged: " + color);
47 onCountChanged: console.log("splineSeries.onCountChanged: " + count);
39 }
48 }
40
49
41 SplineSeries {
50 SplineSeries {
42 name: "spline 2"
51 name: "spline 2"
43 XyPoint { x: 1.1; y: 1.1 }
52 XyPoint { x: 1.1; y: 1.1 }
44 XyPoint { x: 1.9; y: 2.3 }
53 XyPoint { x: 1.9; y: 2.3 }
45 XyPoint { x: 2.1; y: 1.1 }
54 XyPoint { x: 2.1; y: 1.1 }
46 XyPoint { x: 2.9; y: 3.9 }
55 XyPoint { x: 2.9; y: 3.9 }
47 XyPoint { x: 3.4; y: 2.0 }
56 XyPoint { x: 3.4; y: 2.0 }
48 XyPoint { x: 4.1; y: 2.3 }
57 XyPoint { x: 4.1; y: 2.3 }
49 }
58 }
50 }
59 }
@@ -1,42 +1,54
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 ChartView {
24 ChartView {
25 title: "Stacked bar series"
25 title: "Stacked bar series"
26 anchors.fill: parent
26 anchors.fill: parent
27 theme: ChartView.ChartThemeLight
27 theme: ChartView.ChartThemeLight
28 legend.alignment: Qt.AlignBottom
28 legend.alignment: Qt.AlignBottom
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
29 axisXLabels: ["0", "2007", "1", "2008", "2", "2009", "3", "2010", "4", "2011", "5", "2012"]
30
30
31 property variant series: daSeries
31 property variant series: barSeries
32
32
33 StackedBarSeries {
33 StackedBarSeries {
34 id: daSeries
34 id: barSeries
35 name: "bar"
35 name: "bar"
36 onClicked: console.log("onClicked: " + barset + " " + index);
36 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6]
37 onHovered: console.log("onHovered: " + barset + " " + status);
37 onClicked: console.log("barset.onClicked: " + index);
38 BarSet { label: "Bob"; values: [2, 2, 3, 4, 5, 6] }
38 onHovered: console.log("barset.onHovered: " + status);
39 onColorChanged: console.log("barset.onColorChanged: " + color);
40 onBorderColorChanged: console.log("barset.onBorderColorChanged: " + color);
41 onLabelColorChanged: console.log("barset.onLabelColorChanged: " + color);
42 onCountChanged: console.log("barset.onCountChanged: " + count);
43 }
39 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
44 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
40 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
45 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
46
47 onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name);
48 onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible);
49 onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index);
50 onHovered: console.log("stackedBarSeries.onHovered: " + barset + " " + status);
51 onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
52 onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count);
41 }
53 }
42 }
54 }
@@ -1,126 +1,125
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: 10
29 property int viewCount: 10
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]);
36 return colors[colorIndex % colors.length];
35 return colors[colorIndex % colors.length];
37 }
36 }
38
37
39 onViewNumberChanged: {
38 onViewNumberChanged: {
40 if (viewNumber == 0) {
39 if (viewNumber == 0) {
41 chartLoader.source = "Chart.qml";
40 chartLoader.source = "Chart.qml";
42 editorLoader.source = "ChartEditor.qml";
41 editorLoader.source = "ChartEditor.qml";
43 } else if (viewNumber == 1) {
42 } else if (viewNumber == 1) {
44 chartLoader.source = "PieChart.qml";
43 chartLoader.source = "PieChart.qml";
45 editorLoader.source = "PieEditor.qml";
44 editorLoader.source = "PieEditor.qml";
46 } else if (viewNumber == 2) {
45 } else if (viewNumber == 2) {
47 chartLoader.source = "LineChart.qml";
46 chartLoader.source = "LineChart.qml";
48 editorLoader.source = "LineEditor.qml";
47 editorLoader.source = "LineEditor.qml";
49 } else if (viewNumber == 3) {
48 } else if (viewNumber == 3) {
50 chartLoader.source = "SplineChart.qml";
49 chartLoader.source = "SplineChart.qml";
51 editorLoader.source = "LineEditor.qml";
50 editorLoader.source = "LineEditor.qml";
52 } else if (viewNumber == 4) {
51 } else if (viewNumber == 4) {
53 chartLoader.source = "ScatterChart.qml";
52 chartLoader.source = "ScatterChart.qml";
54 editorLoader.source = "ScatterEditor.qml";
53 editorLoader.source = "ScatterEditor.qml";
55 } else if (viewNumber == 5) {
54 } else if (viewNumber == 5) {
56 chartLoader.source = "AreaChart.qml";
55 chartLoader.source = "AreaChart.qml";
57 editorLoader.source = "AreaEditor.qml";
56 editorLoader.source = "AreaEditor.qml";
58 } else if (viewNumber == 6) {
57 } else if (viewNumber == 6) {
59 chartLoader.source = "BarChart.qml";
58 chartLoader.source = "BarChart.qml";
60 editorLoader.source = "BarEditor.qml";
59 editorLoader.source = "BarEditor.qml";
61 } else if (viewNumber == 7) {
60 } else if (viewNumber == 7) {
62 chartLoader.source = "GroupedBarChart.qml";
61 chartLoader.source = "GroupedBarChart.qml";
63 editorLoader.source = "BarEditor.qml";
62 editorLoader.source = "BarEditor.qml";
64 } else if (viewNumber == 8) {
63 } else if (viewNumber == 8) {
65 chartLoader.source = "StackedBarChart.qml";
64 chartLoader.source = "StackedBarChart.qml";
66 editorLoader.source = "BarEditor.qml";
65 editorLoader.source = "BarEditor.qml";
67 } else if (viewNumber == 9) {
66 } else if (viewNumber == 9) {
68 chartLoader.source = "PercentBarChart.qml";
67 chartLoader.source = "PercentBarChart.qml";
69 editorLoader.source = "BarEditor.qml";
68 editorLoader.source = "BarEditor.qml";
70 } else {
69 } else {
71 console.log("Illegal view number");
70 console.log("Illegal view number");
72 }
71 }
73 }
72 }
74
73
75 Row {
74 Row {
76 anchors.top: parent.top
75 anchors.top: parent.top
77 anchors.bottom: buttonRow.top
76 anchors.bottom: buttonRow.top
78 anchors.bottomMargin: 10
77 anchors.bottomMargin: 10
79 anchors.left: parent.left
78 anchors.left: parent.left
80 anchors.right: parent.right
79 anchors.right: parent.right
81
80
82 Loader {
81 Loader {
83 id: chartLoader
82 id: chartLoader
84 width: main.width - editorLoader.width
83 width: main.width - editorLoader.width
85 height: parent.height
84 height: parent.height
86 source: "Chart.qml"
85 source: "Chart.qml"
87 onStatusChanged: {
86 onStatusChanged: {
88 if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item)
87 if (status == Loader.Ready && editorLoader.status == Loader.Ready && chartLoader.item)
89 editorLoader.item.series = chartLoader.item.series;
88 editorLoader.item.series = chartLoader.item.series;
90 }
89 }
91 }
90 }
92
91
93 Loader {
92 Loader {
94 id: editorLoader
93 id: editorLoader
95 width: 280
94 width: 280
96 height: parent.height
95 height: parent.height
97 source: "ChartEditor.qml"
96 source: "ChartEditor.qml"
98 onStatusChanged: {
97 onStatusChanged: {
99 if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item)
98 if (status == Loader.Ready && chartLoader.status == Loader.Ready && chartLoader.item)
100 editorLoader.item.series = chartLoader.item.series;
99 editorLoader.item.series = chartLoader.item.series;
101 }
100 }
102 }
101 }
103 }
102 }
104
103
105 Row {
104 Row {
106 id: buttonRow
105 id: buttonRow
107 height: 40
106 height: 40
108 anchors.bottom: parent.bottom
107 anchors.bottom: parent.bottom
109 anchors.horizontalCenter: parent.horizontalCenter
108 anchors.horizontalCenter: parent.horizontalCenter
110 spacing: 10
109 spacing: 10
111
110
112 Button {
111 Button {
113 text: "previous"
112 text: "previous"
114 onClicked: {
113 onClicked: {
115 viewNumber = (viewNumber + viewCount - 1) % viewCount;
114 viewNumber = (viewNumber + viewCount - 1) % viewCount;
116 }
115 }
117 }
116 }
118
117
119 Button {
118 Button {
120 text: "next"
119 text: "next"
121 onClicked: {
120 onClicked: {
122 viewNumber = (viewNumber + 1) % viewCount;
121 viewNumber = (viewNumber + 1) % viewCount;
123 }
122 }
124 }
123 }
125 }
124 }
126 }
125 }
General Comments 0
You need to be logged in to leave comments. Login now