##// END OF EJS Templates
Added opacity property to QAbstractSeries
Tero Ahola -
r2067:10f778f66485
parent child
Show More
@@ -58,6 +58,7 class ChartQmlPlugin : public QDeclarativeExtensionPlugin
58 Q_OBJECT
58 Q_OBJECT
59
59
60 #ifdef QT5_QUICK_1
60 #ifdef QT5_QUICK_1
61 // TODO: fix the metadata
61 Q_PLUGIN_METADATA(IID "org.qt-project.foo")
62 Q_PLUGIN_METADATA(IID "org.qt-project.foo")
62 #endif
63 #endif
63
64
@@ -48,6 +48,7 AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, ChartPresenter *presenter)
48
48
49 QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated()));
49 QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated()));
50 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
50 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
51 QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
51 QObject::connect(this,SIGNAL(clicked(QPointF)),areaSeries,SIGNAL(clicked(QPointF)));
52 QObject::connect(this,SIGNAL(clicked(QPointF)),areaSeries,SIGNAL(clicked(QPointF)));
52
53
53 handleUpdated();
54 handleUpdated();
@@ -98,6 +99,7 void AreaChartItem::handleUpdated()
98 m_brush = m_series->brush();
99 m_brush = m_series->brush();
99 m_pointPen = m_series->pen();
100 m_pointPen = m_series->pen();
100 m_pointPen.setWidthF(2 * m_pointPen.width());
101 m_pointPen.setWidthF(2 * m_pointPen.width());
102 setOpacity(m_series->opacity());
101
103
102 update();
104 update();
103 }
105 }
@@ -45,6 +45,7 AbstractBarChartItem::AbstractBarChartItem(QAbstractBarSeries *series, ChartPres
45 connect(series->d_func(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
45 connect(series->d_func(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
46 connect(series->d_func(), SIGNAL(restructuredBars()), this, SLOT(handleDataStructureChanged()));
46 connect(series->d_func(), SIGNAL(restructuredBars()), this, SLOT(handleDataStructureChanged()));
47 connect(series, SIGNAL(visibleChanged()), this, SLOT(handleVisibleChanged()));
47 connect(series, SIGNAL(visibleChanged()), this, SLOT(handleVisibleChanged()));
48 connect(series, SIGNAL(opacityChanged()), this, SLOT(handleOpacityChanged()));
48 setZValue(ChartPresenter::BarSeriesZValue);
49 setZValue(ChartPresenter::BarSeriesZValue);
49 handleDataStructureChanged();
50 handleDataStructureChanged();
50 }
51 }
@@ -170,9 +171,14 void AbstractBarChartItem::handleVisibleChanged()
170 {
171 {
171 bool visible = m_series->isVisible();
172 bool visible = m_series->isVisible();
172 handleLabelsVisibleChanged(visible);
173 handleLabelsVisibleChanged(visible);
173 foreach(QGraphicsItem *item, childItems()) {
174 foreach(QGraphicsItem *item, childItems())
174 item->setVisible(visible);
175 item->setVisible(visible);
175 }
176 }
177
178 void AbstractBarChartItem::handleOpacityChanged()
179 {
180 foreach(QGraphicsItem *item, childItems())
181 item->setOpacity(m_series->opacity());
176 }
182 }
177
183
178 void AbstractBarChartItem::handleUpdatedBars()
184 void AbstractBarChartItem::handleUpdatedBars()
@@ -68,6 +68,7 public Q_SLOTS:
68 void handleLabelsVisibleChanged(bool visible);
68 void handleLabelsVisibleChanged(bool visible);
69 void handleDataStructureChanged(); // structure of of series has changed, recreate graphic items
69 void handleDataStructureChanged(); // structure of of series has changed, recreate graphic items
70 void handleVisibleChanged();
70 void handleVisibleChanged();
71 void handleOpacityChanged();
71 void handleUpdatedBars();
72 void handleUpdatedBars();
72
73
73 protected:
74 protected:
@@ -38,6 +38,7 LineChartItem::LineChartItem(QLineSeries* series,ChartPresenter *presenter):
38 setZValue(ChartPresenter::LineChartZValue);
38 setZValue(ChartPresenter::LineChartZValue);
39 QObject::connect(series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated()));
39 QObject::connect(series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated()));
40 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
40 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
41 QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
41 handleUpdated();
42 handleUpdated();
42 }
43 }
43
44
@@ -103,6 +104,7 void LineChartItem::updateGeometry()
103 void LineChartItem::handleUpdated()
104 void LineChartItem::handleUpdated()
104 {
105 {
105 setVisible(m_series->isVisible());
106 setVisible(m_series->isVisible());
107 setOpacity(m_series->opacity());
106 m_pointsVisible = m_series->pointsVisible();
108 m_pointsVisible = m_series->pointsVisible();
107 m_linePen = m_series->pen();
109 m_linePen = m_series->pen();
108 update();
110 update();
@@ -41,6 +41,7 PieChartItem::PieChartItem(QPieSeries *series, ChartPresenter* presenter)
41
41
42 QPieSeriesPrivate *p = QPieSeriesPrivate::fromSeries(series);
42 QPieSeriesPrivate *p = QPieSeriesPrivate::fromSeries(series);
43 connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
43 connect(series, SIGNAL(visibleChanged()), this, SLOT(handleSeriesVisibleChanged()));
44 connect(series, SIGNAL(opacityChanged()), this, SLOT(handleOpacityChanged()));
44 connect(series, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleSlicesAdded(QList<QPieSlice*>)));
45 connect(series, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleSlicesAdded(QList<QPieSlice*>)));
45 connect(series, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleSlicesRemoved(QList<QPieSlice*>)));
46 connect(series, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleSlicesRemoved(QList<QPieSlice*>)));
46 connect(p, SIGNAL(horizontalPositionChanged()), this, SLOT(updateLayout()));
47 connect(p, SIGNAL(horizontalPositionChanged()), this, SLOT(updateLayout()));
@@ -228,6 +229,11 void PieChartItem::handleSeriesVisibleChanged()
228 setVisible(m_series->isVisible());
229 setVisible(m_series->isVisible());
229 }
230 }
230
231
232 void PieChartItem::handleOpacityChanged()
233 {
234 setOpacity(m_series->opacity());
235 }
236
231 PieSliceData PieChartItem::updateSliceGeometry(QPieSlice *slice)
237 PieSliceData PieChartItem::updateSliceGeometry(QPieSlice *slice)
232 {
238 {
233 PieSliceData &sliceData = QPieSlicePrivate::fromSlice(slice)->m_data;
239 PieSliceData &sliceData = QPieSlicePrivate::fromSlice(slice)->m_data;
@@ -65,6 +65,7 public Q_SLOTS:
65 void handleSlicesRemoved(QList<QPieSlice*> slices);
65 void handleSlicesRemoved(QList<QPieSlice*> slices);
66 void handleSliceChanged();
66 void handleSliceChanged();
67 void handleSeriesVisibleChanged();
67 void handleSeriesVisibleChanged();
68 void handleOpacityChanged();
68
69
69 void setAnimation(PieAnimation* animation);
70 void setAnimation(PieAnimation* animation);
70 ChartAnimation* animation() const;
71 ChartAnimation* animation() const;
@@ -151,6 +151,19 bool QAbstractSeries::isVisible() const
151 return d_ptr->m_visible;
151 return d_ptr->m_visible;
152 }
152 }
153
153
154 qreal QAbstractSeries::opacity() const
155 {
156 return d_ptr->m_opacity;
157 }
158
159 void QAbstractSeries::setOpacity(qreal opacity)
160 {
161 if (opacity != d_ptr->m_opacity) {
162 d_ptr->m_opacity = opacity;
163 emit opacityChanged();
164 }
165 }
166
154 /*!
167 /*!
155 \brief Returns the chart where series belongs to.
168 \brief Returns the chart where series belongs to.
156
169
@@ -193,7 +206,8 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries* q):
193 q_ptr(q),
206 q_ptr(q),
194 m_chart(0),
207 m_chart(0),
195 m_dataset(0),
208 m_dataset(0),
196 m_visible(true)
209 m_visible(true),
210 m_opacity(1.0)
197 {
211 {
198 }
212 }
199
213
@@ -36,6 +36,7 class QTCOMMERCIALCHART_EXPORT QAbstractSeries : public QObject
36 Q_OBJECT
36 Q_OBJECT
37 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
37 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
38 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
38 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
39 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
39 Q_PROPERTY(SeriesType type READ type)
40 Q_PROPERTY(SeriesType type READ type)
40 Q_ENUMS(SeriesType)
41 Q_ENUMS(SeriesType)
41
42
@@ -65,6 +66,9 public:
65 QString name() const;
66 QString name() const;
66 void setVisible(bool visible = true);
67 void setVisible(bool visible = true);
67 bool isVisible() const;
68 bool isVisible() const;
69 qreal opacity() const;
70 void setOpacity(qreal opacity);
71
68 QChart* chart() const;
72 QChart* chart() const;
69
73
70 void show();
74 void show();
@@ -73,6 +77,7 public:
73 Q_SIGNALS:
77 Q_SIGNALS:
74 void nameChanged();
78 void nameChanged();
75 void visibleChanged();
79 void visibleChanged();
80 void opacityChanged();
76
81
77 protected:
82 protected:
78 QScopedPointer<QAbstractSeriesPrivate> d_ptr;
83 QScopedPointer<QAbstractSeriesPrivate> d_ptr;
@@ -61,6 +61,7 protected:
61 ChartDataSet *m_dataset;
61 ChartDataSet *m_dataset;
62 QString m_name;
62 QString m_name;
63 bool m_visible;
63 bool m_visible;
64 qreal m_opacity;
64
65
65 friend class QAbstractSeries;
66 friend class QAbstractSeries;
66 friend class ChartDataSet;
67 friend class ChartDataSet;
@@ -40,6 +40,7 ScatterChartItem::ScatterChartItem(QScatterSeries *series, ChartPresenter *prese
40 {
40 {
41 QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(handleUpdated()));
41 QObject::connect(m_series->d_func(),SIGNAL(updated()), this, SLOT(handleUpdated()));
42 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
42 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
43 QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
43
44
44 setZValue(ChartPresenter::ScatterSeriesZValue);
45 setZValue(ChartPresenter::ScatterSeriesZValue);
45 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
46 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
@@ -174,6 +175,7 void ScatterChartItem::handleUpdated()
174 m_visible = m_series->isVisible();
175 m_visible = m_series->isVisible();
175 m_size = m_series->markerSize();
176 m_size = m_series->markerSize();
176 m_shape = m_series->markerShape();
177 m_shape = m_series->markerShape();
178 setOpacity(m_series->opacity());
177
179
178 if(recreate) {
180 if(recreate) {
179 // TODO: optimize handleUpdate to recreate points only in case shape changed
181 // TODO: optimize handleUpdate to recreate points only in case shape changed
@@ -37,6 +37,7 SplineChartItem::SplineChartItem(QSplineSeries *series, ChartPresenter *presente
37 setZValue(ChartPresenter::SplineChartZValue);
37 setZValue(ChartPresenter::SplineChartZValue);
38 QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated()));
38 QObject::connect(m_series->d_func(),SIGNAL(updated()),this,SLOT(handleUpdated()));
39 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
39 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
40 QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
40 handleUpdated();
41 handleUpdated();
41 }
42 }
42
43
@@ -135,6 +136,7 void SplineChartItem::updateGeometry()
135 void SplineChartItem::handleUpdated()
136 void SplineChartItem::handleUpdated()
136 {
137 {
137 setVisible(m_series->isVisible());
138 setVisible(m_series->isVisible());
139 setOpacity(m_series->opacity());
138 m_pointsVisible = m_series->pointsVisible();
140 m_pointsVisible = m_series->pointsVisible();
139 m_linePen = m_series->pen();
141 m_linePen = m_series->pen();
140 m_pointPen = m_series->pen();
142 m_pointPen = m_series->pen();
@@ -59,6 +59,7 private slots:
59 void barSets();
59 void barSets();
60 void setLabelsVisible_data();
60 void setLabelsVisible_data();
61 void setLabelsVisible();
61 void setLabelsVisible();
62 void opacity();
62 void mouseclicked_data();
63 void mouseclicked_data();
63 void mouseclicked();
64 void mouseclicked();
64 void mousehovered_data();
65 void mousehovered_data();
@@ -342,6 +343,25 void tst_QBarSeries::setLabelsVisible()
342 QVERIFY(m_barseries_with_sets->isLabelsVisible() == true);
343 QVERIFY(m_barseries_with_sets->isLabelsVisible() == true);
343 }
344 }
344
345
346 void tst_QBarSeries::opacity()
347 {
348 QSignalSpy opacitySpy(m_barseries, SIGNAL(opacityChanged()));
349
350 QCOMPARE(m_barseries->opacity(), 1.0);
351
352 m_barseries->setOpacity(0.5);
353 QCOMPARE(m_barseries->opacity(), 0.5);
354 QCOMPARE(opacitySpy.count(), 1);
355
356 m_barseries->setOpacity(0.0);
357 QCOMPARE(m_barseries->opacity(), 0.0);
358 QCOMPARE(opacitySpy.count(), 2);
359
360 m_barseries->setOpacity(1.0);
361 QCOMPARE(m_barseries->opacity(), 1.0);
362 QCOMPARE(opacitySpy.count(), 3);
363 }
364
345 void tst_QBarSeries::mouseclicked_data()
365 void tst_QBarSeries::mouseclicked_data()
346 {
366 {
347
367
@@ -97,6 +97,7 void tst_qpieseries::properties()
97 {
97 {
98 QSignalSpy countSpy(m_series, SIGNAL(countChanged()));
98 QSignalSpy countSpy(m_series, SIGNAL(countChanged()));
99 QSignalSpy sumSpy(m_series, SIGNAL(sumChanged()));
99 QSignalSpy sumSpy(m_series, SIGNAL(sumChanged()));
100 QSignalSpy opacitySpy(m_series, SIGNAL(opacityChanged()));
100
101
101 QVERIFY(m_series->type() == QAbstractSeries::SeriesTypePie);
102 QVERIFY(m_series->type() == QAbstractSeries::SeriesTypePie);
102 QVERIFY(m_series->count() == 0);
103 QVERIFY(m_series->count() == 0);
@@ -107,6 +108,7 void tst_qpieseries::properties()
107 QCOMPARE(m_series->pieSize(), 0.7);
108 QCOMPARE(m_series->pieSize(), 0.7);
108 QCOMPARE(m_series->pieStartAngle(), 0.0);
109 QCOMPARE(m_series->pieStartAngle(), 0.0);
109 QCOMPARE(m_series->pieEndAngle(), 360.0);
110 QCOMPARE(m_series->pieEndAngle(), 360.0);
111 QCOMPARE(m_series->opacity(), 1.0);
110
112
111 m_series->append("s1", 1);
113 m_series->append("s1", 1);
112 m_series->append("s2", 1);
114 m_series->append("s2", 1);
@@ -167,6 +169,16 void tst_qpieseries::properties()
167 m_series->setVerticalPosition(1.0);
169 m_series->setVerticalPosition(1.0);
168 m_series->setVerticalPosition(2.0);
170 m_series->setVerticalPosition(2.0);
169 QCOMPARE(m_series->verticalPosition(), 1.0);
171 QCOMPARE(m_series->verticalPosition(), 1.0);
172
173 m_series->setOpacity(0.5);
174 QCOMPARE(m_series->opacity(), 0.5);
175 QCOMPARE(opacitySpy.count(), 1);
176 m_series->setOpacity(0.0);
177 QCOMPARE(m_series->opacity(), 0.0);
178 QCOMPARE(opacitySpy.count(), 2);
179 m_series->setOpacity(1.0);
180 QCOMPARE(m_series->opacity(), 1.0);
181 QCOMPARE(opacitySpy.count(), 3);
170 }
182 }
171
183
172 void tst_qpieseries::append()
184 void tst_qpieseries::append()
@@ -63,6 +63,24 void tst_QXYSeries::seriesVisible()
63 TRY_COMPARE(visibleSpy.count(), 2);
63 TRY_COMPARE(visibleSpy.count(), 2);
64 }
64 }
65
65
66 void tst_QXYSeries::seriesOpacity()
67 {
68 QSignalSpy opacitySpy(m_series, SIGNAL(opacityChanged()));
69 QCOMPARE(m_series->opacity(), 1.0);
70
71 m_series->setOpacity(0.5);
72 QCOMPARE(m_series->opacity(), 0.5);
73 QCOMPARE(opacitySpy.count(), 1);
74
75 m_series->setOpacity(0.0);
76 QCOMPARE(m_series->opacity(), 0.0);
77 QCOMPARE(opacitySpy.count(), 2);
78
79 m_series->setOpacity(1.0);
80 QCOMPARE(m_series->opacity(), 1.0);
81 QCOMPARE(opacitySpy.count(), 3);
82 }
83
66 void tst_QXYSeries::append_data()
84 void tst_QXYSeries::append_data()
67 {
85 {
68 QTest::addColumn< QList<QPointF> >("points");
86 QTest::addColumn< QList<QPointF> >("points");
@@ -42,6 +42,7 public slots:
42 private slots:
42 private slots:
43 void seriesName();
43 void seriesName();
44 void seriesVisible();
44 void seriesVisible();
45 void seriesOpacity();
45 void oper_data();
46 void oper_data();
46 void oper();
47 void oper();
47 void pen_data();
48 void pen_data();
@@ -63,6 +63,7 ChartView {
63
63
64 onNameChanged: console.log(name + ".onNameChanged: " + name);
64 onNameChanged: console.log(name + ".onNameChanged: " + name);
65 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
65 onVisibleChanged: console.log(name + ".onVisibleChanged: " + visible);
66 onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
66 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
67 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
67 onSelected: console.log(name + ".onSelected");
68 onSelected: console.log(name + ".onSelected");
68 onColorChanged: console.log(name + ".onColorChanged: " + color);
69 onColorChanged: console.log(name + ".onColorChanged: " + color);
@@ -31,6 +31,14 Flow {
31 onClicked: series.visible = !series.visible;
31 onClicked: series.visible = !series.visible;
32 }
32 }
33 Button {
33 Button {
34 text: "opacity +"
35 onClicked: series.opacity += 0.1;
36 }
37 Button {
38 text: "opacity -"
39 onClicked: series.opacity -= 0.1;
40 }
41 Button {
34 text: "color"
42 text: "color"
35 onClicked: series.color = main.nextColor();
43 onClicked: series.color = main.nextColor();
36 }
44 }
@@ -54,11 +54,12 ChartView {
54 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
54 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
55 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
55 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
56
56
57 onNameChanged: console.log("groupedBarSeries.onNameChanged: " + series.name);
57 onNameChanged: console.log("barSeries.onNameChanged: " + series.name);
58 onVisibleChanged: console.log("groupedBarSeries.onVisibleChanged: " + series.visible);
58 onVisibleChanged: console.log("barSeries.onVisibleChanged: " + series.visible);
59 onClicked: console.log("groupedBarSeries.onClicked: " + barset + " " + index);
59 onOpacityChanged: console.log("barSeries.onOpacityChanged: " + opacity);
60 onHovered: console.log("groupedBarSeries.onHovered: " + barset + " " + status);
60 onClicked: console.log("barSeries.onClicked: " + barset + " " + index);
61 onLabelsVisibleChanged: console.log("groupedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
61 onHovered: console.log("barSeries.onHovered: " + barset + " " + status);
62 onCountChanged: console.log("groupedBarSeries.onCountChanged: " + count);
62 onLabelsVisibleChanged: console.log("barSeries.onLabelsVisibleChanged: " + series.labelsVisible);
63 onCountChanged: console.log("barSeries.onCountChanged: " + count);
63 }
64 }
64 }
65 }
@@ -82,6 +82,14 Row {
82 onClicked: series.visible = !series.visible;
82 onClicked: series.visible = !series.visible;
83 }
83 }
84 Button {
84 Button {
85 text: "opacity +"
86 onClicked: series.opacity += 0.1;
87 }
88 Button {
89 text: "opacity -"
90 onClicked: series.opacity -= 0.1;
91 }
92 Button {
85 text: "bar width +"
93 text: "bar width +"
86 onClicked: series.barWidth += 0.1;
94 onClicked: series.barWidth += 0.1;
87 }
95 }
@@ -53,11 +53,12 ChartView {
53 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
53 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
54 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
54 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
55
55
56 onNameChanged: console.log("groupedBarSeries.onNameChanged: " + series.name);
56 onNameChanged: console.log("horizontalBarSeries.onNameChanged: " + series.name);
57 onVisibleChanged: console.log("groupedBarSeries.onVisibleChanged: " + series.visible);
57 onVisibleChanged: console.log("horizontalBarSeries.onVisibleChanged: " + series.visible);
58 onClicked: console.log("groupedBarSeries.onClicked: " + barset + " " + index);
58 onOpacityChanged: console.log("horizontalBarSeries.onOpacityChanged: " + opacity);
59 onHovered: console.log("groupedBarSeries.onHovered: " + barset + " " + status);
59 onClicked: console.log("horizontalBarSeries.onClicked: " + barset + " " + index);
60 onLabelsVisibleChanged: console.log("groupedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
60 onHovered: console.log("horizontalBarSeries.onHovered: " + barset + " " + status);
61 onCountChanged: console.log("groupedBarSeries.onCountChanged: " + count);
61 onLabelsVisibleChanged: console.log("horizontalBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
62 onCountChanged: console.log("horizontalBarSeries.onCountChanged: " + count);
62 }
63 }
63 }
64 }
@@ -53,11 +53,12 ChartView {
53 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
53 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
54 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
54 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
55
55
56 onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name);
56 onNameChanged: console.log("horizontalPercentBarSeries.onNameChanged: " + series.name);
57 onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible);
57 onVisibleChanged: console.log("horizontalPercentBarSeries.onVisibleChanged: " + series.visible);
58 onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index);
58 onOpacityChanged: console.log("horizontalPercentBarSeries.onOpacityChanged: " + opacity);
59 onHovered: console.log("percentBarSeries.onHovered: " + barset + " " + status);
59 onClicked: console.log("horizontalPercentBarSeries.onClicked: " + barset + " " + index);
60 onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
60 onHovered: console.log("horizontalPercentBarSeries.onHovered: " + barset + " " + status);
61 onCountChanged: console.log("percentBarSeries.onCountChanged: " + count);
61 onLabelsVisibleChanged: console.log("horizontalPercentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
62 onCountChanged: console.log("horizontalPercentBarSeries.onCountChanged: " + count);
62 }
63 }
63 }
64 }
@@ -53,11 +53,12 ChartView {
53 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
53 BarSet { label: "Susan"; values: [5, 1, 2, 4, 1, 7] }
54 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
54 BarSet { label: "James"; values: [3, 5, 8, 13, 5, 8] }
55
55
56 onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name);
56 onNameChanged: console.log("horizontalStackedBarSeries.onNameChanged: " + series.name);
57 onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible);
57 onVisibleChanged: console.log("horizontalStackedBarSeries.onVisibleChanged: " + series.visible);
58 onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index);
58 onOpacityChanged: console.log("horizontalStackedBarSeries.onOpacityChanged: " + opacity);
59 onHovered: console.log("stackedBarSeries.onHovered: " + barset + " " + status);
59 onClicked: console.log("horizontalStackedBarSeries.onClicked: " + barset + " " + index);
60 onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
60 onHovered: console.log("horizontalStackedBarSeries.onHovered: " + barset + " " + status);
61 onCountChanged: console.log("stackedBarSeries.onCountChanged: " + count);
61 onLabelsVisibleChanged: console.log("horizontalStackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
62 onCountChanged: console.log("horizontalStackedBarSeries.onCountChanged: " + count);
62 }
63 }
63 }
64 }
@@ -41,6 +41,7 ChartView {
41
41
42 onNameChanged: console.log("lineSeries.onNameChanged: " + name);
42 onNameChanged: console.log("lineSeries.onNameChanged: " + name);
43 onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible);
43 onVisibleChanged: console.log("lineSeries.onVisibleChanged: " + visible);
44 onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
44 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
45 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
45 onPointReplaced: console.log("lineSeries.onPointReplaced: " + index);
46 onPointReplaced: console.log("lineSeries.onPointReplaced: " + index);
46 onPointRemoved: console.log("lineSeries.onPointRemoved: " + index);
47 onPointRemoved: console.log("lineSeries.onPointRemoved: " + index);
@@ -32,6 +32,14 Flow {
32 onClicked: series.visible = !series.visible;
32 onClicked: series.visible = !series.visible;
33 }
33 }
34 Button {
34 Button {
35 text: "opacity +"
36 onClicked: series.opacity += 0.1;
37 }
38 Button {
39 text: "opacity -"
40 onClicked: series.opacity -= 0.1;
41 }
42 Button {
35 text: "color"
43 text: "color"
36 onClicked: series.color = main.nextColor();
44 onClicked: series.color = main.nextColor();
37 }
45 }
@@ -56,6 +56,7 ChartView {
56
56
57 onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name);
57 onNameChanged: console.log("percentBarSeries.onNameChanged: " + series.name);
58 onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible);
58 onVisibleChanged: console.log("percentBarSeries.onVisibleChanged: " + series.visible);
59 onOpacityChanged: console.log("percentBarSeries.onOpacityChanged: " + opacity);
59 onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index);
60 onClicked: console.log("percentBarSeries.onClicked: " + barset + " " + index);
60 onHovered: console.log("percentBarSeries.onHovered: " + barset + " " + status);
61 onHovered: console.log("percentBarSeries.onHovered: " + barset + " " + status);
61 onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
62 onLabelsVisibleChanged: console.log("percentBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
@@ -52,15 +52,16 ChartView {
52 PieSlice { label: "slice3"; value: 33 }
52 PieSlice { label: "slice3"; value: 33 }
53 PieSlice { label: "slice4"; value: 44 }
53 PieSlice { label: "slice4"; value: 44 }
54
54
55 onNameChanged: console.log("pieSeries.onNameChanged: " + series.name);
55 onNameChanged: console.log("pieSeries.onNameChanged: " + name);
56 onVisibleChanged: console.log("pieSeries.onVisibleChanged: " + series.visible);
56 onVisibleChanged: console.log("pieSeries.onVisibleChanged: " + series.visible);
57 onOpacityChanged: console.log("pieSeries.onOpacityChanged: " + opacity);
57 onClicked: console.log("pieSeries.onClicked: " + slice.label);
58 onClicked: console.log("pieSeries.onClicked: " + slice.label);
58 onHovered: console.log("pieSeries.onHovered: " + slice.label);
59 onHovered: console.log("pieSeries.onHovered: " + slice.label);
59 onAdded: console.log("pieSeries.onAdded: " + slices);
60 onAdded: console.log("pieSeries.onAdded: " + slices);
60 onSliceAdded: console.log("pieSeries.onSliceAdded: " + slice.label);
61 onSliceAdded: console.log("pieSeries.onSliceAdded: " + slice.label);
61 onRemoved: console.log("pieSeries.onRemoved: " + slices);
62 onRemoved: console.log("pieSeries.onRemoved: " + slices);
62 onSliceRemoved: console.log("pieSeries.onSliceRemoved: " + slice.label);
63 onSliceRemoved: console.log("pieSeries.onSliceRemoved: " + slice.label);
63 onCountChanged: console.log("pieSeries.onCountChanged: " + series.count);
64 onCountChanged: console.log("pieSeries.onCountChanged: " + count);
64 onSumChanged: console.log("pieSeries.onSumChanged: " + series.sum);
65 onSumChanged: console.log("pieSeries.onSumChanged: " + sum);
65 }
66 }
66 }
67 }
@@ -83,6 +83,14 Row {
83 onClicked: series.visible = !series.visible;
83 onClicked: series.visible = !series.visible;
84 }
84 }
85 Button {
85 Button {
86 text: "series opacity +"
87 onClicked: series.opacity += 0.1;
88 }
89 Button {
90 text: "series opacity -"
91 onClicked: series.opacity -= 0.1;
92 }
93 Button {
86 text: "series hpos +"
94 text: "series hpos +"
87 onClicked: series.horizontalPosition += 0.1;
95 onClicked: series.horizontalPosition += 0.1;
88 }
96 }
@@ -39,6 +39,7 ChartView {
39
39
40 onNameChanged: console.log("scatterSeries.onNameChanged: " + name);
40 onNameChanged: console.log("scatterSeries.onNameChanged: " + name);
41 onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
41 onVisibleChanged: console.log("scatterSeries.onVisibleChanged: " + visible);
42 onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
42 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
43 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
43 onPointReplaced: console.log("scatterSeries.onPointReplaced: " + index);
44 onPointReplaced: console.log("scatterSeries.onPointReplaced: " + index);
44 onPointRemoved: console.log("scatterSeries.onPointRemoved: " + index);
45 onPointRemoved: console.log("scatterSeries.onPointRemoved: " + index);
@@ -31,6 +31,14 Flow {
31 onClicked: series.visible = !series.visible;
31 onClicked: series.visible = !series.visible;
32 }
32 }
33 Button {
33 Button {
34 text: "opacity +"
35 onClicked: series.opacity += 0.1;
36 }
37 Button {
38 text: "opacity -"
39 onClicked: series.opacity -= 0.1;
40 }
41 Button {
34 text: "color"
42 text: "color"
35 onClicked: series.color = main.nextColor();
43 onClicked: series.color = main.nextColor();
36 }
44 }
@@ -40,6 +40,7 ChartView {
40
40
41 onNameChanged: console.log("splineSeries.onNameChanged: " + name);
41 onNameChanged: console.log("splineSeries.onNameChanged: " + name);
42 onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
42 onVisibleChanged: console.log("splineSeries.onVisibleChanged: " + visible);
43 onOpacityChanged: console.log(name + ".onOpacityChanged: " + opacity);
43 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
44 onClicked: console.log(name + ".onClicked: " + point.x + ", " + point.y);
44 onPointReplaced: console.log("splineSeries.onPointReplaced: " + index);
45 onPointReplaced: console.log("splineSeries.onPointReplaced: " + index);
45 onPointRemoved: console.log("splineSeries.onPointRemoved: " + index);
46 onPointRemoved: console.log("splineSeries.onPointRemoved: " + index);
@@ -55,6 +55,7 ChartView {
55
55
56 onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name);
56 onNameChanged: console.log("stackedBarSeries.onNameChanged: " + series.name);
57 onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible);
57 onVisibleChanged: console.log("stackedBarSeries.onVisibleChanged: " + series.visible);
58 onOpacityChanged: console.log("stackedBarSeries.onOpacityChanged: " + opacity);
58 onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index);
59 onClicked: console.log("stackedBarSeries.onClicked: " + barset + " " + index);
59 onHovered: console.log("stackedBarSeries.onHovered: " + barset + " " + status);
60 onHovered: console.log("stackedBarSeries.onHovered: " + barset + " " + status);
60 onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
61 onLabelsVisibleChanged: console.log("stackedBarSeries.onLabelsVisibleChanged: " + series.labelsVisible);
General Comments 0
You need to be logged in to leave comments. Login now