##// END OF EJS Templates
Add possibility to set reverse values to axes...
Titta Heikkala -
r2781:7c9f8e5a27d8
parent child
Show More
@@ -1,284 +1,306
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/areachartitem_p.h>
19 #include <private/areachartitem_p.h>
20 #include <QtCharts/QAreaSeries>
20 #include <QtCharts/QAreaSeries>
21 #include <private/qareaseries_p.h>
21 #include <private/qareaseries_p.h>
22 #include <QtCharts/QLineSeries>
22 #include <QtCharts/QLineSeries>
23 #include <private/chartpresenter_p.h>
23 #include <private/chartpresenter_p.h>
24 #include <private/abstractdomain_p.h>
24 #include <private/abstractdomain_p.h>
25 #include <QtGui/QPainter>
25 #include <QtGui/QPainter>
26 #include <QtWidgets/QGraphicsSceneMouseEvent>
26 #include <QtWidgets/QGraphicsSceneMouseEvent>
27 #include <QtCore/QDebug>
27 #include <QtCore/QDebug>
28
28
29
29
30 QT_CHARTS_BEGIN_NAMESPACE
30 QT_CHARTS_BEGIN_NAMESPACE
31
31
32 AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item)
32 AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item)
33 : ChartItem(areaSeries->d_func(),item),
33 : ChartItem(areaSeries->d_func(),item),
34 m_series(areaSeries),
34 m_series(areaSeries),
35 m_upper(0),
35 m_upper(0),
36 m_lower(0),
36 m_lower(0),
37 m_pointsVisible(false),
37 m_pointsVisible(false),
38 m_pointLabelsVisible(false),
38 m_pointLabelsVisible(false),
39 m_pointLabelsFormat(areaSeries->pointLabelsFormat()),
39 m_pointLabelsFormat(areaSeries->pointLabelsFormat()),
40 m_pointLabelsFont(areaSeries->pointLabelsFont()),
40 m_pointLabelsFont(areaSeries->pointLabelsFont()),
41 m_pointLabelsColor(areaSeries->pointLabelsColor()),
41 m_pointLabelsColor(areaSeries->pointLabelsColor()),
42 m_mousePressed(false)
42 m_mousePressed(false)
43 {
43 {
44 setAcceptHoverEvents(true);
44 setAcceptHoverEvents(true);
45 setFlag(QGraphicsItem::ItemIsSelectable, true);
45 setFlag(QGraphicsItem::ItemIsSelectable, true);
46 setZValue(ChartPresenter::LineChartZValue);
46 setZValue(ChartPresenter::LineChartZValue);
47 if (m_series->upperSeries())
47 if (m_series->upperSeries())
48 m_upper = new AreaBoundItem(this, m_series->upperSeries());
48 m_upper = new AreaBoundItem(this, m_series->upperSeries());
49 if (m_series->lowerSeries())
49 if (m_series->lowerSeries())
50 m_lower = new AreaBoundItem(this, m_series->lowerSeries());
50 m_lower = new AreaBoundItem(this, m_series->lowerSeries());
51
51
52 QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
52 QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
53 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
53 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
54 QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
54 QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
55 QObject::connect(this, SIGNAL(clicked(QPointF)), areaSeries, SIGNAL(clicked(QPointF)));
55 QObject::connect(this, SIGNAL(clicked(QPointF)), areaSeries, SIGNAL(clicked(QPointF)));
56 QObject::connect(this, SIGNAL(hovered(QPointF,bool)), areaSeries, SIGNAL(hovered(QPointF,bool)));
56 QObject::connect(this, SIGNAL(hovered(QPointF,bool)), areaSeries, SIGNAL(hovered(QPointF,bool)));
57 QObject::connect(this, SIGNAL(pressed(QPointF)), areaSeries, SIGNAL(pressed(QPointF)));
57 QObject::connect(this, SIGNAL(pressed(QPointF)), areaSeries, SIGNAL(pressed(QPointF)));
58 QObject::connect(this, SIGNAL(released(QPointF)), areaSeries, SIGNAL(released(QPointF)));
58 QObject::connect(this, SIGNAL(released(QPointF)), areaSeries, SIGNAL(released(QPointF)));
59 QObject::connect(this, SIGNAL(doubleClicked(QPointF)),
59 QObject::connect(this, SIGNAL(doubleClicked(QPointF)),
60 areaSeries, SIGNAL(doubleClicked(QPointF)));
60 areaSeries, SIGNAL(doubleClicked(QPointF)));
61 QObject::connect(areaSeries, SIGNAL(pointLabelsFormatChanged(QString)),
61 QObject::connect(areaSeries, SIGNAL(pointLabelsFormatChanged(QString)),
62 this, SLOT(handleUpdated()));
62 this, SLOT(handleUpdated()));
63 QObject::connect(areaSeries, SIGNAL(pointLabelsVisibilityChanged(bool)),
63 QObject::connect(areaSeries, SIGNAL(pointLabelsVisibilityChanged(bool)),
64 this, SLOT(handleUpdated()));
64 this, SLOT(handleUpdated()));
65 QObject::connect(areaSeries, SIGNAL(pointLabelsFontChanged(QFont)),
65 QObject::connect(areaSeries, SIGNAL(pointLabelsFontChanged(QFont)),
66 this, SLOT(handleUpdated()));
66 this, SLOT(handleUpdated()));
67 QObject::connect(areaSeries, SIGNAL(pointLabelsColorChanged(QColor)),
67 QObject::connect(areaSeries, SIGNAL(pointLabelsColorChanged(QColor)),
68 this, SLOT(handleUpdated()));
68 this, SLOT(handleUpdated()));
69
69
70 handleUpdated();
70 handleUpdated();
71 }
71 }
72
72
73 AreaChartItem::~AreaChartItem()
73 AreaChartItem::~AreaChartItem()
74 {
74 {
75 delete m_upper;
75 delete m_upper;
76 delete m_lower;
76 delete m_lower;
77 }
77 }
78
78
79 void AreaChartItem::setPresenter(ChartPresenter *presenter)
79 void AreaChartItem::setPresenter(ChartPresenter *presenter)
80 {
80 {
81 if (m_upper)
81 if (m_upper)
82 m_upper->setPresenter(presenter);
82 m_upper->setPresenter(presenter);
83 if (m_lower) {
83 if (m_lower) {
84 m_lower->setPresenter(presenter);
84 m_lower->setPresenter(presenter);
85 }
85 }
86 ChartItem::setPresenter(presenter);
86 ChartItem::setPresenter(presenter);
87 }
87 }
88
88
89 QRectF AreaChartItem::boundingRect() const
89 QRectF AreaChartItem::boundingRect() const
90 {
90 {
91 return m_rect;
91 return m_rect;
92 }
92 }
93
93
94 QPainterPath AreaChartItem::shape() const
94 QPainterPath AreaChartItem::shape() const
95 {
95 {
96 return m_path;
96 return m_path;
97 }
97 }
98
98
99 void AreaChartItem::updatePath()
99 void AreaChartItem::updatePath()
100 {
100 {
101 QPainterPath path;
101 QPainterPath path;
102 QRectF rect(QPointF(0,0),domain()->size());
102 QRectF rect(QPointF(0,0),domain()->size());
103
103
104 path = m_upper->path();
104 path = m_upper->path();
105
105
106 if (m_lower) {
106 if (m_lower) {
107 // Note: Polarcharts always draw area correctly only when both series have equal width or are
107 // Note: Polarcharts always draw area correctly only when both series have equal width or are
108 // fully displayed. If one series is partally off-chart, the connecting line between
108 // fully displayed. If one series is partally off-chart, the connecting line between
109 // the series does not attach to the end of the partially hidden series but to the point
109 // the series does not attach to the end of the partially hidden series but to the point
110 // where it intersects the axis line. The problem is especially noticeable when one of the series
110 // where it intersects the axis line. The problem is especially noticeable when one of the series
111 // is entirely off-chart, in which case the connecting line connects two ends of the
111 // is entirely off-chart, in which case the connecting line connects two ends of the
112 // visible series.
112 // visible series.
113 // This happens because we get the paths from linechart, which omits off-chart segments.
113 // This happens because we get the paths from linechart, which omits off-chart segments.
114 // To properly fix, linechart would need to provide true full path, in right, left, and the rest
114 // To properly fix, linechart would need to provide true full path, in right, left, and the rest
115 // portions to enable proper clipping. However, combining those to single visually unified area
115 // portions to enable proper clipping. However, combining those to single visually unified area
116 // would be a nightmare, since they would have to be painted separately.
116 // would be a nightmare, since they would have to be painted separately.
117 path.connectPath(m_lower->path().toReversed());
117 path.connectPath(m_lower->path().toReversed());
118 } else {
118 } else {
119 QPointF first = path.pointAtPercent(0);
119 QPointF first = path.pointAtPercent(0);
120 QPointF last = path.pointAtPercent(1);
120 QPointF last = path.pointAtPercent(1);
121 if (presenter()->chartType() == QChart::ChartTypeCartesian) {
121 if (presenter()->chartType() == QChart::ChartTypeCartesian) {
122 path.lineTo(last.x(), rect.bottom());
122 path.lineTo(last.x(), rect.bottom());
123 path.lineTo(first.x(), rect.bottom());
123 path.lineTo(first.x(), rect.bottom());
124 } else { // polar
124 } else { // polar
125 path.lineTo(rect.center());
125 path.lineTo(rect.center());
126 }
126 }
127 }
127 }
128 path.closeSubpath();
128 path.closeSubpath();
129
129
130 // Only zoom in if the bounding rect of the path fits inside int limits. QWidget::update() uses
130 // Only zoom in if the bounding rect of the path fits inside int limits. QWidget::update() uses
131 // a region that has to be compatible with QRect.
131 // a region that has to be compatible with QRect.
132 if (path.boundingRect().height() <= INT_MAX
132 if (path.boundingRect().height() <= INT_MAX
133 && path.boundingRect().width() <= INT_MAX) {
133 && path.boundingRect().width() <= INT_MAX) {
134 prepareGeometryChange();
134 prepareGeometryChange();
135 m_path = path;
135 m_path = path;
136 m_rect = path.boundingRect();
136 m_rect = path.boundingRect();
137 update();
137 update();
138 }
138 }
139 }
139 }
140
140
141 void AreaChartItem::handleUpdated()
141 void AreaChartItem::handleUpdated()
142 {
142 {
143 setVisible(m_series->isVisible());
143 setVisible(m_series->isVisible());
144 m_pointsVisible = m_series->pointsVisible();
144 m_pointsVisible = m_series->pointsVisible();
145 m_linePen = m_series->pen();
145 m_linePen = m_series->pen();
146 m_brush = m_series->brush();
146 m_brush = m_series->brush();
147 m_pointPen = m_series->pen();
147 m_pointPen = m_series->pen();
148 m_pointPen.setWidthF(2 * m_pointPen.width());
148 m_pointPen.setWidthF(2 * m_pointPen.width());
149 setOpacity(m_series->opacity());
149 setOpacity(m_series->opacity());
150 m_pointLabelsFormat = m_series->pointLabelsFormat();
150 m_pointLabelsFormat = m_series->pointLabelsFormat();
151 m_pointLabelsVisible = m_series->pointLabelsVisible();
151 m_pointLabelsVisible = m_series->pointLabelsVisible();
152 m_pointLabelsFont = m_series->pointLabelsFont();
152 m_pointLabelsFont = m_series->pointLabelsFont();
153 m_pointLabelsColor = m_series->pointLabelsColor();
153 m_pointLabelsColor = m_series->pointLabelsColor();
154 update();
154 update();
155 }
155 }
156
156
157 void AreaChartItem::handleDomainUpdated()
157 void AreaChartItem::handleDomainUpdated()
158 {
158 {
159 if (m_upper) {
159 if (m_upper) {
160 AbstractDomain* d = m_upper->domain();
160 AbstractDomain* d = m_upper->domain();
161 d->setSize(domain()->size());
161 d->setSize(domain()->size());
162 d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
162 d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
163 m_upper->handleDomainUpdated();
163 m_upper->handleDomainUpdated();
164 }
164 }
165
165
166 if (m_lower) {
166 if (m_lower) {
167 AbstractDomain* d = m_lower->domain();
167 AbstractDomain* d = m_lower->domain();
168 d->setSize(domain()->size());
168 d->setSize(domain()->size());
169 d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
169 d->setRange(domain()->minX(),domain()->maxX(),domain()->minY(),domain()->maxY());
170 m_lower->handleDomainUpdated();
170 m_lower->handleDomainUpdated();
171 }
171 }
172 }
172 }
173
173
174 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
174 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
175 {
175 {
176 Q_UNUSED(widget)
176 Q_UNUSED(widget)
177 Q_UNUSED(option)
177 Q_UNUSED(option)
178 painter->save();
178 painter->save();
179 painter->setPen(m_linePen);
179 painter->setPen(m_linePen);
180 painter->setBrush(m_brush);
180 painter->setBrush(m_brush);
181 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
181 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
182 if (presenter()->chartType() == QChart::ChartTypePolar)
182 if (presenter()->chartType() == QChart::ChartTypePolar)
183 painter->setClipRegion(QRegion(clipRect.toRect(), QRegion::Ellipse));
183 painter->setClipRegion(QRegion(clipRect.toRect(), QRegion::Ellipse));
184 else
184 else
185 painter->setClipRect(clipRect);
185 painter->setClipRect(clipRect);
186
187 reversePainter(painter, clipRect);
188
186 painter->drawPath(m_path);
189 painter->drawPath(m_path);
187 if (m_pointsVisible) {
190 if (m_pointsVisible) {
188 painter->setPen(m_pointPen);
191 painter->setPen(m_pointPen);
189 painter->drawPoints(m_upper->geometryPoints());
192 painter->drawPoints(m_upper->geometryPoints());
190 if (m_lower)
193 if (m_lower)
191 painter->drawPoints(m_lower->geometryPoints());
194 painter->drawPoints(m_lower->geometryPoints());
192 }
195 }
193
196
197 reversePainter(painter, clipRect);
198
194 // Draw series point label
199 // Draw series point label
195 if (m_pointLabelsVisible) {
200 if (m_pointLabelsVisible) {
196 static const QString xPointTag(QLatin1String("@xPoint"));
201 static const QString xPointTag(QLatin1String("@xPoint"));
197 static const QString yPointTag(QLatin1String("@yPoint"));
202 static const QString yPointTag(QLatin1String("@yPoint"));
198 const int labelOffset = 2;
203 const int labelOffset = 2;
199
204
200 painter->setFont(m_pointLabelsFont);
205 painter->setFont(m_pointLabelsFont);
201 painter->setPen(QPen(m_pointLabelsColor));
206 painter->setPen(QPen(m_pointLabelsColor));
202 QFontMetrics fm(painter->font());
207 QFontMetrics fm(painter->font());
203
208
204 QString pointLabel;
209 QString pointLabel;
205
210
206 if (m_series->upperSeries()) {
211 if (m_series->upperSeries()) {
207 for (int i(0); i < m_series->upperSeries()->count(); i++) {
212 for (int i(0); i < m_series->upperSeries()->count(); i++) {
208 pointLabel = m_pointLabelsFormat;
213 pointLabel = m_pointLabelsFormat;
209 pointLabel.replace(xPointTag,
214 pointLabel.replace(xPointTag,
210 presenter()->numberToString(m_series->upperSeries()->at(i).x()));
215 presenter()->numberToString(m_series->upperSeries()->at(i).x()));
211 pointLabel.replace(yPointTag,
216 pointLabel.replace(yPointTag,
212 presenter()->numberToString(m_series->upperSeries()->at(i).y()));
217 presenter()->numberToString(m_series->upperSeries()->at(i).y()));
213
218
214 // Position text in relation to the point
219 // Position text in relation to the point
215 int pointLabelWidth = fm.width(pointLabel);
220 int pointLabelWidth = fm.width(pointLabel);
216 QPointF position(m_upper->geometryPoints().at(i));
221 QPointF position(m_upper->geometryPoints().at(i));
217 position.setX(position.x() - pointLabelWidth / 2);
222 if (!seriesPrivate()->reverseXAxis())
218 position.setY(position.y() - m_series->upperSeries()->pen().width() / 2 - labelOffset);
223 position.setX(position.x() - pointLabelWidth / 2);
219
224 else
225 position.setX(domain()->size().width() - position.x() - pointLabelWidth / 2);
226 if (!seriesPrivate()->reverseYAxis()) {
227 position.setY(position.y() - m_series->upperSeries()->pen().width() / 2
228 - labelOffset);
229 } else {
230 position.setY(domain()->size().height() - position.y()
231 - m_series->upperSeries()->pen().width() / 2 - labelOffset);
232 }
220 painter->drawText(position, pointLabel);
233 painter->drawText(position, pointLabel);
221 }
234 }
222 }
235 }
223
236
224 if (m_series->lowerSeries()) {
237 if (m_series->lowerSeries()) {
225 for (int i(0); i < m_series->lowerSeries()->count(); i++) {
238 for (int i(0); i < m_series->lowerSeries()->count(); i++) {
226 pointLabel = m_pointLabelsFormat;
239 pointLabel = m_pointLabelsFormat;
227 pointLabel.replace(xPointTag,
240 pointLabel.replace(xPointTag,
228 presenter()->numberToString(m_series->lowerSeries()->at(i).x()));
241 presenter()->numberToString(m_series->lowerSeries()->at(i).x()));
229 pointLabel.replace(yPointTag,
242 pointLabel.replace(yPointTag,
230 presenter()->numberToString(m_series->lowerSeries()->at(i).y()));
243 presenter()->numberToString(m_series->lowerSeries()->at(i).y()));
231
244
232 // Position text in relation to the point
245 // Position text in relation to the point
233 int pointLabelWidth = fm.width(pointLabel);
246 int pointLabelWidth = fm.width(pointLabel);
234 QPointF position(m_lower->geometryPoints().at(i));
247 QPointF position(m_lower->geometryPoints().at(i));
235 position.setX(position.x() - pointLabelWidth / 2);
248 if (!seriesPrivate()->reverseXAxis())
236 position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2 - labelOffset);
249 position.setX(position.x() - pointLabelWidth / 2);
250 else
251 position.setX(domain()->size().width() - position.x() - pointLabelWidth / 2);
252 if (!seriesPrivate()->reverseYAxis()) {
253 position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2
254 - labelOffset);
255 } else {
256 position.setY(domain()->size().height() - position.y()
257 - m_series->lowerSeries()->pen().width() / 2 - labelOffset);
258 }
237 painter->drawText(position, pointLabel);
259 painter->drawText(position, pointLabel);
238 }
260 }
239 }
261 }
240 }
262 }
241
263
242 painter->restore();
264 painter->restore();
243 }
265 }
244
266
245 void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
267 void AreaChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
246 {
268 {
247 emit pressed(m_upper->domain()->calculateDomainPoint(event->pos()));
269 emit pressed(m_upper->domain()->calculateDomainPoint(event->pos()));
248 m_lastMousePos = event->pos();
270 m_lastMousePos = event->pos();
249 m_mousePressed = true;
271 m_mousePressed = true;
250 ChartItem::mousePressEvent(event);
272 ChartItem::mousePressEvent(event);
251 }
273 }
252
274
253 void AreaChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
275 void AreaChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
254 {
276 {
255 emit hovered(domain()->calculateDomainPoint(event->pos()), true);
277 emit hovered(domain()->calculateDomainPoint(event->pos()), true);
256 event->accept();
278 event->accept();
257 // QGraphicsItem::hoverEnterEvent(event);
279 // QGraphicsItem::hoverEnterEvent(event);
258 }
280 }
259
281
260 void AreaChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
282 void AreaChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
261 {
283 {
262 emit hovered(domain()->calculateDomainPoint(event->pos()), false);
284 emit hovered(domain()->calculateDomainPoint(event->pos()), false);
263 event->accept();
285 event->accept();
264 // QGraphicsItem::hoverEnterEvent(event);
286 // QGraphicsItem::hoverEnterEvent(event);
265 }
287 }
266
288
267 void AreaChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
289 void AreaChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
268 {
290 {
269 emit released(m_upper->domain()->calculateDomainPoint(m_lastMousePos));
291 emit released(m_upper->domain()->calculateDomainPoint(m_lastMousePos));
270 if (m_mousePressed)
292 if (m_mousePressed)
271 emit clicked(m_upper->domain()->calculateDomainPoint(m_lastMousePos));
293 emit clicked(m_upper->domain()->calculateDomainPoint(m_lastMousePos));
272 m_mousePressed = false;
294 m_mousePressed = false;
273 ChartItem::mouseReleaseEvent(event);
295 ChartItem::mouseReleaseEvent(event);
274 }
296 }
275
297
276 void AreaChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
298 void AreaChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
277 {
299 {
278 emit doubleClicked(m_upper->domain()->calculateDomainPoint(m_lastMousePos));
300 emit doubleClicked(m_upper->domain()->calculateDomainPoint(m_lastMousePos));
279 ChartItem::mouseDoubleClickEvent(event);
301 ChartItem::mouseDoubleClickEvent(event);
280 }
302 }
281
303
282 #include "moc_areachartitem_p.cpp"
304 #include "moc_areachartitem_p.cpp"
283
305
284 QT_CHARTS_END_NAMESPACE
306 QT_CHARTS_END_NAMESPACE
@@ -1,391 +1,400
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/chartaxiselement_p.h>
19 #include <private/chartaxiselement_p.h>
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <private/chartpresenter_p.h>
21 #include <private/chartpresenter_p.h>
22 #include <private/abstractchartlayout_p.h>
22 #include <private/abstractchartlayout_p.h>
23 #include <QtCore/QtMath>
23 #include <QtCore/QtMath>
24 #include <QtCore/QDateTime>
24 #include <QtCore/QDateTime>
25 #include <QtGui/QTextDocument>
25 #include <QtGui/QTextDocument>
26 #include <cmath>
26 #include <cmath>
27
27
28 QT_CHARTS_BEGIN_NAMESPACE
28 QT_CHARTS_BEGIN_NAMESPACE
29
29
30 static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.\\'lhjztL]*([dicuoxfegXFEG])";
30 static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.\\'lhjztL]*([dicuoxfegXFEG])";
31 static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.(\\d+)([defgiEG])(.*)$";
31 static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.(\\d+)([defgiEG])(.*)$";
32 static QRegExp *labelFormatMatcher = 0;
32 static QRegExp *labelFormatMatcher = 0;
33 static QRegExp *labelFormatMatcherLocalized = 0;
33 static QRegExp *labelFormatMatcherLocalized = 0;
34 class StaticLabelFormatMatcherDeleter
34 class StaticLabelFormatMatcherDeleter
35 {
35 {
36 public:
36 public:
37 StaticLabelFormatMatcherDeleter() {}
37 StaticLabelFormatMatcherDeleter() {}
38 ~StaticLabelFormatMatcherDeleter() {
38 ~StaticLabelFormatMatcherDeleter() {
39 delete labelFormatMatcher;
39 delete labelFormatMatcher;
40 delete labelFormatMatcherLocalized;
40 delete labelFormatMatcherLocalized;
41 }
41 }
42 };
42 };
43 static StaticLabelFormatMatcherDeleter staticLabelFormatMatcherDeleter;
43 static StaticLabelFormatMatcherDeleter staticLabelFormatMatcherDeleter;
44
44
45 ChartAxisElement::ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
45 ChartAxisElement::ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
46 : ChartElement(item),
46 : ChartElement(item),
47 m_axis(axis),
47 m_axis(axis),
48 m_animation(0),
48 m_animation(0),
49 m_grid(new QGraphicsItemGroup(item)),
49 m_grid(new QGraphicsItemGroup(item)),
50 m_arrow(new QGraphicsItemGroup(item)),
50 m_arrow(new QGraphicsItemGroup(item)),
51 m_shades(new QGraphicsItemGroup(item)),
51 m_shades(new QGraphicsItemGroup(item)),
52 m_labels(new QGraphicsItemGroup(item)),
52 m_labels(new QGraphicsItemGroup(item)),
53 m_title(new QGraphicsTextItem(item)),
53 m_title(new QGraphicsTextItem(item)),
54 m_intervalAxis(intervalAxis)
54 m_intervalAxis(intervalAxis)
55
55
56 {
56 {
57 //initial initialization
57 //initial initialization
58 m_arrow->setHandlesChildEvents(false);
58 m_arrow->setHandlesChildEvents(false);
59 m_arrow->setZValue(ChartPresenter::AxisZValue);
59 m_arrow->setZValue(ChartPresenter::AxisZValue);
60 m_labels->setZValue(ChartPresenter::AxisZValue);
60 m_labels->setZValue(ChartPresenter::AxisZValue);
61 m_shades->setZValue(ChartPresenter::ShadesZValue);
61 m_shades->setZValue(ChartPresenter::ShadesZValue);
62 m_grid->setZValue(ChartPresenter::GridZValue);
62 m_grid->setZValue(ChartPresenter::GridZValue);
63 m_title->setZValue(ChartPresenter::GridZValue);
63 m_title->setZValue(ChartPresenter::GridZValue);
64 m_title->document()->setDocumentMargin(ChartPresenter::textMargin());
64 m_title->document()->setDocumentMargin(ChartPresenter::textMargin());
65 handleVisibleChanged(axis->isVisible());
65 handleVisibleChanged(axis->isVisible());
66 connectSlots();
66 connectSlots();
67
67
68 setFlag(QGraphicsItem::ItemHasNoContents, true);
68 setFlag(QGraphicsItem::ItemHasNoContents, true);
69 }
69 }
70
70
71 ChartAxisElement::~ChartAxisElement()
71 ChartAxisElement::~ChartAxisElement()
72 {
72 {
73 }
73 }
74
74
75 void ChartAxisElement::connectSlots()
75 void ChartAxisElement::connectSlots()
76 {
76 {
77 QObject::connect(axis(), SIGNAL(visibleChanged(bool)), this, SLOT(handleVisibleChanged(bool)));
77 QObject::connect(axis(), SIGNAL(visibleChanged(bool)), this, SLOT(handleVisibleChanged(bool)));
78 QObject::connect(axis(), SIGNAL(lineVisibleChanged(bool)), this, SLOT(handleArrowVisibleChanged(bool)));
78 QObject::connect(axis(), SIGNAL(lineVisibleChanged(bool)), this, SLOT(handleArrowVisibleChanged(bool)));
79 QObject::connect(axis(), SIGNAL(gridVisibleChanged(bool)), this, SLOT(handleGridVisibleChanged(bool)));
79 QObject::connect(axis(), SIGNAL(gridVisibleChanged(bool)), this, SLOT(handleGridVisibleChanged(bool)));
80 QObject::connect(axis(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
80 QObject::connect(axis(), SIGNAL(labelsVisibleChanged(bool)), this, SLOT(handleLabelsVisibleChanged(bool)));
81 QObject::connect(axis(), SIGNAL(shadesVisibleChanged(bool)), this, SLOT(handleShadesVisibleChanged(bool)));
81 QObject::connect(axis(), SIGNAL(shadesVisibleChanged(bool)), this, SLOT(handleShadesVisibleChanged(bool)));
82 QObject::connect(axis(), SIGNAL(labelsAngleChanged(int)), this, SLOT(handleLabelsAngleChanged(int)));
82 QObject::connect(axis(), SIGNAL(labelsAngleChanged(int)), this, SLOT(handleLabelsAngleChanged(int)));
83 QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this, SLOT(handleArrowPenChanged(const QPen&)));
83 QObject::connect(axis(), SIGNAL(linePenChanged(const QPen&)), this, SLOT(handleArrowPenChanged(const QPen&)));
84 QObject::connect(axis(), SIGNAL(labelsBrushChanged(const QBrush&)), this, SLOT(handleLabelsBrushChanged(const QBrush&)));
84 QObject::connect(axis(), SIGNAL(labelsBrushChanged(const QBrush&)), this, SLOT(handleLabelsBrushChanged(const QBrush&)));
85 QObject::connect(axis(), SIGNAL(labelsFontChanged(const QFont&)), this, SLOT(handleLabelsFontChanged(const QFont&)));
85 QObject::connect(axis(), SIGNAL(labelsFontChanged(const QFont&)), this, SLOT(handleLabelsFontChanged(const QFont&)));
86 QObject::connect(axis(), SIGNAL(gridLinePenChanged(const QPen&)), this, SLOT(handleGridPenChanged(const QPen&)));
86 QObject::connect(axis(), SIGNAL(gridLinePenChanged(const QPen&)), this, SLOT(handleGridPenChanged(const QPen&)));
87 QObject::connect(axis(), SIGNAL(shadesPenChanged(const QPen&)), this, SLOT(handleShadesPenChanged(const QPen&)));
87 QObject::connect(axis(), SIGNAL(shadesPenChanged(const QPen&)), this, SLOT(handleShadesPenChanged(const QPen&)));
88 QObject::connect(axis(), SIGNAL(shadesBrushChanged(const QBrush&)), this, SLOT(handleShadesBrushChanged(const QBrush&)));
88 QObject::connect(axis(), SIGNAL(shadesBrushChanged(const QBrush&)), this, SLOT(handleShadesBrushChanged(const QBrush&)));
89 QObject::connect(axis(), SIGNAL(titleTextChanged(const QString&)), this, SLOT(handleTitleTextChanged(const QString&)));
89 QObject::connect(axis(), SIGNAL(titleTextChanged(const QString&)), this, SLOT(handleTitleTextChanged(const QString&)));
90 QObject::connect(axis(), SIGNAL(titleFontChanged(const QFont&)), this, SLOT(handleTitleFontChanged(const QFont&)));
90 QObject::connect(axis(), SIGNAL(titleFontChanged(const QFont&)), this, SLOT(handleTitleFontChanged(const QFont&)));
91 QObject::connect(axis(), SIGNAL(titleBrushChanged(const QBrush&)), this, SLOT(handleTitleBrushChanged(const QBrush&)));
91 QObject::connect(axis(), SIGNAL(titleBrushChanged(const QBrush&)), this, SLOT(handleTitleBrushChanged(const QBrush&)));
92 QObject::connect(axis(), SIGNAL(titleVisibleChanged(bool)), this, SLOT(handleTitleVisibleChanged(bool)));
92 QObject::connect(axis(), SIGNAL(titleVisibleChanged(bool)), this, SLOT(handleTitleVisibleChanged(bool)));
93 QObject::connect(axis()->d_ptr.data(), SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(handleRangeChanged(qreal, qreal)));
93 QObject::connect(axis()->d_ptr.data(), SIGNAL(rangeChanged(qreal, qreal)), this, SLOT(handleRangeChanged(qreal, qreal)));
94 QObject::connect(axis(), SIGNAL(reverseChanged(bool)), this, SLOT(handleReverseChanged(bool)));
94 }
95 }
95
96
96 void ChartAxisElement::handleArrowVisibleChanged(bool visible)
97 void ChartAxisElement::handleArrowVisibleChanged(bool visible)
97 {
98 {
98 m_arrow->setVisible(visible);
99 m_arrow->setVisible(visible);
99 }
100 }
100
101
101 void ChartAxisElement::handleGridVisibleChanged(bool visible)
102 void ChartAxisElement::handleGridVisibleChanged(bool visible)
102 {
103 {
103 m_grid->setVisible(visible);
104 m_grid->setVisible(visible);
104 }
105 }
105
106
106 void ChartAxisElement::handleLabelsVisibleChanged(bool visible)
107 void ChartAxisElement::handleLabelsVisibleChanged(bool visible)
107 {
108 {
108 QGraphicsLayoutItem::updateGeometry();
109 QGraphicsLayoutItem::updateGeometry();
109 presenter()->layout()->invalidate();
110 presenter()->layout()->invalidate();
110 m_labels->setVisible(visible);
111 m_labels->setVisible(visible);
111 }
112 }
112
113
113 void ChartAxisElement::handleShadesVisibleChanged(bool visible)
114 void ChartAxisElement::handleShadesVisibleChanged(bool visible)
114 {
115 {
115 m_shades->setVisible(visible);
116 m_shades->setVisible(visible);
116 }
117 }
117
118
118 void ChartAxisElement::handleTitleVisibleChanged(bool visible)
119 void ChartAxisElement::handleTitleVisibleChanged(bool visible)
119 {
120 {
120 QGraphicsLayoutItem::updateGeometry();
121 QGraphicsLayoutItem::updateGeometry();
121 presenter()->layout()->invalidate();
122 presenter()->layout()->invalidate();
122 m_title->setVisible(visible);
123 m_title->setVisible(visible);
123 }
124 }
124
125
125 void ChartAxisElement::handleLabelsAngleChanged(int angle)
126 void ChartAxisElement::handleLabelsAngleChanged(int angle)
126 {
127 {
127 foreach (QGraphicsItem *item, m_labels->childItems())
128 foreach (QGraphicsItem *item, m_labels->childItems())
128 item->setRotation(angle);
129 item->setRotation(angle);
129
130
130 QGraphicsLayoutItem::updateGeometry();
131 QGraphicsLayoutItem::updateGeometry();
131 presenter()->layout()->invalidate();
132 presenter()->layout()->invalidate();
132 }
133 }
133
134
134 void ChartAxisElement::handleLabelsBrushChanged(const QBrush &brush)
135 void ChartAxisElement::handleLabelsBrushChanged(const QBrush &brush)
135 {
136 {
136 foreach (QGraphicsItem *item, m_labels->childItems())
137 foreach (QGraphicsItem *item, m_labels->childItems())
137 static_cast<QGraphicsTextItem *>(item)->setDefaultTextColor(brush.color());
138 static_cast<QGraphicsTextItem *>(item)->setDefaultTextColor(brush.color());
138 }
139 }
139
140
140 void ChartAxisElement::handleLabelsFontChanged(const QFont &font)
141 void ChartAxisElement::handleLabelsFontChanged(const QFont &font)
141 {
142 {
142 foreach (QGraphicsItem *item, m_labels->childItems())
143 foreach (QGraphicsItem *item, m_labels->childItems())
143 static_cast<QGraphicsTextItem *>(item)->setFont(font);
144 static_cast<QGraphicsTextItem *>(item)->setFont(font);
144 QGraphicsLayoutItem::updateGeometry();
145 QGraphicsLayoutItem::updateGeometry();
145 presenter()->layout()->invalidate();
146 presenter()->layout()->invalidate();
146 }
147 }
147
148
148 void ChartAxisElement::handleTitleTextChanged(const QString &title)
149 void ChartAxisElement::handleTitleTextChanged(const QString &title)
149 {
150 {
150 QGraphicsLayoutItem::updateGeometry();
151 QGraphicsLayoutItem::updateGeometry();
151 presenter()->layout()->invalidate();
152 presenter()->layout()->invalidate();
152 if (title.isEmpty() || !m_title->isVisible())
153 if (title.isEmpty() || !m_title->isVisible())
153 m_title->setHtml(title);
154 m_title->setHtml(title);
154 }
155 }
155
156
156 void ChartAxisElement::handleTitleBrushChanged(const QBrush &brush)
157 void ChartAxisElement::handleTitleBrushChanged(const QBrush &brush)
157 {
158 {
158 m_title->setDefaultTextColor(brush.color());
159 m_title->setDefaultTextColor(brush.color());
159 }
160 }
160
161
161 void ChartAxisElement::handleTitleFontChanged(const QFont &font)
162 void ChartAxisElement::handleTitleFontChanged(const QFont &font)
162 {
163 {
163 if (m_title->font() != font) {
164 if (m_title->font() != font) {
164 m_title->setFont(font);
165 m_title->setFont(font);
165 QGraphicsLayoutItem::updateGeometry();
166 QGraphicsLayoutItem::updateGeometry();
166 presenter()->layout()->invalidate();
167 presenter()->layout()->invalidate();
167 }
168 }
168 }
169 }
169
170
170 void ChartAxisElement::handleVisibleChanged(bool visible)
171 void ChartAxisElement::handleVisibleChanged(bool visible)
171 {
172 {
172 setVisible(visible);
173 setVisible(visible);
173 if (!visible) {
174 if (!visible) {
174 m_grid->setVisible(visible);
175 m_grid->setVisible(visible);
175 m_arrow->setVisible(visible);
176 m_arrow->setVisible(visible);
176 m_shades->setVisible(visible);
177 m_shades->setVisible(visible);
177 m_labels->setVisible(visible);
178 m_labels->setVisible(visible);
178 m_title->setVisible(visible);
179 m_title->setVisible(visible);
179 } else {
180 } else {
180 m_grid->setVisible(axis()->isGridLineVisible());
181 m_grid->setVisible(axis()->isGridLineVisible());
181 m_arrow->setVisible(axis()->isLineVisible());
182 m_arrow->setVisible(axis()->isLineVisible());
182 m_shades->setVisible(axis()->shadesVisible());
183 m_shades->setVisible(axis()->shadesVisible());
183 m_labels->setVisible(axis()->labelsVisible());
184 m_labels->setVisible(axis()->labelsVisible());
184 m_title->setVisible(axis()->isTitleVisible());
185 m_title->setVisible(axis()->isTitleVisible());
185 }
186 }
186
187
187 if (presenter()) presenter()->layout()->invalidate();
188 if (presenter()) presenter()->layout()->invalidate();
188 }
189 }
189
190
190 void ChartAxisElement::handleRangeChanged(qreal min, qreal max)
191 void ChartAxisElement::handleRangeChanged(qreal min, qreal max)
191 {
192 {
192 Q_UNUSED(min);
193 Q_UNUSED(min);
193 Q_UNUSED(max);
194 Q_UNUSED(max);
194
195
195 if (!isEmpty()) {
196 if (!isEmpty()) {
196 QVector<qreal> layout = calculateLayout();
197 QVector<qreal> layout = calculateLayout();
197 updateLayout(layout);
198 updateLayout(layout);
198 QSizeF before = effectiveSizeHint(Qt::PreferredSize);
199 QSizeF before = effectiveSizeHint(Qt::PreferredSize);
199 QSizeF after = sizeHint(Qt::PreferredSize);
200 QSizeF after = sizeHint(Qt::PreferredSize);
200
201
201 if (before != after) {
202 if (before != after) {
202 QGraphicsLayoutItem::updateGeometry();
203 QGraphicsLayoutItem::updateGeometry();
203 // We don't want to call invalidate on layout, since it will change minimum size of
204 // We don't want to call invalidate on layout, since it will change minimum size of
204 // component, which we would like to avoid since it causes nasty flips when scrolling
205 // component, which we would like to avoid since it causes nasty flips when scrolling
205 // or zooming, instead recalculate layout and use plotArea for extra space.
206 // or zooming, instead recalculate layout and use plotArea for extra space.
206 presenter()->layout()->setGeometry(presenter()->layout()->geometry());
207 presenter()->layout()->setGeometry(presenter()->layout()->geometry());
207 }
208 }
208 }
209 }
209 }
210 }
210
211
212 void ChartAxisElement::handleReverseChanged(bool reverse)
213 {
214 Q_UNUSED(reverse);
215
216 QGraphicsLayoutItem::updateGeometry();
217 presenter()->layout()->invalidate();
218 }
219
211 bool ChartAxisElement::isEmpty()
220 bool ChartAxisElement::isEmpty()
212 {
221 {
213 return axisGeometry().isEmpty()
222 return axisGeometry().isEmpty()
214 || gridGeometry().isEmpty()
223 || gridGeometry().isEmpty()
215 || qFuzzyCompare(min(), max());
224 || qFuzzyCompare(min(), max());
216 }
225 }
217
226
218 qreal ChartAxisElement::min() const
227 qreal ChartAxisElement::min() const
219 {
228 {
220 return m_axis->d_ptr->min();
229 return m_axis->d_ptr->min();
221 }
230 }
222
231
223 qreal ChartAxisElement::max() const
232 qreal ChartAxisElement::max() const
224 {
233 {
225 return m_axis->d_ptr->max();
234 return m_axis->d_ptr->max();
226 }
235 }
227
236
228 QString ChartAxisElement::formatLabel(const QString &formatSpec, const QByteArray &array,
237 QString ChartAxisElement::formatLabel(const QString &formatSpec, const QByteArray &array,
229 qreal value, int precision, const QString &preStr,
238 qreal value, int precision, const QString &preStr,
230 const QString &postStr) const
239 const QString &postStr) const
231 {
240 {
232 QString retVal;
241 QString retVal;
233 if (!formatSpec.isEmpty()) {
242 if (!formatSpec.isEmpty()) {
234 if (formatSpec.at(0) == QLatin1Char('d')
243 if (formatSpec.at(0) == QLatin1Char('d')
235 || formatSpec.at(0) == QLatin1Char('i')
244 || formatSpec.at(0) == QLatin1Char('i')
236 || formatSpec.at(0) == QLatin1Char('c')) {
245 || formatSpec.at(0) == QLatin1Char('c')) {
237 if (presenter()->localizeNumbers())
246 if (presenter()->localizeNumbers())
238 retVal = preStr + presenter()->locale().toString(qint64(value)) + postStr;
247 retVal = preStr + presenter()->locale().toString(qint64(value)) + postStr;
239 else
248 else
240 retVal = QString().sprintf(array, qint64(value));
249 retVal = QString().sprintf(array, qint64(value));
241 } else if (formatSpec.at(0) == QLatin1Char('u')
250 } else if (formatSpec.at(0) == QLatin1Char('u')
242 || formatSpec.at(0) == QLatin1Char('o')
251 || formatSpec.at(0) == QLatin1Char('o')
243 || formatSpec.at(0) == QLatin1Char('x')
252 || formatSpec.at(0) == QLatin1Char('x')
244 || formatSpec.at(0) == QLatin1Char('X')) {
253 || formatSpec.at(0) == QLatin1Char('X')) {
245 // These formats are not supported by localized numbers
254 // These formats are not supported by localized numbers
246 retVal = QString().sprintf(array, quint64(value));
255 retVal = QString().sprintf(array, quint64(value));
247 } else if (formatSpec.at(0) == QLatin1Char('f')
256 } else if (formatSpec.at(0) == QLatin1Char('f')
248 || formatSpec.at(0) == QLatin1Char('F')
257 || formatSpec.at(0) == QLatin1Char('F')
249 || formatSpec.at(0) == QLatin1Char('e')
258 || formatSpec.at(0) == QLatin1Char('e')
250 || formatSpec.at(0) == QLatin1Char('E')
259 || formatSpec.at(0) == QLatin1Char('E')
251 || formatSpec.at(0) == QLatin1Char('g')
260 || formatSpec.at(0) == QLatin1Char('g')
252 || formatSpec.at(0) == QLatin1Char('G')) {
261 || formatSpec.at(0) == QLatin1Char('G')) {
253 if (presenter()->localizeNumbers()) {
262 if (presenter()->localizeNumbers()) {
254 retVal = preStr
263 retVal = preStr
255 + presenter()->locale().toString(value, formatSpec.at(0).toLatin1(),
264 + presenter()->locale().toString(value, formatSpec.at(0).toLatin1(),
256 precision)
265 precision)
257 + postStr;
266 + postStr;
258 } else {
267 } else {
259 retVal = QString().sprintf(array, value);
268 retVal = QString().sprintf(array, value);
260 }
269 }
261 }
270 }
262 }
271 }
263 return retVal;
272 return retVal;
264 }
273 }
265
274
266 QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks,
275 QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks,
267 const QString &format) const
276 const QString &format) const
268 {
277 {
269 QStringList labels;
278 QStringList labels;
270
279
271 if (max <= min || ticks < 1)
280 if (max <= min || ticks < 1)
272 return labels;
281 return labels;
273
282
274 if (format.isNull()) {
283 if (format.isNull()) {
275 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0) + 1;
284 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0) + 1;
276 for (int i = 0; i < ticks; i++) {
285 for (int i = 0; i < ticks; i++) {
277 qreal value = min + (i * (max - min) / (ticks - 1));
286 qreal value = min + (i * (max - min) / (ticks - 1));
278 labels << presenter()->numberToString(value, 'f', n);
287 labels << presenter()->numberToString(value, 'f', n);
279 }
288 }
280 } else {
289 } else {
281 QByteArray array = format.toLatin1();
290 QByteArray array = format.toLatin1();
282 QString formatSpec;
291 QString formatSpec;
283 QString preStr;
292 QString preStr;
284 QString postStr;
293 QString postStr;
285 int precision = 6; // Six is the default precision in Qt API
294 int precision = 6; // Six is the default precision in Qt API
286 if (presenter()->localizeNumbers()) {
295 if (presenter()->localizeNumbers()) {
287 if (!labelFormatMatcherLocalized)
296 if (!labelFormatMatcherLocalized)
288 labelFormatMatcherLocalized
297 labelFormatMatcherLocalized
289 = new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
298 = new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
290 if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
299 if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
291 preStr = labelFormatMatcherLocalized->cap(1);
300 preStr = labelFormatMatcherLocalized->cap(1);
292 if (!labelFormatMatcherLocalized->cap(2).isEmpty())
301 if (!labelFormatMatcherLocalized->cap(2).isEmpty())
293 precision = labelFormatMatcherLocalized->cap(2).toInt();
302 precision = labelFormatMatcherLocalized->cap(2).toInt();
294 formatSpec = labelFormatMatcherLocalized->cap(3);
303 formatSpec = labelFormatMatcherLocalized->cap(3);
295 postStr = labelFormatMatcherLocalized->cap(4);
304 postStr = labelFormatMatcherLocalized->cap(4);
296 }
305 }
297 } else {
306 } else {
298 if (!labelFormatMatcher)
307 if (!labelFormatMatcher)
299 labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
308 labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
300 if (labelFormatMatcher->indexIn(format, 0) != -1)
309 if (labelFormatMatcher->indexIn(format, 0) != -1)
301 formatSpec = labelFormatMatcher->cap(1);
310 formatSpec = labelFormatMatcher->cap(1);
302 }
311 }
303 for (int i = 0; i < ticks; i++) {
312 for (int i = 0; i < ticks; i++) {
304 qreal value = min + (i * (max - min) / (ticks - 1));
313 qreal value = min + (i * (max - min) / (ticks - 1));
305 labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
314 labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
306 }
315 }
307 }
316 }
308
317
309 return labels;
318 return labels;
310 }
319 }
311
320
312 QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
321 QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
313 const QString &format) const
322 const QString &format) const
314 {
323 {
315 QStringList labels;
324 QStringList labels;
316
325
317 if (max <= min || ticks < 1)
326 if (max <= min || ticks < 1)
318 return labels;
327 return labels;
319
328
320 int firstTick;
329 int firstTick;
321 if (base > 1)
330 if (base > 1)
322 firstTick = qCeil(std::log10(min) / std::log10(base));
331 firstTick = qCeil(std::log10(min) / std::log10(base));
323 else
332 else
324 firstTick = qCeil(std::log10(max) / std::log10(base));
333 firstTick = qCeil(std::log10(max) / std::log10(base));
325
334
326 if (format.isNull()) {
335 if (format.isNull()) {
327 int n = 0;
336 int n = 0;
328 if (ticks > 1)
337 if (ticks > 1)
329 n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
338 n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
330 n++;
339 n++;
331 for (int i = firstTick; i < ticks + firstTick; i++) {
340 for (int i = firstTick; i < ticks + firstTick; i++) {
332 qreal value = qPow(base, i);
341 qreal value = qPow(base, i);
333 labels << presenter()->numberToString(value, 'f', n);
342 labels << presenter()->numberToString(value, 'f', n);
334 }
343 }
335 } else {
344 } else {
336 QByteArray array = format.toLatin1();
345 QByteArray array = format.toLatin1();
337 QString formatSpec;
346 QString formatSpec;
338 QString preStr;
347 QString preStr;
339 QString postStr;
348 QString postStr;
340 int precision = 6; // Six is the default precision in Qt API
349 int precision = 6; // Six is the default precision in Qt API
341 if (presenter()->localizeNumbers()) {
350 if (presenter()->localizeNumbers()) {
342 if (!labelFormatMatcherLocalized)
351 if (!labelFormatMatcherLocalized)
343 labelFormatMatcherLocalized =
352 labelFormatMatcherLocalized =
344 new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
353 new QRegExp(QString::fromLatin1(labelFormatMatchLocalizedString));
345 if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
354 if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) {
346 preStr = labelFormatMatcherLocalized->cap(1);
355 preStr = labelFormatMatcherLocalized->cap(1);
347 if (!labelFormatMatcherLocalized->cap(2).isEmpty())
356 if (!labelFormatMatcherLocalized->cap(2).isEmpty())
348 precision = labelFormatMatcherLocalized->cap(2).toInt();
357 precision = labelFormatMatcherLocalized->cap(2).toInt();
349 formatSpec = labelFormatMatcherLocalized->cap(3);
358 formatSpec = labelFormatMatcherLocalized->cap(3);
350 postStr = labelFormatMatcherLocalized->cap(4);
359 postStr = labelFormatMatcherLocalized->cap(4);
351 }
360 }
352 } else {
361 } else {
353 if (!labelFormatMatcher)
362 if (!labelFormatMatcher)
354 labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
363 labelFormatMatcher = new QRegExp(QString::fromLatin1(labelFormatMatchString));
355 if (labelFormatMatcher->indexIn(format, 0) != -1)
364 if (labelFormatMatcher->indexIn(format, 0) != -1)
356 formatSpec = labelFormatMatcher->cap(1);
365 formatSpec = labelFormatMatcher->cap(1);
357 }
366 }
358 for (int i = firstTick; i < ticks + firstTick; i++) {
367 for (int i = firstTick; i < ticks + firstTick; i++) {
359 qreal value = qPow(base, i);
368 qreal value = qPow(base, i);
360 labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
369 labels << formatLabel(formatSpec, array, value, precision, preStr, postStr);
361 }
370 }
362 }
371 }
363
372
364 return labels;
373 return labels;
365 }
374 }
366
375
367 QStringList ChartAxisElement::createDateTimeLabels(qreal min, qreal max,int ticks,
376 QStringList ChartAxisElement::createDateTimeLabels(qreal min, qreal max,int ticks,
368 const QString &format) const
377 const QString &format) const
369 {
378 {
370 QStringList labels;
379 QStringList labels;
371
380
372 if (max <= min || ticks < 1)
381 if (max <= min || ticks < 1)
373 return labels;
382 return labels;
374
383
375 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
384 int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0);
376 n++;
385 n++;
377 for (int i = 0; i < ticks; i++) {
386 for (int i = 0; i < ticks; i++) {
378 qreal value = min + (i * (max - min) / (ticks - 1));
387 qreal value = min + (i * (max - min) / (ticks - 1));
379 labels << presenter()->locale().toString(QDateTime::fromMSecsSinceEpoch(value), format);
388 labels << presenter()->locale().toString(QDateTime::fromMSecsSinceEpoch(value), format);
380 }
389 }
381 return labels;
390 return labels;
382 }
391 }
383
392
384 void ChartAxisElement::axisSelected()
393 void ChartAxisElement::axisSelected()
385 {
394 {
386 emit clicked();
395 emit clicked();
387 }
396 }
388
397
389 #include "moc_chartaxiselement_p.cpp"
398 #include "moc_chartaxiselement_p.cpp"
390
399
391 QT_CHARTS_END_NAMESPACE
400 QT_CHARTS_END_NAMESPACE
@@ -1,151 +1,152
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTAXISELEMENT_H
28 #ifndef CHARTAXISELEMENT_H
29 #define CHARTAXISELEMENT_H
29 #define CHARTAXISELEMENT_H
30
30
31 #include <QtCharts/QChartGlobal>
31 #include <QtCharts/QChartGlobal>
32 #include <private/chartelement_p.h>
32 #include <private/chartelement_p.h>
33 #include <private/axisanimation_p.h>
33 #include <private/axisanimation_p.h>
34 #include <QtWidgets/QGraphicsItem>
34 #include <QtWidgets/QGraphicsItem>
35 #include <QtWidgets/QGraphicsLayoutItem>
35 #include <QtWidgets/QGraphicsLayoutItem>
36 #include <QtGui/QFont>
36 #include <QtGui/QFont>
37
37
38 QT_CHARTS_BEGIN_NAMESPACE
38 QT_CHARTS_BEGIN_NAMESPACE
39
39
40 class ChartPresenter;
40 class ChartPresenter;
41 class QAbstractAxis;
41 class QAbstractAxis;
42
42
43 class ChartAxisElement : public ChartElement, public QGraphicsLayoutItem
43 class ChartAxisElement : public ChartElement, public QGraphicsLayoutItem
44 {
44 {
45 Q_OBJECT
45 Q_OBJECT
46
46
47 using QGraphicsLayoutItem::setGeometry;
47 using QGraphicsLayoutItem::setGeometry;
48 public:
48 public:
49 ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
49 ChartAxisElement(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis = false);
50 ~ChartAxisElement();
50 ~ChartAxisElement();
51
51
52 virtual QRectF gridGeometry() const = 0;
52 virtual QRectF gridGeometry() const = 0;
53 virtual void setGeometry(const QRectF &axis, const QRectF &grid) = 0;
53 virtual void setGeometry(const QRectF &axis, const QRectF &grid) = 0;
54 virtual bool isEmpty() = 0;
54 virtual bool isEmpty() = 0;
55
55
56 void setAnimation(AxisAnimation *animation) { m_animation = animation; }
56 void setAnimation(AxisAnimation *animation) { m_animation = animation; }
57 AxisAnimation *animation() const { return m_animation; }
57 AxisAnimation *animation() const { return m_animation; }
58
58
59 QAbstractAxis *axis() const { return m_axis; }
59 QAbstractAxis *axis() const { return m_axis; }
60 void setLayout(QVector<qreal> &layout) { m_layout = layout; }
60 void setLayout(QVector<qreal> &layout) { m_layout = layout; }
61 QVector<qreal> &layout() { return m_layout; } // Modifiable reference
61 QVector<qreal> &layout() { return m_layout; } // Modifiable reference
62 inline qreal labelPadding() const { return qreal(4.0); }
62 inline qreal labelPadding() const { return qreal(4.0); }
63 inline qreal titlePadding() const { return qreal(2.0); }
63 inline qreal titlePadding() const { return qreal(2.0); }
64 void setLabels(const QStringList &labels) { m_labelsList = labels; }
64 void setLabels(const QStringList &labels) { m_labelsList = labels; }
65 QStringList labels() const { return m_labelsList; }
65 QStringList labels() const { return m_labelsList; }
66
66
67 qreal min() const;
67 qreal min() const;
68 qreal max() const;
68 qreal max() const;
69
69
70 QRectF axisGeometry() const { return m_axisRect; }
70 QRectF axisGeometry() const { return m_axisRect; }
71 void setAxisGeometry(const QRectF &axisGeometry) { m_axisRect = axisGeometry; }
71 void setAxisGeometry(const QRectF &axisGeometry) { m_axisRect = axisGeometry; }
72
72
73 void axisSelected();
73 void axisSelected();
74
74
75 //this flag indicates that axis is used to show intervals it means labels are in between ticks
75 //this flag indicates that axis is used to show intervals it means labels are in between ticks
76 bool intervalAxis() const { return m_intervalAxis; }
76 bool intervalAxis() const { return m_intervalAxis; }
77
77
78 QStringList createValueLabels(qreal max, qreal min, int ticks, const QString &format) const;
78 QStringList createValueLabels(qreal max, qreal min, int ticks, const QString &format) const;
79 QStringList createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
79 QStringList createLogValueLabels(qreal min, qreal max, qreal base, int ticks,
80 const QString &format) const;
80 const QString &format) const;
81 QStringList createDateTimeLabels(qreal max, qreal min, int ticks, const QString &format) const;
81 QStringList createDateTimeLabels(qreal max, qreal min, int ticks, const QString &format) const;
82
82
83 // from QGraphicsLayoutItem
83 // from QGraphicsLayoutItem
84 QRectF boundingRect() const
84 QRectF boundingRect() const
85 {
85 {
86 return QRectF();
86 return QRectF();
87 }
87 }
88
88
89 // from QGraphicsLayoutItem
89 // from QGraphicsLayoutItem
90 void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
90 void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*)
91 {
91 {
92 }
92 }
93
93
94 protected:
94 protected:
95 virtual QVector<qreal> calculateLayout() const = 0;
95 virtual QVector<qreal> calculateLayout() const = 0;
96 virtual void updateLayout(QVector<qreal> &layout) = 0;
96 virtual void updateLayout(QVector<qreal> &layout) = 0;
97
97
98 QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
98 QList<QGraphicsItem *> gridItems() { return m_grid->childItems(); }
99 QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
99 QList<QGraphicsItem *> labelItems() { return m_labels->childItems(); }
100 QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
100 QList<QGraphicsItem *> shadeItems() { return m_shades->childItems(); }
101 QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
101 QList<QGraphicsItem *> arrowItems() { return m_arrow->childItems(); }
102 QGraphicsTextItem *titleItem() const { return m_title.data(); }
102 QGraphicsTextItem *titleItem() const { return m_title.data(); }
103 QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
103 QGraphicsItemGroup *gridGroup() { return m_grid.data(); }
104 QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
104 QGraphicsItemGroup *labelGroup() { return m_labels.data(); }
105 QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
105 QGraphicsItemGroup *shadeGroup() { return m_shades.data(); }
106 QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
106 QGraphicsItemGroup *arrowGroup() { return m_arrow.data(); }
107
107
108 public Q_SLOTS:
108 public Q_SLOTS:
109 void handleVisibleChanged(bool visible);
109 void handleVisibleChanged(bool visible);
110 void handleArrowVisibleChanged(bool visible);
110 void handleArrowVisibleChanged(bool visible);
111 void handleGridVisibleChanged(bool visible);
111 void handleGridVisibleChanged(bool visible);
112 void handleLabelsVisibleChanged(bool visible);
112 void handleLabelsVisibleChanged(bool visible);
113 void handleShadesVisibleChanged(bool visible);
113 void handleShadesVisibleChanged(bool visible);
114 void handleLabelsAngleChanged(int angle);
114 void handleLabelsAngleChanged(int angle);
115 virtual void handleShadesBrushChanged(const QBrush &brush) = 0;
115 virtual void handleShadesBrushChanged(const QBrush &brush) = 0;
116 virtual void handleShadesPenChanged(const QPen &pen) = 0;
116 virtual void handleShadesPenChanged(const QPen &pen) = 0;
117 virtual void handleArrowPenChanged(const QPen &pen) = 0;
117 virtual void handleArrowPenChanged(const QPen &pen) = 0;
118 virtual void handleGridPenChanged(const QPen &pen) = 0;
118 virtual void handleGridPenChanged(const QPen &pen) = 0;
119 void handleLabelsBrushChanged(const QBrush &brush);
119 void handleLabelsBrushChanged(const QBrush &brush);
120 void handleLabelsFontChanged(const QFont &font);
120 void handleLabelsFontChanged(const QFont &font);
121 void handleTitleBrushChanged(const QBrush &brush);
121 void handleTitleBrushChanged(const QBrush &brush);
122 void handleTitleFontChanged(const QFont &font);
122 void handleTitleFontChanged(const QFont &font);
123 void handleTitleTextChanged(const QString &title);
123 void handleTitleTextChanged(const QString &title);
124 void handleTitleVisibleChanged(bool visible);
124 void handleTitleVisibleChanged(bool visible);
125 void handleRangeChanged(qreal min, qreal max);
125 void handleRangeChanged(qreal min, qreal max);
126 void handleReverseChanged(bool reverse);
126
127
127 Q_SIGNALS:
128 Q_SIGNALS:
128 void clicked();
129 void clicked();
129
130
130 private:
131 private:
131 void connectSlots();
132 void connectSlots();
132 QString formatLabel(const QString &formatSpec, const QByteArray &array,
133 QString formatLabel(const QString &formatSpec, const QByteArray &array,
133 qreal value, int precision, const QString &preStr,
134 qreal value, int precision, const QString &preStr,
134 const QString &postStr) const;
135 const QString &postStr) const;
135
136
136 QAbstractAxis *m_axis;
137 QAbstractAxis *m_axis;
137 AxisAnimation *m_animation;
138 AxisAnimation *m_animation;
138 QVector<qreal> m_layout;
139 QVector<qreal> m_layout;
139 QStringList m_labelsList;
140 QStringList m_labelsList;
140 QRectF m_axisRect;
141 QRectF m_axisRect;
141 QScopedPointer<QGraphicsItemGroup> m_grid;
142 QScopedPointer<QGraphicsItemGroup> m_grid;
142 QScopedPointer<QGraphicsItemGroup> m_arrow;
143 QScopedPointer<QGraphicsItemGroup> m_arrow;
143 QScopedPointer<QGraphicsItemGroup> m_shades;
144 QScopedPointer<QGraphicsItemGroup> m_shades;
144 QScopedPointer<QGraphicsItemGroup> m_labels;
145 QScopedPointer<QGraphicsItemGroup> m_labels;
145 QScopedPointer<QGraphicsTextItem> m_title;
146 QScopedPointer<QGraphicsTextItem> m_title;
146 bool m_intervalAxis;
147 bool m_intervalAxis;
147 };
148 };
148
149
149 QT_CHARTS_END_NAMESPACE
150 QT_CHARTS_END_NAMESPACE
150
151
151 #endif /* CHARTAXISELEMENT_H */
152 #endif /* CHARTAXISELEMENT_H */
@@ -1,264 +1,324
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/horizontalaxis_p.h>
19 #include <private/horizontalaxis_p.h>
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <private/chartpresenter_p.h>
21 #include <private/chartpresenter_p.h>
22 #include <QtCharts/QCategoryAxis>
22 #include <QtCharts/QCategoryAxis>
23 #include <QtCore/QtMath>
23 #include <QtCore/QtMath>
24 #include <QtCore/QDebug>
24 #include <QtCore/QDebug>
25
25
26 QT_CHARTS_BEGIN_NAMESPACE
26 QT_CHARTS_BEGIN_NAMESPACE
27
27
28 HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
28 HorizontalAxis::HorizontalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
29 : CartesianChartAxis(axis, item, intervalAxis)
29 : CartesianChartAxis(axis, item, intervalAxis)
30 {
30 {
31 }
31 }
32
32
33 HorizontalAxis::~HorizontalAxis()
33 HorizontalAxis::~HorizontalAxis()
34 {
34 {
35 }
35 }
36
36
37 void HorizontalAxis::updateGeometry()
37 void HorizontalAxis::updateGeometry()
38 {
38 {
39 const QVector<qreal> &layout = ChartAxisElement::layout();
39 const QVector<qreal> &layout = ChartAxisElement::layout();
40
40
41 if (layout.isEmpty() && axis()->type() != QAbstractAxis::AxisTypeLogValue)
41 if (layout.isEmpty() && axis()->type() != QAbstractAxis::AxisTypeLogValue)
42 return;
42 return;
43
43
44 QStringList labelList = labels();
44 QStringList labelList = labels();
45
45
46 QList<QGraphicsItem *> labels = labelItems();
46 QList<QGraphicsItem *> labels = labelItems();
47 QList<QGraphicsItem *> arrow = arrowItems();
47 QList<QGraphicsItem *> arrow = arrowItems();
48 QGraphicsTextItem *title = titleItem();
48 QGraphicsTextItem *title = titleItem();
49
49
50 Q_ASSERT(labels.size() == labelList.size());
50 Q_ASSERT(labels.size() == labelList.size());
51 Q_ASSERT(layout.size() == labelList.size());
51 Q_ASSERT(layout.size() == labelList.size());
52
52
53 const QRectF &axisRect = axisGeometry();
53 const QRectF &axisRect = axisGeometry();
54 const QRectF &gridRect = gridGeometry();
54 const QRectF &gridRect = gridGeometry();
55
55
56 //arrow
56 //arrow
57 QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem *>(arrow.at(0));
57 QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem *>(arrow.at(0));
58
58
59 if (axis()->alignment() == Qt::AlignTop)
59 if (axis()->alignment() == Qt::AlignTop)
60 arrowItem->setLine(gridRect.left(), axisRect.bottom(), gridRect.right(), axisRect.bottom());
60 arrowItem->setLine(gridRect.left(), axisRect.bottom(), gridRect.right(), axisRect.bottom());
61 else if (axis()->alignment() == Qt::AlignBottom)
61 else if (axis()->alignment() == Qt::AlignBottom)
62 arrowItem->setLine(gridRect.left(), axisRect.top(), gridRect.right(), axisRect.top());
62 arrowItem->setLine(gridRect.left(), axisRect.top(), gridRect.right(), axisRect.top());
63
63
64 qreal width = 0;
64 qreal width = 0;
65 const QLatin1String ellipsis("...");
65 const QLatin1String ellipsis("...");
66
66
67 //title
67 //title
68 QRectF titleBoundingRect;
68 QRectF titleBoundingRect;
69 QString titleText = axis()->titleText();
69 QString titleText = axis()->titleText();
70 qreal availableSpace = axisRect.height() - labelPadding();
70 qreal availableSpace = axisRect.height() - labelPadding();
71 if (!titleText.isEmpty() && titleItem()->isVisible()) {
71 if (!titleText.isEmpty() && titleItem()->isVisible()) {
72 availableSpace -= titlePadding() * 2.0;
72 availableSpace -= titlePadding() * 2.0;
73 qreal minimumLabelHeight = ChartPresenter::textBoundingRect(axis()->labelsFont(),
73 qreal minimumLabelHeight = ChartPresenter::textBoundingRect(axis()->labelsFont(),
74 QStringLiteral("...")).height();
74 QStringLiteral("...")).height();
75 qreal titleSpace = availableSpace - minimumLabelHeight;
75 qreal titleSpace = availableSpace - minimumLabelHeight;
76 title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
76 title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(0.0),
77 gridRect.width(), titleSpace,
77 gridRect.width(), titleSpace,
78 titleBoundingRect));
78 titleBoundingRect));
79 title->setTextWidth(titleBoundingRect.width());
79 title->setTextWidth(titleBoundingRect.width());
80
80
81 titleBoundingRect = title->boundingRect();
81 titleBoundingRect = title->boundingRect();
82
82
83 QPointF center = gridRect.center() - titleBoundingRect.center();
83 QPointF center = gridRect.center() - titleBoundingRect.center();
84 if (axis()->alignment() == Qt::AlignTop)
84 if (axis()->alignment() == Qt::AlignTop)
85 title->setPos(center.x(), axisRect.top() + titlePadding());
85 title->setPos(center.x(), axisRect.top() + titlePadding());
86 else if (axis()->alignment() == Qt::AlignBottom)
86 else if (axis()->alignment() == Qt::AlignBottom)
87 title->setPos(center.x(), axisRect.bottom() - titleBoundingRect.height() - titlePadding());
87 title->setPos(center.x(), axisRect.bottom() - titleBoundingRect.height() - titlePadding());
88
88
89 availableSpace -= titleBoundingRect.height();
89 availableSpace -= titleBoundingRect.height();
90 }
90 }
91
91
92 if (layout.isEmpty() && axis()->type() == QAbstractAxis::AxisTypeLogValue)
92 if (layout.isEmpty() && axis()->type() == QAbstractAxis::AxisTypeLogValue)
93 return;
93 return;
94
94
95 QList<QGraphicsItem *> lines = gridItems();
95 QList<QGraphicsItem *> lines = gridItems();
96 QList<QGraphicsItem *> shades = shadeItems();
96 QList<QGraphicsItem *> shades = shadeItems();
97
97
98 for (int i = 0; i < layout.size(); ++i) {
98 for (int i = 0; i < layout.size(); ++i) {
99 //items
99 //items
100 QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem*>(lines.at(i));
100 QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem*>(lines.at(i));
101 QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem*>(arrow.at(i + 1));
101 QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem*>(arrow.at(i + 1));
102 QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
102 QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
103
103
104 //grid line
104 //grid line
105 gridItem->setLine(layout[i], gridRect.top(), layout[i], gridRect.bottom());
105 if (axis()->isReverse()) {
106 gridItem->setLine(gridRect.right() - layout[i] + gridRect.left(), gridRect.top(),
107 gridRect.right() - layout[i] + gridRect.left(), gridRect.bottom());
108 } else {
109 gridItem->setLine(layout[i], gridRect.top(), layout[i], gridRect.bottom());
110 }
106
111
107 //label text wrapping
112 //label text wrapping
108 QString text = labelList.at(i);
113 QString text;
114 if (axis()->isReverse() && axis()->type() != QAbstractAxis::AxisTypeCategory)
115 text = labelList.at(labelList.count() - i - 1);
116 else
117 text = labelList.at(i);
118
109 QRectF boundingRect;
119 QRectF boundingRect;
110 // don't truncate empty labels
120 // don't truncate empty labels
111 if (text.isEmpty()) {
121 if (text.isEmpty()) {
112 labelItem->setHtml(text);
122 labelItem->setHtml(text);
113 } else {
123 } else {
114 qreal labelWidth = axisRect.width() / layout.count() - (2 * labelPadding());
124 qreal labelWidth = axisRect.width() / layout.count() - (2 * labelPadding());
115 QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
125 QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
116 axis()->labelsAngle(),
126 axis()->labelsAngle(),
117 labelWidth,
127 labelWidth,
118 availableSpace, boundingRect);
128 availableSpace, boundingRect);
119 labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
129 labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
120 truncatedText).width());
130 truncatedText).width());
121 labelItem->setHtml(truncatedText);
131 labelItem->setHtml(truncatedText);
122 }
132 }
123
133
124 //label transformation origin point
134 //label transformation origin point
125 const QRectF& rect = labelItem->boundingRect();
135 const QRectF& rect = labelItem->boundingRect();
126 QPointF center = rect.center();
136 QPointF center = rect.center();
127 labelItem->setTransformOriginPoint(center.x(), center.y());
137 labelItem->setTransformOriginPoint(center.x(), center.y());
128 qreal heightDiff = rect.height() - boundingRect.height();
138 qreal heightDiff = rect.height() - boundingRect.height();
129 qreal widthDiff = rect.width() - boundingRect.width();
139 qreal widthDiff = rect.width() - boundingRect.width();
130
140
131 //ticks and label position
141 //ticks and label position
132 if (axis()->alignment() == Qt::AlignTop) {
142 if (axis()->alignment() == Qt::AlignTop) {
133 labelItem->setPos(layout[i] - center.x(), axisRect.bottom() - rect.height() + (heightDiff / 2.0) - labelPadding());
143 if (axis()->isReverse()) {
134 tickItem->setLine(layout[i], axisRect.bottom(), layout[i], axisRect.bottom() - labelPadding());
144 labelItem->setPos(gridRect.right() - layout[layout.size() - i - 1]
145 + gridRect.left() - center.x(),
146 axisRect.bottom() - rect.height()
147 + (heightDiff / 2.0) - labelPadding());
148 tickItem->setLine(gridRect.right() + gridRect.left() - layout[i],
149 axisRect.bottom(),
150 gridRect.right() + gridRect.left() - layout[i],
151 axisRect.bottom() - labelPadding());
152 } else {
153 labelItem->setPos(layout[i] - center.x(), axisRect.bottom() - rect.height()
154 + (heightDiff / 2.0) - labelPadding());
155 tickItem->setLine(layout[i], axisRect.bottom(),
156 layout[i], axisRect.bottom() - labelPadding());
157 }
135 } else if (axis()->alignment() == Qt::AlignBottom) {
158 } else if (axis()->alignment() == Qt::AlignBottom) {
136 labelItem->setPos(layout[i] - center.x(), axisRect.top() - (heightDiff / 2.0) + labelPadding());
159 if (axis()->isReverse()) {
137 tickItem->setLine(layout[i], axisRect.top(), layout[i], axisRect.top() + labelPadding());
160 labelItem->setPos(gridRect.right() - layout[layout.size() - i - 1]
161 + gridRect.left() - center.x(),
162 axisRect.top() - (heightDiff / 2.0) + labelPadding());
163 tickItem->setLine(gridRect.right() + gridRect.left() - layout[i], axisRect.top(),
164 gridRect.right() + gridRect.left() - layout[i],
165 axisRect.top() + labelPadding());
166 } else {
167 labelItem->setPos(layout[i] - center.x(), axisRect.top() - (heightDiff / 2.0)
168 + labelPadding());
169 tickItem->setLine(layout[i], axisRect.top(),
170 layout[i], axisRect.top() + labelPadding());
171 }
138 }
172 }
139
173
140 //label in between
174 //label in between
141 bool forceHide = false;
175 bool forceHide = false;
142 if (intervalAxis() && (i + 1) != layout.size()) {
176 if (intervalAxis() && (i + 1) != layout.size()) {
143 qreal leftBound = qMax(layout[i], gridRect.left());
177 qreal leftBound;
144 qreal rightBound = qMin(layout[i + 1], gridRect.right());
178 qreal rightBound;
179 if (axis()->isReverse()) {
180 leftBound = qMax(gridRect.right() + gridRect.left() - layout[i + 1],
181 gridRect.left());
182 rightBound = qMin(gridRect.right() + gridRect.left() - layout[i], gridRect.right());
183 } else {
184 leftBound = qMax(layout[i], gridRect.left());
185 rightBound = qMin(layout[i + 1], gridRect.right());
186 }
145 const qreal delta = rightBound - leftBound;
187 const qreal delta = rightBound - leftBound;
146 if (axis()->type() != QAbstractAxis::AxisTypeCategory) {
188 if (axis()->type() != QAbstractAxis::AxisTypeCategory) {
147 // Hide label in case visible part of the category at the grid edge is too narrow
189 // Hide label in case visible part of the category at the grid edge is too narrow
148 if (delta < boundingRect.width()
190 if (delta < boundingRect.width()
149 && (leftBound == gridRect.left() || rightBound == gridRect.right())) {
191 && (leftBound == gridRect.left() || rightBound == gridRect.right())) {
150 forceHide = true;
192 forceHide = true;
151 } else {
193 } else {
152 labelItem->setPos(leftBound + (delta / 2.0) - center.x(), labelItem->pos().y());
194 labelItem->setPos(leftBound + (delta / 2.0) - center.x(), labelItem->pos().y());
153 }
195 }
154 } else {
196 } else {
155 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
197 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
156 if (categoryAxis->labelsPosition() == QCategoryAxis::AxisLabelsPositionCenter) {
198 if (categoryAxis->labelsPosition() == QCategoryAxis::AxisLabelsPositionCenter) {
157 if (delta < boundingRect.width()
199 if (delta < boundingRect.width()
158 && (leftBound == gridRect.left() || rightBound == gridRect.right())) {
200 && (leftBound == gridRect.left() || rightBound == gridRect.right())) {
159 forceHide = true;
201 forceHide = true;
160 } else {
202 } else {
161 labelItem->setPos(leftBound + (delta / 2.0) - center.x(),
203 labelItem->setPos(leftBound + (delta / 2.0) - center.x(),
162 labelItem->pos().y());
204 labelItem->pos().y());
163 }
205 }
164 } else if (categoryAxis->labelsPosition()
206 } else if (categoryAxis->labelsPosition()
165 == QCategoryAxis::AxisLabelsPositionOnValue) {
207 == QCategoryAxis::AxisLabelsPositionOnValue) {
166 labelItem->setPos(rightBound - center.x(), labelItem->pos().y());
208 if (axis()->isReverse())
209 labelItem->setPos(leftBound - center.x(), labelItem->pos().y());
210 else
211 labelItem->setPos(rightBound - center.x(), labelItem->pos().y());
167 }
212 }
168 }
213 }
169 }
214 }
170
215
171 //label overlap detection - compensate one pixel for rounding errors
216 //label overlap detection - compensate one pixel for rounding errors
172 if ((labelItem->pos().x() < width && labelItem->toPlainText() == ellipsis) || forceHide ||
217 if ((labelItem->pos().x() < width && labelItem->toPlainText() == ellipsis) || forceHide ||
173 (labelItem->pos().x() + (widthDiff / 2.0)) < (axisRect.left() - 1.0) ||
218 (labelItem->pos().x() + (widthDiff / 2.0)) < (axisRect.left() - 1.0) ||
174 (labelItem->pos().x() + (widthDiff / 2.0) - 1.0) > axisRect.right()) {
219 (labelItem->pos().x() + (widthDiff / 2.0) - 1.0) > axisRect.right()) {
175 labelItem->setVisible(false);
220 labelItem->setVisible(false);
176 } else {
221 } else {
177 labelItem->setVisible(true);
222 labelItem->setVisible(true);
178 width = boundingRect.width() + labelItem->pos().x();
223 width = boundingRect.width() + labelItem->pos().x();
179 }
224 }
180
225
181 //shades
226 //shades
182 QGraphicsRectItem *shadeItem = 0;
227 QGraphicsRectItem *shadeItem = 0;
183 if (i == 0)
228 if (i == 0)
184 shadeItem = static_cast<QGraphicsRectItem *>(shades.at(0));
229 shadeItem = static_cast<QGraphicsRectItem *>(shades.at(0));
185 else if (i % 2)
230 else if (i % 2)
186 shadeItem = static_cast<QGraphicsRectItem *>(shades.at((i / 2) + 1));
231 shadeItem = static_cast<QGraphicsRectItem *>(shades.at((i / 2) + 1));
187 if (shadeItem) {
232 if (shadeItem) {
188 qreal leftBound;
233 qreal leftBound;
189 qreal rightBound;
234 qreal rightBound;
190 if (i == 0) {
235 if (i == 0) {
191 leftBound = gridRect.left();
236 if (axis()->isReverse()) {
192 rightBound = layout[0];
237 leftBound = gridRect.right() + gridRect.left() - layout[i];
193 } else {
194 leftBound = layout[i];
195 if (i == layout.size() - 1)
196 rightBound = gridRect.right();
238 rightBound = gridRect.right();
197 else
239 } else {
198 rightBound = qMin(layout[i + 1], gridRect.right());
240 leftBound = gridRect.left();
241 rightBound = layout[0];
242 }
243 } else {
244 if (axis()->isReverse()) {
245 rightBound = gridRect.right() + gridRect.left() - layout[i];
246 if (i == layout.size() - 1) {
247 leftBound = gridRect.left();
248 } else {
249 leftBound = qMax(gridRect.right() + gridRect.left() - layout[i + 1],
250 gridRect.left());
251 }
252 } else {
253 leftBound = layout[i];
254 if (i == layout.size() - 1)
255 rightBound = gridRect.right();
256 else
257 rightBound = qMin(layout[i + 1], gridRect.right());
258 }
199 }
259 }
200 if (leftBound < gridRect.left())
260 if (leftBound < gridRect.left())
201 leftBound = gridRect.left();
261 leftBound = gridRect.left();
202 if (rightBound > gridRect.right())
262 if (rightBound > gridRect.right())
203 rightBound = gridRect.right();
263 rightBound = gridRect.right();
204 shadeItem->setRect(leftBound, gridRect.top(), rightBound - leftBound,
264 shadeItem->setRect(leftBound, gridRect.top(), rightBound - leftBound,
205 gridRect.height());
265 gridRect.height());
206 if (shadeItem->rect().width() <= 0.0)
266 if (shadeItem->rect().width() <= 0.0)
207 shadeItem->setVisible(false);
267 shadeItem->setVisible(false);
208 else
268 else
209 shadeItem->setVisible(true);
269 shadeItem->setVisible(true);
210 }
270 }
211
271
212 // check if the grid line and the axis tick should be shown
272 // check if the grid line and the axis tick should be shown
213 qreal x = gridItem->line().p1().x();
273 qreal x = gridItem->line().p1().x();
214 if (x < gridRect.left() || x > gridRect.right()) {
274 if (x < gridRect.left() || x > gridRect.right()) {
215 gridItem->setVisible(false);
275 gridItem->setVisible(false);
216 tickItem->setVisible(false);
276 tickItem->setVisible(false);
217 } else {
277 } else {
218 gridItem->setVisible(true);
278 gridItem->setVisible(true);
219 tickItem->setVisible(true);
279 tickItem->setVisible(true);
220 }
280 }
221
281
222 }
282 }
223
283
224 //begin/end grid line in case labels between
284 //begin/end grid line in case labels between
225 if (intervalAxis()) {
285 if (intervalAxis()) {
226 QGraphicsLineItem *gridLine;
286 QGraphicsLineItem *gridLine;
227 gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
287 gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
228 gridLine->setLine(gridRect.right(), gridRect.top(), gridRect.right(), gridRect.bottom());
288 gridLine->setLine(gridRect.right(), gridRect.top(), gridRect.right(), gridRect.bottom());
229 gridLine->setVisible(true);
289 gridLine->setVisible(true);
230 gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size()+1));
290 gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size()+1));
231 gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.left(), gridRect.bottom());
291 gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.left(), gridRect.bottom());
232 gridLine->setVisible(true);
292 gridLine->setVisible(true);
233 }
293 }
234 }
294 }
235
295
236 QSizeF HorizontalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
296 QSizeF HorizontalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
237 {
297 {
238 Q_UNUSED(constraint);
298 Q_UNUSED(constraint);
239 QSizeF sh(0,0);
299 QSizeF sh(0,0);
240
300
241 if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
301 if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
242 return sh;
302 return sh;
243
303
244 switch (which) {
304 switch (which) {
245 case Qt::MinimumSize: {
305 case Qt::MinimumSize: {
246 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(),
306 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(),
247 QStringLiteral("..."));
307 QStringLiteral("..."));
248 sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
308 sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
249 break;
309 break;
250 }
310 }
251 case Qt::MaximumSize:
311 case Qt::MaximumSize:
252 case Qt::PreferredSize: {
312 case Qt::PreferredSize: {
253 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
313 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
254 sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
314 sh = QSizeF(titleRect.width(), titleRect.height() + (titlePadding() * 2.0));
255 break;
315 break;
256 }
316 }
257 default:
317 default:
258 break;
318 break;
259 }
319 }
260
320
261 return sh;
321 return sh;
262 }
322 }
263
323
264 QT_CHARTS_END_NAMESPACE
324 QT_CHARTS_END_NAMESPACE
@@ -1,948 +1,979
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <QtCharts/QAbstractAxis>
19 #include <QtCharts/QAbstractAxis>
20 #include <private/qabstractaxis_p.h>
20 #include <private/qabstractaxis_p.h>
21 #include <private/chartdataset_p.h>
21 #include <private/chartdataset_p.h>
22 #include <private/charttheme_p.h>
22 #include <private/charttheme_p.h>
23 #include <private/qchart_p.h>
23 #include <private/qchart_p.h>
24
24
25 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
26
26
27 /*!
27 /*!
28 \class QAbstractAxis
28 \class QAbstractAxis
29 \inmodule Qt Charts
29 \inmodule Qt Charts
30 \brief The QAbstractAxis class is used for manipulating chart's axis.
30 \brief The QAbstractAxis class is used for manipulating chart's axis.
31 \mainclass
31 \mainclass
32
32
33 Each series can be bound to one or more horizontal and vertical axes, but mixing axis types
33 Each series can be bound to one or more horizontal and vertical axes, but mixing axis types
34 that would result in different domains is not supported, such as specifying
34 that would result in different domains is not supported, such as specifying
35 QValueAxis and QLogValueAxis on the same orientation.
35 QValueAxis and QLogValueAxis on the same orientation.
36
36
37 Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
37 Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
38 and shades can be individually controlled.
38 and shades can be individually controlled.
39 */
39 */
40 /*!
40 /*!
41 \qmltype AbstractAxis
41 \qmltype AbstractAxis
42 \instantiates QAbstractAxis
42 \instantiates QAbstractAxis
43 \inqmlmodule QtCharts
43 \inqmlmodule QtCharts
44
44
45 \brief The AbstractAxis is a base element used for specialized axis elements.
45 \brief The AbstractAxis is a base element used for specialized axis elements.
46
46
47 Each series can be bound to only one horizontal and vertical axis.
47 Each series can be bound to only one horizontal and vertical axis.
48
48
49 Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
49 Properties and visibility of various axis elements such as axis line, title, labels, grid lines,
50 and shades can be individually controlled.
50 and shades can be individually controlled.
51 */
51 */
52
52
53 /*!
53 /*!
54 \enum QAbstractAxis::AxisType
54 \enum QAbstractAxis::AxisType
55
55
56 The type of the axis object.
56 The type of the axis object.
57
57
58 \value AxisTypeNoAxis
58 \value AxisTypeNoAxis
59 \value AxisTypeValue
59 \value AxisTypeValue
60 \value AxisTypeBarCategory
60 \value AxisTypeBarCategory
61 \value AxisTypeCategory
61 \value AxisTypeCategory
62 \value AxisTypeDateTime
62 \value AxisTypeDateTime
63 \value AxisTypeLogValue
63 \value AxisTypeLogValue
64 */
64 */
65
65
66 /*!
66 /*!
67 *\fn void QAbstractAxis::type() const
67 *\fn void QAbstractAxis::type() const
68 Returns the type of the axis
68 Returns the type of the axis
69 */
69 */
70
70
71 /*!
71 /*!
72 \property QAbstractAxis::lineVisible
72 \property QAbstractAxis::lineVisible
73 The visibility of the axis line
73 The visibility of the axis line
74 */
74 */
75 /*!
75 /*!
76 \qmlproperty bool AbstractAxis::lineVisible
76 \qmlproperty bool AbstractAxis::lineVisible
77 The visibility of the axis line
77 The visibility of the axis line
78 */
78 */
79
79
80 /*!
80 /*!
81 \property QAbstractAxis::linePen
81 \property QAbstractAxis::linePen
82 The pen of the line.
82 The pen of the line.
83 */
83 */
84
84
85 /*!
85 /*!
86 \property QAbstractAxis::labelsVisible
86 \property QAbstractAxis::labelsVisible
87 Defines if axis labels are visible.
87 Defines if axis labels are visible.
88 */
88 */
89 /*!
89 /*!
90 \qmlproperty bool AbstractAxis::labelsVisible
90 \qmlproperty bool AbstractAxis::labelsVisible
91 Defines if axis labels are visible.
91 Defines if axis labels are visible.
92 */
92 */
93
93
94 /*!
94 /*!
95 \property QAbstractAxis::labelsBrush
95 \property QAbstractAxis::labelsBrush
96 The brush of the labels. Only the color of the brush is relevant.
96 The brush of the labels. Only the color of the brush is relevant.
97 */
97 */
98
98
99 /*!
99 /*!
100 \property QAbstractAxis::visible
100 \property QAbstractAxis::visible
101 The visibility of the axis.
101 The visibility of the axis.
102 */
102 */
103 /*!
103 /*!
104 \qmlproperty bool AbstractAxis::visible
104 \qmlproperty bool AbstractAxis::visible
105 The visibility of the axis.
105 The visibility of the axis.
106 */
106 */
107
107
108 /*!
108 /*!
109 \property QAbstractAxis::gridVisible
109 \property QAbstractAxis::gridVisible
110 The visibility of the grid lines.
110 The visibility of the grid lines.
111 */
111 */
112 /*!
112 /*!
113 \qmlproperty bool AbstractAxis::gridVisible
113 \qmlproperty bool AbstractAxis::gridVisible
114 The visibility of the grid lines.
114 The visibility of the grid lines.
115 */
115 */
116
116
117 /*!
117 /*!
118 \property QAbstractAxis::color
118 \property QAbstractAxis::color
119 The color of the axis and ticks.
119 The color of the axis and ticks.
120 */
120 */
121 /*!
121 /*!
122 \qmlproperty color AbstractAxis::color
122 \qmlproperty color AbstractAxis::color
123 The color of the axis and ticks.
123 The color of the axis and ticks.
124 */
124 */
125
125
126 /*!
126 /*!
127 \property QAbstractAxis::gridLinePen
127 \property QAbstractAxis::gridLinePen
128 The pen of the grid line.
128 The pen of the grid line.
129 */
129 */
130
130
131 /*!
131 /*!
132 \property QAbstractAxis::labelsFont
132 \property QAbstractAxis::labelsFont
133 The font of the axis labels.
133 The font of the axis labels.
134 */
134 */
135
135
136 /*!
136 /*!
137 \qmlproperty Font AbstractAxis::labelsFont
137 \qmlproperty Font AbstractAxis::labelsFont
138 The font of the axis labels.
138 The font of the axis labels.
139
139
140 See the Qt documentation for more details of Font.
140 See the Qt documentation for more details of Font.
141 */
141 */
142
142
143 /*!
143 /*!
144 \property QAbstractAxis::labelsColor
144 \property QAbstractAxis::labelsColor
145 The color of the axis labels.
145 The color of the axis labels.
146 */
146 */
147 /*!
147 /*!
148 \qmlproperty color AbstractAxis::labelsColor
148 \qmlproperty color AbstractAxis::labelsColor
149 The color of the axis labels.
149 The color of the axis labels.
150 */
150 */
151
151
152 /*!
152 /*!
153 \property QAbstractAxis::labelsAngle
153 \property QAbstractAxis::labelsAngle
154 The angle of the axis labels in degrees.
154 The angle of the axis labels in degrees.
155 */
155 */
156 /*!
156 /*!
157 \qmlproperty int AbstractAxis::labelsAngle
157 \qmlproperty int AbstractAxis::labelsAngle
158 The angle of the axis labels in degrees.
158 The angle of the axis labels in degrees.
159 */
159 */
160
160
161 /*!
161 /*!
162 \property QAbstractAxis::shadesVisible
162 \property QAbstractAxis::shadesVisible
163 The visibility of the axis shades.
163 The visibility of the axis shades.
164 */
164 */
165 /*!
165 /*!
166 \qmlproperty bool AbstractAxis::shadesVisible
166 \qmlproperty bool AbstractAxis::shadesVisible
167 The visibility of the axis shades.
167 The visibility of the axis shades.
168 */
168 */
169
169
170 /*!
170 /*!
171 \property QAbstractAxis::shadesColor
171 \property QAbstractAxis::shadesColor
172 The fill (brush) color of the axis shades.
172 The fill (brush) color of the axis shades.
173 */
173 */
174 /*!
174 /*!
175 \qmlproperty color AbstractAxis::shadesColor
175 \qmlproperty color AbstractAxis::shadesColor
176 The fill (brush) color of the axis shades.
176 The fill (brush) color of the axis shades.
177 */
177 */
178
178
179 /*!
179 /*!
180 \property QAbstractAxis::shadesBorderColor
180 \property QAbstractAxis::shadesBorderColor
181 The border (pen) color of the axis shades.
181 The border (pen) color of the axis shades.
182 */
182 */
183 /*!
183 /*!
184 \qmlproperty color AbstractAxis::shadesBorderColor
184 \qmlproperty color AbstractAxis::shadesBorderColor
185 The border (pen) color of the axis shades.
185 The border (pen) color of the axis shades.
186 */
186 */
187
187
188 /*!
188 /*!
189 \property QAbstractAxis::shadesPen
189 \property QAbstractAxis::shadesPen
190 The pen of the axis shades (area between grid lines).
190 The pen of the axis shades (area between grid lines).
191 */
191 */
192
192
193 /*!
193 /*!
194 \property QAbstractAxis::shadesBrush
194 \property QAbstractAxis::shadesBrush
195 The brush of the axis shades (area between grid lines).
195 The brush of the axis shades (area between grid lines).
196 */
196 */
197
197
198 /*!
198 /*!
199 \property QAbstractAxis::titleVisible
199 \property QAbstractAxis::titleVisible
200 The visibility of the axis title. By default the value is true.
200 The visibility of the axis title. By default the value is true.
201 */
201 */
202 /*!
202 /*!
203 \qmlproperty bool AbstractAxis::titleVisible
203 \qmlproperty bool AbstractAxis::titleVisible
204 The visibility of the axis title. By default the value is true.
204 The visibility of the axis title. By default the value is true.
205 */
205 */
206
206
207 /*!
207 /*!
208 \property QAbstractAxis::titleText
208 \property QAbstractAxis::titleText
209 The title of the axis. Empty by default. Axis titles support html formatting.
209 The title of the axis. Empty by default. Axis titles support html formatting.
210 */
210 */
211 /*!
211 /*!
212 \qmlproperty String AbstractAxis::titleText
212 \qmlproperty String AbstractAxis::titleText
213 The title of the axis. Empty by default. Axis titles support html formatting.
213 The title of the axis. Empty by default. Axis titles support html formatting.
214 */
214 */
215
215
216 /*!
216 /*!
217 \property QAbstractAxis::titleBrush
217 \property QAbstractAxis::titleBrush
218 The brush of the title text. Only the color of the brush is relevant.
218 The brush of the title text. Only the color of the brush is relevant.
219 */
219 */
220
220
221 /*!
221 /*!
222 \property QAbstractAxis::titleFont
222 \property QAbstractAxis::titleFont
223 The font of the title of the axis.
223 The font of the title of the axis.
224 */
224 */
225 /*!
225 /*!
226 \qmlproperty Font AbstractAxis::titleFont
226 \qmlproperty Font AbstractAxis::titleFont
227 The font of the title of the axis.
227 The font of the title of the axis.
228 */
228 */
229
229
230 /*!
230 /*!
231 \property QAbstractAxis::orientation
231 \property QAbstractAxis::orientation
232 The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart.
232 The orientation of the axis. Fixed to either Qt::Horizontal or Qt::Vertical when you add the axis to a chart.
233 */
233 */
234 /*!
234 /*!
235 \qmlproperty Qt.Orientation AbstractAxis::orientation
235 \qmlproperty Qt.Orientation AbstractAxis::orientation
236 The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series.
236 The orientation of the axis. Fixed to either Qt.Horizontal or Qt.Vertical when the axis is set to a series.
237 */
237 */
238
238
239 /*!
239 /*!
240 \property QAbstractAxis::alignment
240 \property QAbstractAxis::alignment
241 The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop.
241 The alignment of the axis. Can be Qt::AlignLeft, Qt::AlignRight, Qt::AlignBottom, or Qt::AlignTop.
242 */
242 */
243 /*!
243 /*!
244 \qmlproperty alignment AbstractAxis::alignment
244 \qmlproperty alignment AbstractAxis::alignment
245 The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop.
245 The alignment of the axis. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop.
246 */
246 */
247
247
248 /*!
248 /*!
249 \property QAbstractAxis::reverse
250 The reverse property defines if reverse axis is used. By default the value is false.
251
252 Reverse axis is supported with line, spline, scatter and area series with cartesian chart.
253 All axes of the same orientation attached to same series must be reversed if one is reversed or
254 the behavior is undefined.
255 */
256 /*!
257 \qmlproperty alignment AbstractAxis::reverse
258 The reverse property defines if reverse axis is used. By default the value is false.
259
260 Reverse axis is supported with line, spline, scatter and area series with cartesian chart.
261 All axes of the same orientation attached to same series must be reversed if one is reversed or
262 the behavior is undefined.
263 */
264
265 /*!
249 \fn void QAbstractAxis::visibleChanged(bool visible)
266 \fn void QAbstractAxis::visibleChanged(bool visible)
250 Visibility of the axis has changed to \a visible.
267 Visibility of the axis has changed to \a visible.
251 */
268 */
252 /*!
269 /*!
253 \qmlsignal AbstractAxis::onVisibleChanged(bool visible)
270 \qmlsignal AbstractAxis::onVisibleChanged(bool visible)
254 Visibility of the axis has changed to \a visible.
271 Visibility of the axis has changed to \a visible.
255 */
272 */
256
273
257 /*!
274 /*!
258 \fn void QAbstractAxis::linePenChanged(const QPen& pen)
275 \fn void QAbstractAxis::linePenChanged(const QPen& pen)
259 The pen of the line of the axis has changed to \a pen.
276 The pen of the line of the axis has changed to \a pen.
260 */
277 */
261
278
262 /*!
279 /*!
263 \fn void QAbstractAxis::lineVisibleChanged(bool visible)
280 \fn void QAbstractAxis::lineVisibleChanged(bool visible)
264 Visibility of the axis line has changed to \a visible.
281 Visibility of the axis line has changed to \a visible.
265 */
282 */
266 /*!
283 /*!
267 \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible)
284 \qmlsignal AbstractAxis::onLineVisibleChanged(bool visible)
268 Visibility of the axis line has changed to \a visible.
285 Visibility of the axis line has changed to \a visible.
269 */
286 */
270
287
271 /*!
288 /*!
272 \fn void QAbstractAxis::labelsVisibleChanged(bool visible)
289 \fn void QAbstractAxis::labelsVisibleChanged(bool visible)
273 Visibility of the labels of the axis has changed to \a visible.
290 Visibility of the labels of the axis has changed to \a visible.
274 */
291 */
275 /*!
292 /*!
276 \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible)
293 \qmlsignal AbstractAxis::onLabelsVisibleChanged(bool visible)
277 Visibility of the labels of the axis has changed to \a visible.
294 Visibility of the labels of the axis has changed to \a visible.
278 */
295 */
279
296
280 /*!
297 /*!
281 \fn void QAbstractAxis::labelsFontChanged(const QFont& font)
298 \fn void QAbstractAxis::labelsFontChanged(const QFont& font)
282 The font of the axis labels has changed to \a font.
299 The font of the axis labels has changed to \a font.
283 */
300 */
284 /*!
301 /*!
285 \qmlsignal AbstractAxis::onLabelsFontChanged(Font font)
302 \qmlsignal AbstractAxis::onLabelsFontChanged(Font font)
286 The font of the axis labels has changed to \a font.
303 The font of the axis labels has changed to \a font.
287 */
304 */
288
305
289 /*!
306 /*!
290 \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush)
307 \fn void QAbstractAxis::labelsBrushChanged(const QBrush& brush)
291 The brush of the axis labels has changed to \a brush.
308 The brush of the axis labels has changed to \a brush.
292 */
309 */
293
310
294 /*!
311 /*!
295 \fn void QAbstractAxis::labelsAngleChanged(int angle)
312 \fn void QAbstractAxis::labelsAngleChanged(int angle)
296 The angle of the axis labels has changed to \a angle.
313 The angle of the axis labels has changed to \a angle.
297 */
314 */
298 /*!
315 /*!
299 \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle)
316 \qmlsignal AbstractAxis::onLabelsAngleChanged(int angle)
300 The angle of the axis labels has changed to \a angle.
317 The angle of the axis labels has changed to \a angle.
301 */
318 */
302
319
303 /*!
320 /*!
304 \fn void QAbstractAxis::gridVisibleChanged(bool visible)
321 \fn void QAbstractAxis::gridVisibleChanged(bool visible)
305 Visibility of the grid lines of the axis has changed to \a visible.
322 Visibility of the grid lines of the axis has changed to \a visible.
306 */
323 */
307 /*!
324 /*!
308 \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible)
325 \qmlsignal AbstractAxis::onGridVisibleChanged(bool visible)
309 Visibility of the grid lines of the axis has changed to \a visible.
326 Visibility of the grid lines of the axis has changed to \a visible.
310 */
327 */
311
328
312 /*!
329 /*!
313 \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen)
330 \fn void QAbstractAxis::gridLinePenChanged(const QPen& pen)
314 The pen of the grid line has changed to \a pen.
331 The pen of the grid line has changed to \a pen.
315 */
332 */
316
333
317 /*!
334 /*!
318 \fn void QAbstractAxis::colorChanged(QColor color)
335 \fn void QAbstractAxis::colorChanged(QColor color)
319 Emitted if the \a color of the axis is changed.
336 Emitted if the \a color of the axis is changed.
320 */
337 */
321 /*!
338 /*!
322 \qmlsignal AbstractAxis::onColorChanged(QColor color)
339 \qmlsignal AbstractAxis::onColorChanged(QColor color)
323 Emitted if the \a color of the axis is changed.
340 Emitted if the \a color of the axis is changed.
324 */
341 */
325
342
326 /*!
343 /*!
327 \fn void QAbstractAxis::labelsColorChanged(QColor color)
344 \fn void QAbstractAxis::labelsColorChanged(QColor color)
328 Emitted if the \a color of the axis labels is changed.
345 Emitted if the \a color of the axis labels is changed.
329 */
346 */
330 /*!
347 /*!
331 \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color)
348 \qmlsignal AbstractAxis::onLabelsColorChanged(QColor color)
332 Emitted if the \a color of the axis labels is changed.
349 Emitted if the \a color of the axis labels is changed.
333 */
350 */
334
351
335 /*!
352 /*!
336 \fn void QAbstractAxis::titleVisibleChanged(bool visible)
353 \fn void QAbstractAxis::titleVisibleChanged(bool visible)
337 Visibility of the title text of the axis has changed to \a visible.
354 Visibility of the title text of the axis has changed to \a visible.
338 */
355 */
339 /*!
356 /*!
340 \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible)
357 \qmlsignal AbstractAxis::onTitleVisibleChanged(bool visible)
341 Visibility of the title text of the axis has changed to \a visible.
358 Visibility of the title text of the axis has changed to \a visible.
342 */
359 */
343
360
344 /*!
361 /*!
345 \fn void QAbstractAxis::titleTextChanged(const QString& text)
362 \fn void QAbstractAxis::titleTextChanged(const QString& text)
346 The text of the axis title has changed to \a text.
363 The text of the axis title has changed to \a text.
347 */
364 */
348 /*!
365 /*!
349 \qmlsignal AbstractAxis::onTitleTextChanged(String text)
366 \qmlsignal AbstractAxis::onTitleTextChanged(String text)
350 The text of the axis title has changed to \a text.
367 The text of the axis title has changed to \a text.
351 */
368 */
352
369
353 /*!
370 /*!
354 \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush)
371 \fn void QAbstractAxis::titleBrushChanged(const QBrush& brush)
355 The brush of the axis title has changed to \a brush.
372 The brush of the axis title has changed to \a brush.
356 */
373 */
357
374
358 /*!
375 /*!
359 \fn void QAbstractAxis::titleFontChanged(const QFont& font)
376 \fn void QAbstractAxis::titleFontChanged(const QFont& font)
360 The font of the axis title has changed to \a font.
377 The font of the axis title has changed to \a font.
361 */
378 */
362 /*!
379 /*!
363 \qmlsignal AbstractAxis::onTitleFontChanged(Font font)
380 \qmlsignal AbstractAxis::onTitleFontChanged(Font font)
364 The font of the axis title has changed to \a font.
381 The font of the axis title has changed to \a font.
365 */
382 */
366
383
367 /*!
384 /*!
368 \fn void QAbstractAxis::shadesVisibleChanged(bool)
385 \fn void QAbstractAxis::shadesVisibleChanged(bool)
369 Emitted if the visibility of the axis shades is changed to \a visible.
386 Emitted if the visibility of the axis shades is changed to \a visible.
370 */
387 */
371 /*!
388 /*!
372 \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible)
389 \qmlsignal AbstractAxis::onShadesVisibleChanged(bool visible)
373 Emitted if the visibility of the axis shades is changed to \a visible.
390 Emitted if the visibility of the axis shades is changed to \a visible.
374 */
391 */
375
392
376 /*!
393 /*!
377 \fn void QAbstractAxis::shadesColorChanged(QColor color)
394 \fn void QAbstractAxis::shadesColorChanged(QColor color)
378 Emitted if the \a color of the axis shades is changed.
395 Emitted if the \a color of the axis shades is changed.
379 */
396 */
380 /*!
397 /*!
381 \qmlsignal AbstractAxis::onShadesColorChanged(QColor color)
398 \qmlsignal AbstractAxis::onShadesColorChanged(QColor color)
382 Emitted if the \a color of the axis shades is changed.
399 Emitted if the \a color of the axis shades is changed.
383 */
400 */
384
401
385 /*!
402 /*!
386 \fn void QAbstractAxis::shadesBorderColorChanged(QColor)
403 \fn void QAbstractAxis::shadesBorderColorChanged(QColor)
387 Emitted if the border \a color of the axis shades is changed.
404 Emitted if the border \a color of the axis shades is changed.
388 */
405 */
389 /*!
406 /*!
390 \qmlsignal AbstractAxis::onBorderColorChanged(QColor color)
407 \qmlsignal AbstractAxis::onBorderColorChanged(QColor color)
391 Emitted if the border \a color of the axis shades is changed.
408 Emitted if the border \a color of the axis shades is changed.
392 */
409 */
393
410
394 /*!
411 /*!
395 \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush)
412 \fn void QAbstractAxis::shadesBrushChanged(const QBrush& brush)
396 The brush of the axis shades has changed to \a brush.
413 The brush of the axis shades has changed to \a brush.
397 */
414 */
398
415
399 /*!
416 /*!
400 \fn void QAbstractAxis::shadesPenChanged(const QPen& pen)
417 \fn void QAbstractAxis::shadesPenChanged(const QPen& pen)
401 The pen of the axis shades has changed to \a pen.
418 The pen of the axis shades has changed to \a pen.
402 */
419 */
403
420
404 /*!
421 /*!
405 \internal
422 \internal
406 Constructs new axis object which is a child of \a parent. Ownership is taken by
423 Constructs new axis object which is a child of \a parent. Ownership is taken by
407 QChart when axis added.
424 QChart when axis added.
408 */
425 */
409
426
410 QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent)
427 QAbstractAxis::QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent)
411 : QObject(parent),
428 : QObject(parent),
412 d_ptr(&d)
429 d_ptr(&d)
413 {
430 {
414 }
431 }
415
432
416 /*!
433 /*!
417 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
434 Destructor of the axis object. When axis is added to chart, chart object takes ownership.
418 */
435 */
419
436
420 QAbstractAxis::~QAbstractAxis()
437 QAbstractAxis::~QAbstractAxis()
421 {
438 {
422 if (d_ptr->m_chart)
439 if (d_ptr->m_chart)
423 qFatal("Still binded axis detected !");
440 qFatal("Still binded axis detected !");
424 }
441 }
425
442
426 /*!
443 /*!
427 Sets \a pen used to draw axis line and ticks.
444 Sets \a pen used to draw axis line and ticks.
428 */
445 */
429 void QAbstractAxis::setLinePen(const QPen &pen)
446 void QAbstractAxis::setLinePen(const QPen &pen)
430 {
447 {
431 if (d_ptr->m_axisPen != pen) {
448 if (d_ptr->m_axisPen != pen) {
432 d_ptr->m_axisPen = pen;
449 d_ptr->m_axisPen = pen;
433 emit linePenChanged(pen);
450 emit linePenChanged(pen);
434 }
451 }
435 }
452 }
436
453
437 /*!
454 /*!
438 Returns pen used to draw axis and ticks.
455 Returns pen used to draw axis and ticks.
439 */
456 */
440 QPen QAbstractAxis::linePen() const
457 QPen QAbstractAxis::linePen() const
441 {
458 {
442 if (d_ptr->m_axisPen == QChartPrivate::defaultPen())
459 if (d_ptr->m_axisPen == QChartPrivate::defaultPen())
443 return QPen();
460 return QPen();
444 else
461 else
445 return d_ptr->m_axisPen;
462 return d_ptr->m_axisPen;
446 }
463 }
447
464
448 void QAbstractAxis::setLinePenColor(QColor color)
465 void QAbstractAxis::setLinePenColor(QColor color)
449 {
466 {
450 QPen p = d_ptr->m_axisPen;
467 QPen p = d_ptr->m_axisPen;
451 if (p.color() != color) {
468 if (p.color() != color) {
452 p.setColor(color);
469 p.setColor(color);
453 setLinePen(p);
470 setLinePen(p);
454 emit colorChanged(color);
471 emit colorChanged(color);
455 }
472 }
456 }
473 }
457
474
458 QColor QAbstractAxis::linePenColor() const
475 QColor QAbstractAxis::linePenColor() const
459 {
476 {
460 return linePen().color();
477 return linePen().color();
461 }
478 }
462
479
463 /*!
480 /*!
464 Sets if axis and ticks are \a visible.
481 Sets if axis and ticks are \a visible.
465 */
482 */
466 void QAbstractAxis::setLineVisible(bool visible)
483 void QAbstractAxis::setLineVisible(bool visible)
467 {
484 {
468 if (d_ptr->m_arrowVisible != visible) {
485 if (d_ptr->m_arrowVisible != visible) {
469 d_ptr->m_arrowVisible = visible;
486 d_ptr->m_arrowVisible = visible;
470 emit lineVisibleChanged(visible);
487 emit lineVisibleChanged(visible);
471 }
488 }
472 }
489 }
473
490
474 bool QAbstractAxis::isLineVisible() const
491 bool QAbstractAxis::isLineVisible() const
475 {
492 {
476 return d_ptr->m_arrowVisible;
493 return d_ptr->m_arrowVisible;
477 }
494 }
478
495
479 void QAbstractAxis::setGridLineVisible(bool visible)
496 void QAbstractAxis::setGridLineVisible(bool visible)
480 {
497 {
481 if (d_ptr->m_gridLineVisible != visible) {
498 if (d_ptr->m_gridLineVisible != visible) {
482 d_ptr->m_gridLineVisible = visible;
499 d_ptr->m_gridLineVisible = visible;
483 emit gridVisibleChanged(visible);
500 emit gridVisibleChanged(visible);
484 }
501 }
485 }
502 }
486
503
487 bool QAbstractAxis::isGridLineVisible() const
504 bool QAbstractAxis::isGridLineVisible() const
488 {
505 {
489 return d_ptr->m_gridLineVisible;
506 return d_ptr->m_gridLineVisible;
490 }
507 }
491
508
492 /*!
509 /*!
493 Sets \a pen used to draw grid line.
510 Sets \a pen used to draw grid line.
494 */
511 */
495 void QAbstractAxis::setGridLinePen(const QPen &pen)
512 void QAbstractAxis::setGridLinePen(const QPen &pen)
496 {
513 {
497 if (d_ptr->m_gridLinePen != pen) {
514 if (d_ptr->m_gridLinePen != pen) {
498 d_ptr->m_gridLinePen = pen;
515 d_ptr->m_gridLinePen = pen;
499 emit gridLinePenChanged(pen);
516 emit gridLinePenChanged(pen);
500 }
517 }
501 }
518 }
502
519
503 /*!
520 /*!
504 Returns pen used to draw grid.
521 Returns pen used to draw grid.
505 */
522 */
506 QPen QAbstractAxis::gridLinePen() const
523 QPen QAbstractAxis::gridLinePen() const
507 {
524 {
508 if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen())
525 if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen())
509 return QPen();
526 return QPen();
510 else
527 else
511 return d_ptr->m_gridLinePen;
528 return d_ptr->m_gridLinePen;
512 }
529 }
513
530
514 void QAbstractAxis::setLabelsVisible(bool visible)
531 void QAbstractAxis::setLabelsVisible(bool visible)
515 {
532 {
516 if (d_ptr->m_labelsVisible != visible) {
533 if (d_ptr->m_labelsVisible != visible) {
517 d_ptr->m_labelsVisible = visible;
534 d_ptr->m_labelsVisible = visible;
518 emit labelsVisibleChanged(visible);
535 emit labelsVisibleChanged(visible);
519 }
536 }
520 }
537 }
521
538
522 bool QAbstractAxis::labelsVisible() const
539 bool QAbstractAxis::labelsVisible() const
523 {
540 {
524 return d_ptr->m_labelsVisible;
541 return d_ptr->m_labelsVisible;
525 }
542 }
526
543
527 /*!
544 /*!
528 Sets \a brush used to draw labels.
545 Sets \a brush used to draw labels.
529 */
546 */
530 void QAbstractAxis::setLabelsBrush(const QBrush &brush)
547 void QAbstractAxis::setLabelsBrush(const QBrush &brush)
531 {
548 {
532 if (d_ptr->m_labelsBrush != brush) {
549 if (d_ptr->m_labelsBrush != brush) {
533 d_ptr->m_labelsBrush = brush;
550 d_ptr->m_labelsBrush = brush;
534 emit labelsBrushChanged(brush);
551 emit labelsBrushChanged(brush);
535 }
552 }
536 }
553 }
537
554
538 /*!
555 /*!
539 Returns brush used to draw labels.
556 Returns brush used to draw labels.
540 */
557 */
541 QBrush QAbstractAxis::labelsBrush() const
558 QBrush QAbstractAxis::labelsBrush() const
542 {
559 {
543 if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush())
560 if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush())
544 return QBrush();
561 return QBrush();
545 else
562 else
546 return d_ptr->m_labelsBrush;
563 return d_ptr->m_labelsBrush;
547 }
564 }
548
565
549 /*!
566 /*!
550 Sets \a font used to draw labels.
567 Sets \a font used to draw labels.
551 */
568 */
552 void QAbstractAxis::setLabelsFont(const QFont &font)
569 void QAbstractAxis::setLabelsFont(const QFont &font)
553 {
570 {
554 if (d_ptr->m_labelsFont != font) {
571 if (d_ptr->m_labelsFont != font) {
555 d_ptr->m_labelsFont = font;
572 d_ptr->m_labelsFont = font;
556 emit labelsFontChanged(font);
573 emit labelsFontChanged(font);
557 }
574 }
558 }
575 }
559
576
560 /*!
577 /*!
561 Returns font used to draw labels.
578 Returns font used to draw labels.
562 */
579 */
563 QFont QAbstractAxis::labelsFont() const
580 QFont QAbstractAxis::labelsFont() const
564 {
581 {
565 if (d_ptr->m_labelsFont == QChartPrivate::defaultFont())
582 if (d_ptr->m_labelsFont == QChartPrivate::defaultFont())
566 return QFont();
583 return QFont();
567 else
584 else
568 return d_ptr->m_labelsFont;
585 return d_ptr->m_labelsFont;
569 }
586 }
570
587
571 void QAbstractAxis::setLabelsAngle(int angle)
588 void QAbstractAxis::setLabelsAngle(int angle)
572 {
589 {
573 if (d_ptr->m_labelsAngle != angle) {
590 if (d_ptr->m_labelsAngle != angle) {
574 d_ptr->m_labelsAngle = angle;
591 d_ptr->m_labelsAngle = angle;
575 emit labelsAngleChanged(angle);
592 emit labelsAngleChanged(angle);
576 }
593 }
577 }
594 }
578
595
579 int QAbstractAxis::labelsAngle() const
596 int QAbstractAxis::labelsAngle() const
580 {
597 {
581 return d_ptr->m_labelsAngle;
598 return d_ptr->m_labelsAngle;
582 }
599 }
583 void QAbstractAxis::setLabelsColor(QColor color)
600 void QAbstractAxis::setLabelsColor(QColor color)
584 {
601 {
585 QBrush b = d_ptr->m_labelsBrush;
602 QBrush b = d_ptr->m_labelsBrush;
586 if (b.color() != color) {
603 if (b.color() != color) {
587 b.setColor(color);
604 b.setColor(color);
588 setLabelsBrush(b);
605 setLabelsBrush(b);
589 emit labelsColorChanged(color);
606 emit labelsColorChanged(color);
590 }
607 }
591 }
608 }
592
609
593 QColor QAbstractAxis::labelsColor() const
610 QColor QAbstractAxis::labelsColor() const
594 {
611 {
595 return labelsBrush().color();
612 return labelsBrush().color();
596 }
613 }
597
614
598 void QAbstractAxis::setTitleVisible(bool visible)
615 void QAbstractAxis::setTitleVisible(bool visible)
599 {
616 {
600 if (d_ptr->m_titleVisible != visible) {
617 if (d_ptr->m_titleVisible != visible) {
601 d_ptr->m_titleVisible = visible;
618 d_ptr->m_titleVisible = visible;
602 emit titleVisibleChanged(visible);
619 emit titleVisibleChanged(visible);
603 }
620 }
604 }
621 }
605
622
606 bool QAbstractAxis::isTitleVisible() const
623 bool QAbstractAxis::isTitleVisible() const
607 {
624 {
608 return d_ptr->m_titleVisible;
625 return d_ptr->m_titleVisible;
609 }
626 }
610
627
611 /*!
628 /*!
612 Sets \a brush used to draw title.
629 Sets \a brush used to draw title.
613 */
630 */
614 void QAbstractAxis::setTitleBrush(const QBrush &brush)
631 void QAbstractAxis::setTitleBrush(const QBrush &brush)
615 {
632 {
616 if (d_ptr->m_titleBrush != brush) {
633 if (d_ptr->m_titleBrush != brush) {
617 d_ptr->m_titleBrush = brush;
634 d_ptr->m_titleBrush = brush;
618 emit titleBrushChanged(brush);
635 emit titleBrushChanged(brush);
619 }
636 }
620 }
637 }
621
638
622 /*!
639 /*!
623 Returns brush used to draw title.
640 Returns brush used to draw title.
624 */
641 */
625 QBrush QAbstractAxis::titleBrush() const
642 QBrush QAbstractAxis::titleBrush() const
626 {
643 {
627 if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush())
644 if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush())
628 return QBrush();
645 return QBrush();
629 else
646 else
630 return d_ptr->m_titleBrush;
647 return d_ptr->m_titleBrush;
631 }
648 }
632
649
633 /*!
650 /*!
634 Sets \a font used to draw title.
651 Sets \a font used to draw title.
635 */
652 */
636 void QAbstractAxis::setTitleFont(const QFont &font)
653 void QAbstractAxis::setTitleFont(const QFont &font)
637 {
654 {
638 if (d_ptr->m_titleFont != font) {
655 if (d_ptr->m_titleFont != font) {
639 d_ptr->m_titleFont = font;
656 d_ptr->m_titleFont = font;
640 emit titleFontChanged(font);
657 emit titleFontChanged(font);
641 }
658 }
642 }
659 }
643
660
644 /*!
661 /*!
645 Returns font used to draw title.
662 Returns font used to draw title.
646 */
663 */
647 QFont QAbstractAxis::titleFont() const
664 QFont QAbstractAxis::titleFont() const
648 {
665 {
649 if (d_ptr->m_titleFont == QChartPrivate::defaultFont())
666 if (d_ptr->m_titleFont == QChartPrivate::defaultFont())
650 return QFont();
667 return QFont();
651 else
668 else
652 return d_ptr->m_titleFont;
669 return d_ptr->m_titleFont;
653 }
670 }
654
671
655 void QAbstractAxis::setTitleText(const QString &title)
672 void QAbstractAxis::setTitleText(const QString &title)
656 {
673 {
657 if (d_ptr->m_title != title) {
674 if (d_ptr->m_title != title) {
658 d_ptr->m_title = title;
675 d_ptr->m_title = title;
659 emit titleTextChanged(title);
676 emit titleTextChanged(title);
660 }
677 }
661 }
678 }
662
679
663 QString QAbstractAxis::titleText() const
680 QString QAbstractAxis::titleText() const
664 {
681 {
665 return d_ptr->m_title;
682 return d_ptr->m_title;
666 }
683 }
667
684
668
685
669 void QAbstractAxis::setShadesVisible(bool visible)
686 void QAbstractAxis::setShadesVisible(bool visible)
670 {
687 {
671 if (d_ptr->m_shadesVisible != visible) {
688 if (d_ptr->m_shadesVisible != visible) {
672 d_ptr->m_shadesVisible = visible;
689 d_ptr->m_shadesVisible = visible;
673 emit shadesVisibleChanged(visible);
690 emit shadesVisibleChanged(visible);
674 }
691 }
675 }
692 }
676
693
677 bool QAbstractAxis::shadesVisible() const
694 bool QAbstractAxis::shadesVisible() const
678 {
695 {
679 return d_ptr->m_shadesVisible;
696 return d_ptr->m_shadesVisible;
680 }
697 }
681
698
682 /*!
699 /*!
683 Sets \a pen used to draw shades.
700 Sets \a pen used to draw shades.
684 */
701 */
685 void QAbstractAxis::setShadesPen(const QPen &pen)
702 void QAbstractAxis::setShadesPen(const QPen &pen)
686 {
703 {
687 if (d_ptr->m_shadesPen != pen) {
704 if (d_ptr->m_shadesPen != pen) {
688 d_ptr->m_shadesPen = pen;
705 d_ptr->m_shadesPen = pen;
689 emit shadesPenChanged(pen);
706 emit shadesPenChanged(pen);
690 }
707 }
691 }
708 }
692
709
693 /*!
710 /*!
694 Returns pen used to draw shades.
711 Returns pen used to draw shades.
695 */
712 */
696 QPen QAbstractAxis::shadesPen() const
713 QPen QAbstractAxis::shadesPen() const
697 {
714 {
698 if (d_ptr->m_shadesPen == QChartPrivate::defaultPen())
715 if (d_ptr->m_shadesPen == QChartPrivate::defaultPen())
699 return QPen();
716 return QPen();
700 else
717 else
701 return d_ptr->m_shadesPen;
718 return d_ptr->m_shadesPen;
702 }
719 }
703
720
704 /*!
721 /*!
705 Sets \a brush used to draw shades.
722 Sets \a brush used to draw shades.
706 */
723 */
707 void QAbstractAxis::setShadesBrush(const QBrush &brush)
724 void QAbstractAxis::setShadesBrush(const QBrush &brush)
708 {
725 {
709 if (d_ptr->m_shadesBrush != brush) {
726 if (d_ptr->m_shadesBrush != brush) {
710 d_ptr->m_shadesBrush = brush;
727 d_ptr->m_shadesBrush = brush;
711 emit shadesBrushChanged(brush);
728 emit shadesBrushChanged(brush);
712 }
729 }
713 }
730 }
714
731
715 /*!
732 /*!
716 Returns brush used to draw shades.
733 Returns brush used to draw shades.
717 */
734 */
718 QBrush QAbstractAxis::shadesBrush() const
735 QBrush QAbstractAxis::shadesBrush() const
719 {
736 {
720 if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush())
737 if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush())
721 return QBrush(Qt::SolidPattern);
738 return QBrush(Qt::SolidPattern);
722 else
739 else
723 return d_ptr->m_shadesBrush;
740 return d_ptr->m_shadesBrush;
724 }
741 }
725
742
726 void QAbstractAxis::setShadesColor(QColor color)
743 void QAbstractAxis::setShadesColor(QColor color)
727 {
744 {
728 QBrush b = d_ptr->m_shadesBrush;
745 QBrush b = d_ptr->m_shadesBrush;
729 if (b.color() != color) {
746 if (b.color() != color) {
730 b.setColor(color);
747 b.setColor(color);
731 setShadesBrush(b);
748 setShadesBrush(b);
732 emit shadesColorChanged(color);
749 emit shadesColorChanged(color);
733 }
750 }
734 }
751 }
735
752
736 QColor QAbstractAxis::shadesColor() const
753 QColor QAbstractAxis::shadesColor() const
737 {
754 {
738 return shadesBrush().color();
755 return shadesBrush().color();
739 }
756 }
740
757
741 void QAbstractAxis::setShadesBorderColor(QColor color)
758 void QAbstractAxis::setShadesBorderColor(QColor color)
742 {
759 {
743 QPen p = d_ptr->m_shadesPen;
760 QPen p = d_ptr->m_shadesPen;
744 if (p.color() != color) {
761 if (p.color() != color) {
745 p.setColor(color);
762 p.setColor(color);
746 setShadesPen(p);
763 setShadesPen(p);
747 emit shadesColorChanged(color);
764 emit shadesColorChanged(color);
748 }
765 }
749 }
766 }
750
767
751 QColor QAbstractAxis::shadesBorderColor() const
768 QColor QAbstractAxis::shadesBorderColor() const
752 {
769 {
753 return shadesPen().color();
770 return shadesPen().color();
754 }
771 }
755
772
756
773
757 bool QAbstractAxis::isVisible() const
774 bool QAbstractAxis::isVisible() const
758 {
775 {
759 return d_ptr->m_visible;
776 return d_ptr->m_visible;
760 }
777 }
761
778
762 /*!
779 /*!
763 Sets axis, shades, labels and grid lines to be visible.
780 Sets axis, shades, labels and grid lines to be visible.
764 */
781 */
765 void QAbstractAxis::setVisible(bool visible)
782 void QAbstractAxis::setVisible(bool visible)
766 {
783 {
767 if (d_ptr->m_visible != visible) {
784 if (d_ptr->m_visible != visible) {
768 d_ptr->m_visible = visible;
785 d_ptr->m_visible = visible;
769 emit visibleChanged(visible);
786 emit visibleChanged(visible);
770 }
787 }
771 }
788 }
772
789
773
790
774 /*!
791 /*!
775 Sets axis, shades, labels and grid lines to be visible.
792 Sets axis, shades, labels and grid lines to be visible.
776 */
793 */
777 void QAbstractAxis::show()
794 void QAbstractAxis::show()
778 {
795 {
779 setVisible(true);
796 setVisible(true);
780 }
797 }
781
798
782 /*!
799 /*!
783 Sets axis, shades, labels and grid lines to not be visible.
800 Sets axis, shades, labels and grid lines to not be visible.
784 */
801 */
785 void QAbstractAxis::hide()
802 void QAbstractAxis::hide()
786 {
803 {
787 setVisible(false);
804 setVisible(false);
788 }
805 }
789
806
790 /*!
807 /*!
791 Sets the minimum value shown on the axis.
808 Sets the minimum value shown on the axis.
792 Depending on the actual axis type the \a min parameter is converted to appropriate type.
809 Depending on the actual axis type the \a min parameter is converted to appropriate type.
793 If the conversion is impossible then the function call does nothing
810 If the conversion is impossible then the function call does nothing
794 */
811 */
795 void QAbstractAxis::setMin(const QVariant &min)
812 void QAbstractAxis::setMin(const QVariant &min)
796 {
813 {
797 d_ptr->setMin(min);
814 d_ptr->setMin(min);
798 }
815 }
799
816
800 /*!
817 /*!
801 Sets the maximum value shown on the axis.
818 Sets the maximum value shown on the axis.
802 Depending on the actual axis type the \a max parameter is converted to appropriate type.
819 Depending on the actual axis type the \a max parameter is converted to appropriate type.
803 If the conversion is impossible then the function call does nothing
820 If the conversion is impossible then the function call does nothing
804 */
821 */
805 void QAbstractAxis::setMax(const QVariant &max)
822 void QAbstractAxis::setMax(const QVariant &max)
806 {
823 {
807 d_ptr->setMax(max);
824 d_ptr->setMax(max);
808 }
825 }
809
826
810 /*!
827 /*!
811 Sets the range shown on the axis.
828 Sets the range shown on the axis.
812 Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types.
829 Depending on the actual axis type the \a min and \a max parameters are converted to appropriate types.
813 If the conversion is impossible then the function call does nothing.
830 If the conversion is impossible then the function call does nothing.
814 */
831 */
815 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
832 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max)
816 {
833 {
817 d_ptr->setRange(min, max);
834 d_ptr->setRange(min, max);
818 }
835 }
819
836
820
837
821 /*!
838 /*!
822 Returns the orientation in which the axis is being used (Vertical or Horizontal)
839 Returns the orientation in which the axis is being used (Vertical or Horizontal)
823 */
840 */
824 Qt::Orientation QAbstractAxis::orientation() const
841 Qt::Orientation QAbstractAxis::orientation() const
825 {
842 {
826 return d_ptr->orientation();
843 return d_ptr->orientation();
827 }
844 }
828
845
829 Qt::Alignment QAbstractAxis::alignment() const
846 Qt::Alignment QAbstractAxis::alignment() const
830 {
847 {
831 return d_ptr->alignment();
848 return d_ptr->alignment();
832 }
849 }
833
850
851 bool QAbstractAxis::isReverse() const
852 {
853 return d_ptr->m_reverse;
854 }
855
856 void QAbstractAxis::setReverse(bool reverse)
857 {
858 if (d_ptr->m_reverse != reverse && type() != QAbstractAxis::AxisTypeBarCategory) {
859 d_ptr->m_reverse = reverse;
860 emit reverseChanged(reverse);
861 }
862 }
863
834 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
864 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
835
865
836 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
866 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
837 : q_ptr(q),
867 : q_ptr(q),
838 m_chart(0),
868 m_chart(0),
839 m_alignment(0),
869 m_alignment(0),
840 m_orientation(Qt::Orientation(0)),
870 m_orientation(Qt::Orientation(0)),
841 m_visible(true),
871 m_visible(true),
842 m_arrowVisible(true),
872 m_arrowVisible(true),
843 m_axisPen(QChartPrivate::defaultPen()),
873 m_axisPen(QChartPrivate::defaultPen()),
844 m_axisBrush(QChartPrivate::defaultBrush()),
874 m_axisBrush(QChartPrivate::defaultBrush()),
845 m_gridLineVisible(true),
875 m_gridLineVisible(true),
846 m_gridLinePen(QChartPrivate::defaultPen()),
876 m_gridLinePen(QChartPrivate::defaultPen()),
847 m_labelsVisible(true),
877 m_labelsVisible(true),
848 m_labelsBrush(QChartPrivate::defaultBrush()),
878 m_labelsBrush(QChartPrivate::defaultBrush()),
849 m_labelsFont(QChartPrivate::defaultFont()),
879 m_labelsFont(QChartPrivate::defaultFont()),
850 m_labelsAngle(0),
880 m_labelsAngle(0),
851 m_titleVisible(true),
881 m_titleVisible(true),
852 m_titleBrush(QChartPrivate::defaultBrush()),
882 m_titleBrush(QChartPrivate::defaultBrush()),
853 m_titleFont(QChartPrivate::defaultFont()),
883 m_titleFont(QChartPrivate::defaultFont()),
854 m_shadesVisible(false),
884 m_shadesVisible(false),
855 m_shadesPen(QChartPrivate::defaultPen()),
885 m_shadesPen(QChartPrivate::defaultPen()),
856 m_shadesBrush(QChartPrivate::defaultBrush()),
886 m_shadesBrush(QChartPrivate::defaultBrush()),
857 m_shadesOpacity(1.0),
887 m_shadesOpacity(1.0),
858 m_dirty(false)
888 m_dirty(false),
889 m_reverse(false)
859 {
890 {
860 }
891 }
861
892
862 QAbstractAxisPrivate::~QAbstractAxisPrivate()
893 QAbstractAxisPrivate::~QAbstractAxisPrivate()
863 {
894 {
864 }
895 }
865
896
866 void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment)
897 void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment)
867 {
898 {
868 switch(alignment) {
899 switch(alignment) {
869 case Qt::AlignTop:
900 case Qt::AlignTop:
870 case Qt::AlignBottom:
901 case Qt::AlignBottom:
871 m_orientation = Qt::Horizontal;
902 m_orientation = Qt::Horizontal;
872 break;
903 break;
873 case Qt::AlignLeft:
904 case Qt::AlignLeft:
874 case Qt::AlignRight:
905 case Qt::AlignRight:
875 m_orientation = Qt::Vertical;
906 m_orientation = Qt::Vertical;
876 break;
907 break;
877 default:
908 default:
878 qWarning()<<"No alignment specified !";
909 qWarning()<<"No alignment specified !";
879 break;
910 break;
880 };
911 };
881 m_alignment=alignment;
912 m_alignment=alignment;
882 }
913 }
883
914
884 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
915 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
885 {
916 {
886 if (forced || QChartPrivate::defaultPen() == m_axisPen)
917 if (forced || QChartPrivate::defaultPen() == m_axisPen)
887 q_ptr->setLinePen(theme->axisLinePen());
918 q_ptr->setLinePen(theme->axisLinePen());
888
919
889 if (forced || QChartPrivate::defaultPen() == m_gridLinePen)
920 if (forced || QChartPrivate::defaultPen() == m_gridLinePen)
890 q_ptr->setGridLinePen(theme->girdLinePen());
921 q_ptr->setGridLinePen(theme->girdLinePen());
891
922
892 if (forced || QChartPrivate::defaultBrush() == m_labelsBrush)
923 if (forced || QChartPrivate::defaultBrush() == m_labelsBrush)
893 q_ptr->setLabelsBrush(theme->labelBrush());
924 q_ptr->setLabelsBrush(theme->labelBrush());
894 if (forced || QChartPrivate::defaultFont() == m_labelsFont)
925 if (forced || QChartPrivate::defaultFont() == m_labelsFont)
895 q_ptr->setLabelsFont(theme->labelFont());
926 q_ptr->setLabelsFont(theme->labelFont());
896
927
897 if (forced || QChartPrivate::defaultBrush() == m_titleBrush)
928 if (forced || QChartPrivate::defaultBrush() == m_titleBrush)
898 q_ptr->setTitleBrush(theme->labelBrush());
929 q_ptr->setTitleBrush(theme->labelBrush());
899 if (forced || QChartPrivate::defaultFont() == m_titleFont) {
930 if (forced || QChartPrivate::defaultFont() == m_titleFont) {
900 QFont font(m_labelsFont);
931 QFont font(m_labelsFont);
901 font.setBold(true);
932 font.setBold(true);
902 q_ptr->setTitleFont(font);
933 q_ptr->setTitleFont(font);
903 }
934 }
904
935
905 if (forced || QChartPrivate::defaultBrush() == m_shadesBrush)
936 if (forced || QChartPrivate::defaultBrush() == m_shadesBrush)
906 q_ptr->setShadesBrush(theme->backgroundShadesBrush());
937 q_ptr->setShadesBrush(theme->backgroundShadesBrush());
907 if (forced || QChartPrivate::defaultPen() == m_shadesPen)
938 if (forced || QChartPrivate::defaultPen() == m_shadesPen)
908 q_ptr->setShadesPen(theme->backgroundShadesPen());
939 q_ptr->setShadesPen(theme->backgroundShadesPen());
909
940
910 bool axisX = m_orientation == Qt::Horizontal;
941 bool axisX = m_orientation == Qt::Horizontal;
911 if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
942 if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
912 || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
943 || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
913 || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
944 || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
914 q_ptr->setShadesVisible(true);
945 q_ptr->setShadesVisible(true);
915 } else if (forced) {
946 } else if (forced) {
916 q_ptr->setShadesVisible(false);
947 q_ptr->setShadesVisible(false);
917 }
948 }
918 }
949 }
919
950
920 void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max)
951 void QAbstractAxisPrivate::handleRangeChanged(qreal min, qreal max)
921 {
952 {
922 setRange(min,max);
953 setRange(min,max);
923 }
954 }
924
955
925 void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent)
956 void QAbstractAxisPrivate::initializeGraphics(QGraphicsItem* parent)
926 {
957 {
927 Q_UNUSED(parent);
958 Q_UNUSED(parent);
928 }
959 }
929
960
930 void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options)
961 void QAbstractAxisPrivate::initializeAnimations(QChart::AnimationOptions options)
931 {
962 {
932 ChartAxisElement *axis = m_item.data();
963 ChartAxisElement *axis = m_item.data();
933 Q_ASSERT(axis);
964 Q_ASSERT(axis);
934 if (axis->animation())
965 if (axis->animation())
935 axis->animation()->stopAndDestroyLater();
966 axis->animation()->stopAndDestroyLater();
936
967
937 if (options.testFlag(QChart::GridAxisAnimations))
968 if (options.testFlag(QChart::GridAxisAnimations))
938 axis->setAnimation(new AxisAnimation(axis));
969 axis->setAnimation(new AxisAnimation(axis));
939 else
970 else
940 axis->setAnimation(0);
971 axis->setAnimation(0);
941 }
972 }
942
973
943
974
944
975
945 #include "moc_qabstractaxis.cpp"
976 #include "moc_qabstractaxis.cpp"
946 #include "moc_qabstractaxis_p.cpp"
977 #include "moc_qabstractaxis_p.cpp"
947
978
948 QT_CHARTS_END_NAMESPACE
979 QT_CHARTS_END_NAMESPACE
@@ -1,185 +1,191
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #ifndef QABSTRACTAXIS_H
19 #ifndef QABSTRACTAXIS_H
20 #define QABSTRACTAXIS_H
20 #define QABSTRACTAXIS_H
21
21
22 #include <QtCharts/QChartGlobal>
22 #include <QtCharts/QChartGlobal>
23 #include <QtGui/QPen>
23 #include <QtGui/QPen>
24 #include <QtGui/QFont>
24 #include <QtGui/QFont>
25 #include <QtCore/QVariant>
25 #include <QtCore/QVariant>
26
26
27 QT_CHARTS_BEGIN_NAMESPACE
27 QT_CHARTS_BEGIN_NAMESPACE
28
28
29 class QAbstractAxisPrivate;
29 class QAbstractAxisPrivate;
30
30
31 class QT_CHARTS_EXPORT QAbstractAxis : public QObject
31 class QT_CHARTS_EXPORT QAbstractAxis : public QObject
32 {
32 {
33 Q_OBJECT
33 Q_OBJECT
34 //visibility
34 //visibility
35 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
35 Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
36 //arrow
36 //arrow
37 Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
37 Q_PROPERTY(bool lineVisible READ isLineVisible WRITE setLineVisible NOTIFY lineVisibleChanged)
38 Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged)
38 Q_PROPERTY(QPen linePen READ linePen WRITE setLinePen NOTIFY linePenChanged)
39 Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
39 Q_PROPERTY(QColor color READ linePenColor WRITE setLinePenColor NOTIFY colorChanged)
40 //labels
40 //labels
41 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
41 Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged)
42 Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged)
42 Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged)
43 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged)
43 Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged)
44 Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged)
44 Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged)
45 Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
45 Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged)
46 //grid
46 //grid
47 Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
47 Q_PROPERTY(bool gridVisible READ isGridLineVisible WRITE setGridLineVisible NOTIFY gridVisibleChanged)
48 Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged)
48 Q_PROPERTY(QPen gridLinePen READ gridLinePen WRITE setGridLinePen NOTIFY gridLinePenChanged)
49 //shades
49 //shades
50 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
50 Q_PROPERTY(bool shadesVisible READ shadesVisible WRITE setShadesVisible NOTIFY shadesVisibleChanged)
51 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
51 Q_PROPERTY(QColor shadesColor READ shadesColor WRITE setShadesColor NOTIFY shadesColorChanged)
52 Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
52 Q_PROPERTY(QColor shadesBorderColor READ shadesBorderColor WRITE setShadesBorderColor NOTIFY shadesBorderColorChanged)
53 Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged)
53 Q_PROPERTY(QPen shadesPen READ shadesPen WRITE setShadesPen NOTIFY shadesPenChanged)
54 Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged)
54 Q_PROPERTY(QBrush shadesBrush READ shadesBrush WRITE setShadesBrush NOTIFY shadesBrushChanged)
55 //title
55 //title
56 Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged)
56 Q_PROPERTY(QString titleText READ titleText WRITE setTitleText NOTIFY titleTextChanged)
57 Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged)
57 Q_PROPERTY(QBrush titleBrush READ titleBrush WRITE setTitleBrush NOTIFY titleBrushChanged)
58 Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged)
58 Q_PROPERTY(bool titleVisible READ isTitleVisible WRITE setTitleVisible NOTIFY titleVisibleChanged)
59 Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged)
59 Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont NOTIFY titleFontChanged)
60 //orientation
60 //orientation
61 Q_PROPERTY(Qt::Orientation orientation READ orientation)
61 Q_PROPERTY(Qt::Orientation orientation READ orientation)
62 //aligment
62 //aligment
63 Q_PROPERTY(Qt::Alignment alignment READ alignment)
63 Q_PROPERTY(Qt::Alignment alignment READ alignment)
64 Q_PROPERTY(bool reverse READ isReverse WRITE setReverse NOTIFY reverseChanged)
64
65
65 public:
66 public:
66
67
67 enum AxisType {
68 enum AxisType {
68 AxisTypeNoAxis = 0x0,
69 AxisTypeNoAxis = 0x0,
69 AxisTypeValue = 0x1,
70 AxisTypeValue = 0x1,
70 AxisTypeBarCategory = 0x2,
71 AxisTypeBarCategory = 0x2,
71 AxisTypeCategory = 0x4,
72 AxisTypeCategory = 0x4,
72 AxisTypeDateTime = 0x8,
73 AxisTypeDateTime = 0x8,
73 AxisTypeLogValue = 0x10
74 AxisTypeLogValue = 0x10
74 };
75 };
75
76
76 Q_DECLARE_FLAGS(AxisTypes, AxisType)
77 Q_DECLARE_FLAGS(AxisTypes, AxisType)
77
78
78 protected:
79 protected:
79 explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0);
80 explicit QAbstractAxis(QAbstractAxisPrivate &d, QObject *parent = 0);
80
81
81 public:
82 public:
82 ~QAbstractAxis();
83 ~QAbstractAxis();
83
84
84 virtual AxisType type() const = 0;
85 virtual AxisType type() const = 0;
85
86
86 //visibility handling
87 //visibility handling
87 bool isVisible() const;
88 bool isVisible() const;
88 void setVisible(bool visible = true);
89 void setVisible(bool visible = true);
89 void show();
90 void show();
90 void hide();
91 void hide();
91
92
92 //arrow handling
93 //arrow handling
93 bool isLineVisible() const;
94 bool isLineVisible() const;
94 void setLineVisible(bool visible = true);
95 void setLineVisible(bool visible = true);
95 void setLinePen(const QPen &pen);
96 void setLinePen(const QPen &pen);
96 QPen linePen() const;
97 QPen linePen() const;
97 void setLinePenColor(QColor color);
98 void setLinePenColor(QColor color);
98 QColor linePenColor() const;
99 QColor linePenColor() const;
99
100
100 //grid handling
101 //grid handling
101 bool isGridLineVisible() const;
102 bool isGridLineVisible() const;
102 void setGridLineVisible(bool visible = true);
103 void setGridLineVisible(bool visible = true);
103 void setGridLinePen(const QPen &pen);
104 void setGridLinePen(const QPen &pen);
104 QPen gridLinePen() const;
105 QPen gridLinePen() const;
105
106
106 //labels handling
107 //labels handling
107 bool labelsVisible() const;
108 bool labelsVisible() const;
108 void setLabelsVisible(bool visible = true);
109 void setLabelsVisible(bool visible = true);
109 void setLabelsBrush(const QBrush &brush);
110 void setLabelsBrush(const QBrush &brush);
110 QBrush labelsBrush() const;
111 QBrush labelsBrush() const;
111 void setLabelsFont(const QFont &font);
112 void setLabelsFont(const QFont &font);
112 QFont labelsFont() const;
113 QFont labelsFont() const;
113 void setLabelsAngle(int angle);
114 void setLabelsAngle(int angle);
114 int labelsAngle() const;
115 int labelsAngle() const;
115 void setLabelsColor(QColor color);
116 void setLabelsColor(QColor color);
116 QColor labelsColor() const;
117 QColor labelsColor() const;
117
118
118 //title handling
119 //title handling
119 bool isTitleVisible() const;
120 bool isTitleVisible() const;
120 void setTitleVisible(bool visible = true);
121 void setTitleVisible(bool visible = true);
121 void setTitleBrush(const QBrush &brush);
122 void setTitleBrush(const QBrush &brush);
122 QBrush titleBrush() const;
123 QBrush titleBrush() const;
123 void setTitleFont(const QFont &font);
124 void setTitleFont(const QFont &font);
124 QFont titleFont() const;
125 QFont titleFont() const;
125 void setTitleText(const QString &title);
126 void setTitleText(const QString &title);
126 QString titleText() const;
127 QString titleText() const;
127
128
128 //shades handling
129 //shades handling
129 bool shadesVisible() const;
130 bool shadesVisible() const;
130 void setShadesVisible(bool visible = true);
131 void setShadesVisible(bool visible = true);
131 void setShadesPen(const QPen &pen);
132 void setShadesPen(const QPen &pen);
132 QPen shadesPen() const;
133 QPen shadesPen() const;
133 void setShadesBrush(const QBrush &brush);
134 void setShadesBrush(const QBrush &brush);
134 QBrush shadesBrush() const;
135 QBrush shadesBrush() const;
135 void setShadesColor(QColor color);
136 void setShadesColor(QColor color);
136 QColor shadesColor() const;
137 QColor shadesColor() const;
137 void setShadesBorderColor(QColor color);
138 void setShadesBorderColor(QColor color);
138 QColor shadesBorderColor() const;
139 QColor shadesBorderColor() const;
139
140
140 Qt::Orientation orientation() const;
141 Qt::Orientation orientation() const;
141 Qt::Alignment alignment() const;
142 Qt::Alignment alignment() const;
142
143
143 //range handling
144 //range handling
144 void setMin(const QVariant &min);
145 void setMin(const QVariant &min);
145 void setMax(const QVariant &max);
146 void setMax(const QVariant &max);
146 void setRange(const QVariant &min, const QVariant &max);
147 void setRange(const QVariant &min, const QVariant &max);
147
148
149 //reverse handling
150 void setReverse(bool reverse = true);
151 bool isReverse() const;
152
148 Q_SIGNALS:
153 Q_SIGNALS:
149 void visibleChanged(bool visible);
154 void visibleChanged(bool visible);
150 void linePenChanged(const QPen &pen);
155 void linePenChanged(const QPen &pen);
151 void lineVisibleChanged(bool visible);
156 void lineVisibleChanged(bool visible);
152 void labelsVisibleChanged(bool visible);
157 void labelsVisibleChanged(bool visible);
153 void labelsBrushChanged(const QBrush &brush);
158 void labelsBrushChanged(const QBrush &brush);
154 void labelsFontChanged(const QFont &pen);
159 void labelsFontChanged(const QFont &pen);
155 void labelsAngleChanged(int angle);
160 void labelsAngleChanged(int angle);
156 void gridLinePenChanged(const QPen &pen);
161 void gridLinePenChanged(const QPen &pen);
157 void gridVisibleChanged(bool visible);
162 void gridVisibleChanged(bool visible);
158 void colorChanged(QColor color);
163 void colorChanged(QColor color);
159 void labelsColorChanged(QColor color);
164 void labelsColorChanged(QColor color);
160 void titleTextChanged(const QString &title);
165 void titleTextChanged(const QString &title);
161 void titleBrushChanged(const QBrush &brush);
166 void titleBrushChanged(const QBrush &brush);
162 void titleVisibleChanged(bool visible);
167 void titleVisibleChanged(bool visible);
163 void titleFontChanged(const QFont &font);
168 void titleFontChanged(const QFont &font);
164 void shadesVisibleChanged(bool visible);
169 void shadesVisibleChanged(bool visible);
165 void shadesColorChanged(QColor color);
170 void shadesColorChanged(QColor color);
166 void shadesBorderColorChanged(QColor color);
171 void shadesBorderColorChanged(QColor color);
167 void shadesPenChanged(const QPen &pen);
172 void shadesPenChanged(const QPen &pen);
168 void shadesBrushChanged(const QBrush &brush);
173 void shadesBrushChanged(const QBrush &brush);
174 void reverseChanged(bool reverse);
169
175
170 protected:
176 protected:
171 QScopedPointer<QAbstractAxisPrivate> d_ptr;
177 QScopedPointer<QAbstractAxisPrivate> d_ptr;
172 friend class ChartDataSet;
178 friend class ChartDataSet;
173 friend class ChartPresenter;
179 friend class ChartPresenter;
174 friend class ChartThemeManager;
180 friend class ChartThemeManager;
175 friend class AbstractDomain;
181 friend class AbstractDomain;
176 friend class ChartAxisElement;
182 friend class ChartAxisElement;
177 friend class XYChart;
183 friend class XYChart;
178
184
179 private:
185 private:
180 Q_DISABLE_COPY(QAbstractAxis)
186 Q_DISABLE_COPY(QAbstractAxis)
181 };
187 };
182
188
183 QT_CHARTS_END_NAMESPACE
189 QT_CHARTS_END_NAMESPACE
184
190
185 #endif // QABSTRACTAXIS_H
191 #endif // QABSTRACTAXIS_H
@@ -1,128 +1,130
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QABSTRACTAXIS_P_H
28 #ifndef QABSTRACTAXIS_P_H
29 #define QABSTRACTAXIS_P_H
29 #define QABSTRACTAXIS_P_H
30
30
31 #include <QtCharts/QAbstractAxis>
31 #include <QtCharts/QAbstractAxis>
32 #include <private/chartaxiselement_p.h>
32 #include <private/chartaxiselement_p.h>
33 #include <QtCharts/QChart>
33 #include <QtCharts/QChart>
34 #include <QtCore/QDebug>
34 #include <QtCore/QDebug>
35
35
36 QT_BEGIN_NAMESPACE
36 QT_BEGIN_NAMESPACE
37 class QGraphicsItem;
37 class QGraphicsItem;
38 QT_END_NAMESPACE
38 QT_END_NAMESPACE
39
39
40 QT_CHARTS_BEGIN_NAMESPACE
40 QT_CHARTS_BEGIN_NAMESPACE
41
41
42 class ChartPresenter;
42 class ChartPresenter;
43 class AbstractDomain;
43 class AbstractDomain;
44 class QChart;
44 class QChart;
45 class QAbstractSeries;
45 class QAbstractSeries;
46 class ChartTheme;
46 class ChartTheme;
47 class ChartElement;
47 class ChartElement;
48
48
49 class QT_CHARTS_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
49 class QT_CHARTS_AUTOTEST_EXPORT QAbstractAxisPrivate : public QObject
50 {
50 {
51 Q_OBJECT
51 Q_OBJECT
52 public:
52 public:
53 QAbstractAxisPrivate(QAbstractAxis *q);
53 QAbstractAxisPrivate(QAbstractAxis *q);
54 ~QAbstractAxisPrivate();
54 ~QAbstractAxisPrivate();
55
55
56 public:
56 public:
57 Qt::Alignment alignment() const { return m_alignment; }
57 Qt::Alignment alignment() const { return m_alignment; }
58 Qt::Orientation orientation() const { return m_orientation; }
58 Qt::Orientation orientation() const { return m_orientation; }
59 void setAlignment( Qt::Alignment alignment);
59 void setAlignment( Qt::Alignment alignment);
60
60
61 virtual void initializeDomain(AbstractDomain *domain) = 0;
61 virtual void initializeDomain(AbstractDomain *domain) = 0;
62 virtual void initializeGraphics(QGraphicsItem *parent) = 0;
62 virtual void initializeGraphics(QGraphicsItem *parent) = 0;
63 virtual void initializeTheme(ChartTheme* theme, bool forced = false);
63 virtual void initializeTheme(ChartTheme* theme, bool forced = false);
64 virtual void initializeAnimations(QChart::AnimationOptions options);
64 virtual void initializeAnimations(QChart::AnimationOptions options);
65
65
66 //interface for manipulating range form base class
66 //interface for manipulating range form base class
67 virtual void setMin(const QVariant &min) = 0;
67 virtual void setMin(const QVariant &min) = 0;
68 virtual void setMax(const QVariant &max) = 0;
68 virtual void setMax(const QVariant &max) = 0;
69 virtual void setRange(const QVariant &min, const QVariant &max) = 0;
69 virtual void setRange(const QVariant &min, const QVariant &max) = 0;
70
70
71 //interface manipulating range form domain
71 //interface manipulating range form domain
72 virtual void setRange(qreal min, qreal max) = 0;
72 virtual void setRange(qreal min, qreal max) = 0;
73 virtual qreal min() = 0;
73 virtual qreal min() = 0;
74 virtual qreal max() = 0;
74 virtual qreal max() = 0;
75
75
76 ChartAxisElement *axisItem() { return m_item.data(); }
76 ChartAxisElement *axisItem() { return m_item.data(); }
77
77
78 public Q_SLOTS:
78 public Q_SLOTS:
79 void handleRangeChanged(qreal min, qreal max);
79 void handleRangeChanged(qreal min, qreal max);
80
80
81 Q_SIGNALS:
81 Q_SIGNALS:
82 void rangeChanged(qreal min, qreal max);
82 void rangeChanged(qreal min, qreal max);
83
83
84 protected:
84 protected:
85 QAbstractAxis *q_ptr;
85 QAbstractAxis *q_ptr;
86 QChart *m_chart;
86 QChart *m_chart;
87 QScopedPointer<ChartAxisElement> m_item;
87 QScopedPointer<ChartAxisElement> m_item;
88
88
89 private:
89 private:
90 QList<QAbstractSeries*> m_series;
90 QList<QAbstractSeries*> m_series;
91
91
92 Qt::Alignment m_alignment;
92 Qt::Alignment m_alignment;
93 Qt::Orientation m_orientation;
93 Qt::Orientation m_orientation;
94
94
95 bool m_visible;
95 bool m_visible;
96
96
97 bool m_arrowVisible;
97 bool m_arrowVisible;
98 QPen m_axisPen;
98 QPen m_axisPen;
99 QBrush m_axisBrush;
99 QBrush m_axisBrush;
100
100
101 bool m_gridLineVisible;
101 bool m_gridLineVisible;
102 QPen m_gridLinePen;
102 QPen m_gridLinePen;
103
103
104 bool m_labelsVisible;
104 bool m_labelsVisible;
105 QBrush m_labelsBrush;
105 QBrush m_labelsBrush;
106 QFont m_labelsFont;
106 QFont m_labelsFont;
107 int m_labelsAngle;
107 int m_labelsAngle;
108
108
109 bool m_titleVisible;
109 bool m_titleVisible;
110 QBrush m_titleBrush;
110 QBrush m_titleBrush;
111 QFont m_titleFont;
111 QFont m_titleFont;
112 QString m_title;
112 QString m_title;
113
113
114 bool m_shadesVisible;
114 bool m_shadesVisible;
115 QPen m_shadesPen;
115 QPen m_shadesPen;
116 QBrush m_shadesBrush;
116 QBrush m_shadesBrush;
117 qreal m_shadesOpacity;
117 qreal m_shadesOpacity;
118
118
119 bool m_dirty;
119 bool m_dirty;
120
120
121 bool m_reverse;
122
121 friend class QAbstractAxis;
123 friend class QAbstractAxis;
122 friend class ChartDataSet;
124 friend class ChartDataSet;
123 friend class ChartPresenter;
125 friend class ChartPresenter;
124 };
126 };
125
127
126 QT_CHARTS_END_NAMESPACE
128 QT_CHARTS_END_NAMESPACE
127
129
128 #endif
130 #endif
@@ -1,272 +1,340
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/verticalaxis_p.h>
19 #include <private/verticalaxis_p.h>
20 #include <QtCharts/QAbstractAxis>
20 #include <QtCharts/QAbstractAxis>
21 #include <private/chartpresenter_p.h>
21 #include <private/chartpresenter_p.h>
22 #include <QtCharts/QCategoryAxis>
22 #include <QtCharts/QCategoryAxis>
23 #include <QtCore/QDebug>
23 #include <QtCore/QDebug>
24
24
25 QT_CHARTS_BEGIN_NAMESPACE
25 QT_CHARTS_BEGIN_NAMESPACE
26
26
27 VerticalAxis::VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
27 VerticalAxis::VerticalAxis(QAbstractAxis *axis, QGraphicsItem *item, bool intervalAxis)
28 : CartesianChartAxis(axis, item, intervalAxis)
28 : CartesianChartAxis(axis, item, intervalAxis)
29 {
29 {
30 }
30 }
31
31
32 VerticalAxis::~VerticalAxis()
32 VerticalAxis::~VerticalAxis()
33 {
33 {
34 }
34 }
35
35
36 void VerticalAxis::updateGeometry()
36 void VerticalAxis::updateGeometry()
37 {
37 {
38 const QVector<qreal> &layout = ChartAxisElement::layout();
38 const QVector<qreal> &layout = ChartAxisElement::layout();
39
39
40 if (layout.isEmpty() && axis()->type() != QAbstractAxis::AxisTypeLogValue)
40 if (layout.isEmpty() && axis()->type() != QAbstractAxis::AxisTypeLogValue)
41 return;
41 return;
42
42
43 QStringList labelList = labels();
43 QStringList labelList = labels();
44
44
45 QList<QGraphicsItem *> labels = labelItems();
45 QList<QGraphicsItem *> labels = labelItems();
46 QList<QGraphicsItem *> arrow = arrowItems();
46 QList<QGraphicsItem *> arrow = arrowItems();
47 QGraphicsTextItem *title = titleItem();
47 QGraphicsTextItem *title = titleItem();
48
48
49 Q_ASSERT(labels.size() == labelList.size());
49 Q_ASSERT(labels.size() == labelList.size());
50 Q_ASSERT(layout.size() == labelList.size());
50 Q_ASSERT(layout.size() == labelList.size());
51
51
52 const QRectF &axisRect = axisGeometry();
52 const QRectF &axisRect = axisGeometry();
53 const QRectF &gridRect = gridGeometry();
53 const QRectF &gridRect = gridGeometry();
54
54
55 qreal height = axisRect.bottom();
55 qreal height = axisRect.bottom();
56
56
57 //arrow
57 //arrow
58 QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem*>(arrow.at(0));
58 QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem*>(arrow.at(0));
59
59
60 //arrow position
60 //arrow position
61 if (axis()->alignment() == Qt::AlignLeft)
61 if (axis()->alignment() == Qt::AlignLeft)
62 arrowItem->setLine(axisRect.right(), gridRect.top(), axisRect.right(), gridRect.bottom());
62 arrowItem->setLine(axisRect.right(), gridRect.top(), axisRect.right(), gridRect.bottom());
63 else if (axis()->alignment() == Qt::AlignRight)
63 else if (axis()->alignment() == Qt::AlignRight)
64 arrowItem->setLine(axisRect.left(), gridRect.top(), axisRect.left(), gridRect.bottom());
64 arrowItem->setLine(axisRect.left(), gridRect.top(), axisRect.left(), gridRect.bottom());
65
65
66 //title
66 //title
67 QRectF titleBoundingRect;
67 QRectF titleBoundingRect;
68 QString titleText = axis()->titleText();
68 QString titleText = axis()->titleText();
69 qreal availableSpace = axisRect.width() - labelPadding();
69 qreal availableSpace = axisRect.width() - labelPadding();
70 if (!titleText.isEmpty() && titleItem()->isVisible()) {
70 if (!titleText.isEmpty() && titleItem()->isVisible()) {
71 availableSpace -= titlePadding() * 2.0;
71 availableSpace -= titlePadding() * 2.0;
72 qreal minimumLabelWidth = ChartPresenter::textBoundingRect(axis()->labelsFont(),
72 qreal minimumLabelWidth = ChartPresenter::textBoundingRect(axis()->labelsFont(),
73 QStringLiteral("...")).width();
73 QStringLiteral("...")).width();
74 qreal titleSpace = availableSpace - minimumLabelWidth;
74 qreal titleSpace = availableSpace - minimumLabelWidth;
75 title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(90.0),
75 title->setHtml(ChartPresenter::truncatedText(axis()->titleFont(), titleText, qreal(90.0),
76 titleSpace, gridRect.height(),
76 titleSpace, gridRect.height(),
77 titleBoundingRect));
77 titleBoundingRect));
78 title->setTextWidth(titleBoundingRect.height());
78 title->setTextWidth(titleBoundingRect.height());
79
79
80 titleBoundingRect = title->boundingRect();
80 titleBoundingRect = title->boundingRect();
81
81
82 QPointF center = gridRect.center() - titleBoundingRect.center();
82 QPointF center = gridRect.center() - titleBoundingRect.center();
83 if (axis()->alignment() == Qt::AlignLeft)
83 if (axis()->alignment() == Qt::AlignLeft)
84 title->setPos(axisRect.left() - titleBoundingRect.width() / 2.0 + titleBoundingRect.height() / 2.0 + titlePadding(), center.y());
84 title->setPos(axisRect.left() - titleBoundingRect.width() / 2.0 + titleBoundingRect.height() / 2.0 + titlePadding(), center.y());
85 else if (axis()->alignment() == Qt::AlignRight)
85 else if (axis()->alignment() == Qt::AlignRight)
86 title->setPos(axisRect.right() - titleBoundingRect.width() / 2.0 - titleBoundingRect.height() / 2.0 - titlePadding(), center.y());
86 title->setPos(axisRect.right() - titleBoundingRect.width() / 2.0 - titleBoundingRect.height() / 2.0 - titlePadding(), center.y());
87
87
88 title->setTransformOriginPoint(titleBoundingRect.center());
88 title->setTransformOriginPoint(titleBoundingRect.center());
89 title->setRotation(270);
89 title->setRotation(270);
90
90
91 availableSpace -= titleBoundingRect.height();
91 availableSpace -= titleBoundingRect.height();
92 }
92 }
93
93
94 if (layout.isEmpty() && axis()->type() == QAbstractAxis::AxisTypeLogValue)
94 if (layout.isEmpty() && axis()->type() == QAbstractAxis::AxisTypeLogValue)
95 return;
95 return;
96
96
97 QList<QGraphicsItem *> lines = gridItems();
97 QList<QGraphicsItem *> lines = gridItems();
98 QList<QGraphicsItem *> shades = shadeItems();
98 QList<QGraphicsItem *> shades = shadeItems();
99
99
100 for (int i = 0; i < layout.size(); ++i) {
100 for (int i = 0; i < layout.size(); ++i) {
101 //items
101 //items
102 QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem *>(lines.at(i));
102 QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem *>(lines.at(i));
103 QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrow.at(i + 1));
103 QGraphicsLineItem *tickItem = static_cast<QGraphicsLineItem *>(arrow.at(i + 1));
104 QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
104 QGraphicsTextItem *labelItem = static_cast<QGraphicsTextItem *>(labels.at(i));
105
105
106 //grid line
106 //grid line
107 gridItem->setLine(gridRect.left(), layout[i], gridRect.right(), layout[i]);
107 if (axis()->isReverse()) {
108 gridItem->setLine(gridRect.left(), gridRect.top() + gridRect.bottom() - layout[i],
109 gridRect.right(), gridRect.top() + gridRect.bottom() - layout[i]);
110 } else {
111 gridItem->setLine(gridRect.left(), layout[i], gridRect.right(), layout[i]);
112 }
108
113
109 //label text wrapping
114 //label text wrapping
110 QString text = labelList.at(i);
115 QString text;
116 if (axis()->isReverse() && axis()->type() != QAbstractAxis::AxisTypeCategory)
117 text = labelList.at(labelList.count() - i - 1);
118 else
119 text = labelList.at(i);
120
111 QRectF boundingRect;
121 QRectF boundingRect;
112 // don't truncate empty labels
122 // don't truncate empty labels
113 if (text.isEmpty()) {
123 if (text.isEmpty()) {
114 labelItem->setHtml(text);
124 labelItem->setHtml(text);
115 } else {
125 } else {
116 qreal labelHeight = (axisRect.height() / layout.count()) - (2 * labelPadding());
126 qreal labelHeight = (axisRect.height() / layout.count()) - (2 * labelPadding());
117 QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
127 QString truncatedText = ChartPresenter::truncatedText(axis()->labelsFont(), text,
118 axis()->labelsAngle(),
128 axis()->labelsAngle(),
119 availableSpace,
129 availableSpace,
120 labelHeight, boundingRect);
130 labelHeight, boundingRect);
121 labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
131 labelItem->setTextWidth(ChartPresenter::textBoundingRect(axis()->labelsFont(),
122 truncatedText).width());
132 truncatedText).width());
123 labelItem->setHtml(truncatedText);
133 labelItem->setHtml(truncatedText);
124 }
134 }
125
135
126 //label transformation origin point
136 //label transformation origin point
127 const QRectF &rect = labelItem->boundingRect();
137 const QRectF &rect = labelItem->boundingRect();
128 QPointF center = rect.center();
138 QPointF center = rect.center();
129 labelItem->setTransformOriginPoint(center.x(), center.y());
139 labelItem->setTransformOriginPoint(center.x(), center.y());
130 qreal widthDiff = rect.width() - boundingRect.width();
140 qreal widthDiff = rect.width() - boundingRect.width();
131 qreal heightDiff = rect.height() - boundingRect.height();
141 qreal heightDiff = rect.height() - boundingRect.height();
132
142
133 //ticks and label position
143 //ticks and label position
134 if (axis()->alignment() == Qt::AlignLeft) {
144 if (axis()->alignment() == Qt::AlignLeft) {
135 labelItem->setPos(axisRect.right() - rect.width() + (widthDiff / 2.0) - labelPadding(), layout[i] - center.y());
145 if (axis()->isReverse()) {
136 tickItem->setLine(axisRect.right() - labelPadding(), layout[i], axisRect.right(), layout[i]);
146 labelItem->setPos(axisRect.right() - rect.width() + (widthDiff / 2.0)
147 - labelPadding(),
148 gridRect.top() + gridRect.bottom()
149 - layout[layout.size() - i - 1] - center.y());
150 tickItem->setLine(axisRect.right() - labelPadding(),
151 gridRect.top() + gridRect.bottom() - layout[i],
152 axisRect.right(),
153 gridRect.top() + gridRect.bottom() - layout[i]);
154 } else {
155 labelItem->setPos(axisRect.right() - rect.width() + (widthDiff / 2.0)
156 - labelPadding(),
157 layout[i] - center.y());
158 tickItem->setLine(axisRect.right() - labelPadding(), layout[i],
159 axisRect.right(), layout[i]);
160 }
137 } else if (axis()->alignment() == Qt::AlignRight) {
161 } else if (axis()->alignment() == Qt::AlignRight) {
138 labelItem->setPos(axisRect.left() + labelPadding() - (widthDiff / 2.0), layout[i] - center.y());
162 if (axis()->isReverse()) {
139 tickItem->setLine(axisRect.left(), layout[i], axisRect.left() + labelPadding(), layout[i]);
163 tickItem->setLine(axisRect.left(),
164 gridRect.top() + gridRect.bottom() - layout[i],
165 axisRect.left() + labelPadding(),
166 gridRect.top() + gridRect.bottom() - layout[i]);
167 labelItem->setPos(axisRect.left() + labelPadding() - (widthDiff / 2.0),
168 gridRect.top() + gridRect.bottom()
169 - layout[layout.size() - i - 1] - center.y());
170 } else {
171 labelItem->setPos(axisRect.left() + labelPadding() - (widthDiff / 2.0),
172 layout[i] - center.y());
173 tickItem->setLine(axisRect.left(), layout[i],
174 axisRect.left() + labelPadding(), layout[i]);
175 }
140 }
176 }
141
177
142 //label in between
178 //label in between
143 bool forceHide = false;
179 bool forceHide = false;
144 bool labelOnValue = false;
180 bool labelOnValue = false;
145 if (intervalAxis() && (i + 1) != layout.size()) {
181 if (intervalAxis() && (i + 1) != layout.size()) {
146 qreal lowerBound = qMin(layout[i], gridRect.bottom());
182 qreal lowerBound;
147 qreal upperBound = qMax(layout[i + 1], gridRect.top());
183 qreal upperBound;
184 if (axis()->isReverse()) {
185 lowerBound = qMax(gridRect.top() + gridRect.bottom() - layout[i + 1],
186 gridRect.top());
187 upperBound = qMin(gridRect.top() + gridRect.bottom() - layout[i],
188 gridRect.bottom());
189 } else {
190 lowerBound = qMin(layout[i], gridRect.bottom());
191 upperBound = qMax(layout[i + 1], gridRect.top());
192 }
148 const qreal delta = lowerBound - upperBound;
193 const qreal delta = lowerBound - upperBound;
149 if (axis()->type() != QAbstractAxis::AxisTypeCategory) {
194 if (axis()->type() != QAbstractAxis::AxisTypeCategory) {
150 // Hide label in case visible part of the category at the grid edge is too narrow
195 // Hide label in case visible part of the category at the grid edge is too narrow
151 if (delta < boundingRect.height()
196 if (delta < boundingRect.height()
152 && (lowerBound == gridRect.bottom() || upperBound == gridRect.top())) {
197 && (lowerBound == gridRect.bottom() || upperBound == gridRect.top())) {
153 forceHide = true;
198 forceHide = true;
154 } else {
199 } else {
155 labelItem->setPos(labelItem->pos().x(),
200 labelItem->setPos(labelItem->pos().x(),
156 lowerBound - (delta / 2.0) - center.y());
201 lowerBound - (delta / 2.0) - center.y());
157 }
202 }
158 } else {
203 } else {
159 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
204 QCategoryAxis *categoryAxis = static_cast<QCategoryAxis *>(axis());
160 if (categoryAxis->labelsPosition() == QCategoryAxis::AxisLabelsPositionCenter) {
205 if (categoryAxis->labelsPosition() == QCategoryAxis::AxisLabelsPositionCenter) {
161 if (delta < boundingRect.height()
206 if (delta < boundingRect.height()
162 && (lowerBound == gridRect.bottom() || upperBound == gridRect.top())) {
207 && (lowerBound == gridRect.bottom() || upperBound == gridRect.top())) {
163 forceHide = true;
208 forceHide = true;
164 } else {
209 } else {
165 labelItem->setPos(labelItem->pos().x(),
210 labelItem->setPos(labelItem->pos().x(),
166 lowerBound - (delta / 2.0) - center.y());
211 lowerBound - (delta / 2.0) - center.y());
167 }
212 }
168 } else if (categoryAxis->labelsPosition()
213 } else if (categoryAxis->labelsPosition()
169 == QCategoryAxis::AxisLabelsPositionOnValue) {
214 == QCategoryAxis::AxisLabelsPositionOnValue) {
170 labelOnValue = true;
215 labelOnValue = true;
171 labelItem->setPos(labelItem->pos().x(), upperBound - center.y());
216 if (axis()->isReverse()) {
217 labelItem->setPos(labelItem->pos().x(), gridRect.top() + gridRect.bottom()
218 - layout[i + 1] - center.y());
219 } else {
220 labelItem->setPos(labelItem->pos().x(), upperBound - center.y());
221 }
172 }
222 }
173 }
223 }
174 }
224 }
175
225
176 //label overlap detection - compensate one pixel for rounding errors
226 //label overlap detection - compensate one pixel for rounding errors
177 if (labelItem->pos().y() + boundingRect.height() > height || forceHide ||
227 if (axis()->isReverse()) {
228 if (forceHide)
229 labelItem->setVisible(false);
230 } else if (labelItem->pos().y() + boundingRect.height() > height || forceHide ||
178 ((labelItem->pos().y() + (heightDiff / 2.0) - 1.0) > axisRect.bottom()
231 ((labelItem->pos().y() + (heightDiff / 2.0) - 1.0) > axisRect.bottom()
179 && !labelOnValue) ||
232 && !labelOnValue) ||
180 (labelItem->pos().y() + (heightDiff / 2.0) < (axisRect.top() - 1.0) && !labelOnValue)) {
233 (labelItem->pos().y() + (heightDiff / 2.0) < (axisRect.top() - 1.0) && !labelOnValue)) {
181 labelItem->setVisible(false);
234 labelItem->setVisible(false);
182 }
235 }
183 else {
236 else {
184 labelItem->setVisible(true);
237 labelItem->setVisible(true);
185 height=labelItem->pos().y();
238 height=labelItem->pos().y();
186 }
239 }
187
240
188 //shades
241 //shades
189 QGraphicsRectItem *shadeItem = 0;
242 QGraphicsRectItem *shadeItem = 0;
190 if (i == 0)
243 if (i == 0)
191 shadeItem = static_cast<QGraphicsRectItem *>(shades.at(0));
244 shadeItem = static_cast<QGraphicsRectItem *>(shades.at(0));
192 else if (i % 2)
245 else if (i % 2)
193 shadeItem = static_cast<QGraphicsRectItem *>(shades.at((i / 2) + 1));
246 shadeItem = static_cast<QGraphicsRectItem *>(shades.at((i / 2) + 1));
194 if (shadeItem) {
247 if (shadeItem) {
195 qreal lowerBound;
248 qreal lowerBound;
196 qreal upperBound;
249 qreal upperBound;
197 if (i == 0) {
250 if (i == 0) {
198 lowerBound = gridRect.bottom();
251 if (axis()->isReverse()) {
199 upperBound = layout[0];
200 } else {
201 lowerBound = layout[i];
202 if (i == layout.size() - 1)
203 upperBound = gridRect.top();
252 upperBound = gridRect.top();
204 else
253 lowerBound = gridRect.top() + gridRect.bottom() - layout[i];
205 upperBound = qMax(layout[i + 1], gridRect.top());
254 } else {
255 lowerBound = gridRect.bottom();
256 upperBound = layout[0];
257 }
258 } else {
259 if (axis()->isReverse()) {
260 upperBound = gridRect.top() + gridRect.bottom() - layout[i];
261 if (i == layout.size() - 1) {
262 lowerBound = gridRect.bottom();
263 } else {
264 lowerBound = qMax(gridRect.top() + gridRect.bottom() - layout[i + 1],
265 gridRect.top());
266 }
267 } else {
268 lowerBound = layout[i];
269 if (i == layout.size() - 1)
270 upperBound = gridRect.top();
271 else
272 upperBound = qMax(layout[i + 1], gridRect.top());
273 }
206
274
207 }
275 }
208 if (lowerBound > gridRect.bottom())
276 if (lowerBound > gridRect.bottom())
209 lowerBound = gridRect.bottom();
277 lowerBound = gridRect.bottom();
210 if (upperBound < gridRect.top())
278 if (upperBound < gridRect.top())
211 upperBound = gridRect.top();
279 upperBound = gridRect.top();
212 shadeItem->setRect(gridRect.left(), upperBound, gridRect.width(),
280 shadeItem->setRect(gridRect.left(), upperBound, gridRect.width(),
213 lowerBound - upperBound);
281 lowerBound - upperBound);
214 if (shadeItem->rect().height() <= 0.0)
282 if (shadeItem->rect().height() <= 0.0)
215 shadeItem->setVisible(false);
283 shadeItem->setVisible(false);
216 else
284 else
217 shadeItem->setVisible(true);
285 shadeItem->setVisible(true);
218 }
286 }
219
287
220 // check if the grid line and the axis tick should be shown
288 // check if the grid line and the axis tick should be shown
221 qreal y = gridItem->line().p1().y();
289 qreal y = gridItem->line().p1().y();
222 if ((y < gridRect.top() || y > gridRect.bottom()))
290 if ((y < gridRect.top() || y > gridRect.bottom()))
223 {
291 {
224 gridItem->setVisible(false);
292 gridItem->setVisible(false);
225 tickItem->setVisible(false);
293 tickItem->setVisible(false);
226 }else{
294 }else{
227 gridItem->setVisible(true);
295 gridItem->setVisible(true);
228 tickItem->setVisible(true);
296 tickItem->setVisible(true);
229 }
297 }
230
298
231 }
299 }
232 //begin/end grid line in case labels between
300 //begin/end grid line in case labels between
233 if (intervalAxis()) {
301 if (intervalAxis()) {
234 QGraphicsLineItem *gridLine;
302 QGraphicsLineItem *gridLine;
235 gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
303 gridLine = static_cast<QGraphicsLineItem *>(lines.at(layout.size()));
236 gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.right(), gridRect.top());
304 gridLine->setLine(gridRect.left(), gridRect.top(), gridRect.right(), gridRect.top());
237 gridLine->setVisible(true);
305 gridLine->setVisible(true);
238 gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size() + 1));
306 gridLine = static_cast<QGraphicsLineItem*>(lines.at(layout.size() + 1));
239 gridLine->setLine(gridRect.left(), gridRect.bottom(), gridRect.right(), gridRect.bottom());
307 gridLine->setLine(gridRect.left(), gridRect.bottom(), gridRect.right(), gridRect.bottom());
240 gridLine->setVisible(true);
308 gridLine->setVisible(true);
241 }
309 }
242 }
310 }
243
311
244 QSizeF VerticalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
312 QSizeF VerticalAxis::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
245 {
313 {
246 Q_UNUSED(constraint);
314 Q_UNUSED(constraint);
247 QSizeF sh(0, 0);
315 QSizeF sh(0, 0);
248
316
249 if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
317 if (axis()->titleText().isEmpty() || !titleItem()->isVisible())
250 return sh;
318 return sh;
251
319
252 switch (which) {
320 switch (which) {
253 case Qt::MinimumSize: {
321 case Qt::MinimumSize: {
254 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(),
322 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(),
255 QStringLiteral("..."));
323 QStringLiteral("..."));
256 sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
324 sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
257 break;
325 break;
258 }
326 }
259 case Qt::MaximumSize:
327 case Qt::MaximumSize:
260 case Qt::PreferredSize: {
328 case Qt::PreferredSize: {
261 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
329 QRectF titleRect = ChartPresenter::textBoundingRect(axis()->titleFont(), axis()->titleText());
262 sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
330 sh = QSizeF(titleRect.height() + (titlePadding() * 2.0), titleRect.width());
263 break;
331 break;
264 }
332 }
265 default:
333 default:
266 break;
334 break;
267 }
335 }
268
336
269 return sh;
337 return sh;
270 }
338 }
271
339
272 QT_CHARTS_END_NAMESPACE
340 QT_CHARTS_END_NAMESPACE
@@ -1,45 +1,58
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/chartitem_p.h>
19 #include <private/chartitem_p.h>
20 #include <private/qabstractseries_p.h>
20 #include <private/qabstractseries_p.h>
21 #include <private/abstractdomain_p.h>
21 #include <private/abstractdomain_p.h>
22
22
23 QT_CHARTS_BEGIN_NAMESPACE
23 QT_CHARTS_BEGIN_NAMESPACE
24
24
25 ChartItem::ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item):
25 ChartItem::ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item):
26 ChartElement(item),
26 ChartElement(item),
27 m_validData(true),
27 m_validData(true),
28 m_series(series)
28 m_series(series)
29 {
29 {
30
30
31 }
31 }
32
32
33 AbstractDomain* ChartItem::domain() const
33 AbstractDomain* ChartItem::domain() const
34 {
34 {
35 return m_series->domain();
35 return m_series->domain();
36 }
36 }
37
37
38 void ChartItem::handleDomainUpdated()
38 void ChartItem::handleDomainUpdated()
39 {
39 {
40 qWarning() << __FUNCTION__<< "Slot not implemented";
40 qWarning() << __FUNCTION__<< "Slot not implemented";
41 }
41 }
42
42
43 void ChartItem::reversePainter(QPainter *painter, const QRectF &clipRect)
44 {
45 if (m_series->reverseXAxis()) {
46 painter->translate(clipRect.width(), 0);
47 painter->scale(-1, 1);
48 }
49
50 if (m_series->reverseYAxis()) {
51 painter->translate(0, clipRect.height());
52 painter->scale(1, -1);
53 }
54 }
55
43 #include "moc_chartitem_p.cpp"
56 #include "moc_chartitem_p.cpp"
44
57
45 QT_CHARTS_END_NAMESPACE
58 QT_CHARTS_END_NAMESPACE
@@ -1,55 +1,58
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef CHARTITEM_H
28 #ifndef CHARTITEM_H
29 #define CHARTITEM_H
29 #define CHARTITEM_H
30
30
31 #include <private/chartelement_p.h>
31 #include <private/chartelement_p.h>
32 #include <private/chartpresenter_p.h>
32 #include <private/chartpresenter_p.h>
33 #include <QtWidgets/QGraphicsItem>
33 #include <QtWidgets/QGraphicsItem>
34
34
35 QT_CHARTS_BEGIN_NAMESPACE
35 QT_CHARTS_BEGIN_NAMESPACE
36
36
37 class ChartItem : public ChartElement
37 class ChartItem : public ChartElement
38 {
38 {
39 Q_OBJECT
39 Q_OBJECT
40 enum ChartItemTypes { AXIS_ITEM = UserType + 1, XYLINE_ITEM };
40 enum ChartItemTypes { AXIS_ITEM = UserType + 1, XYLINE_ITEM };
41 public:
41 public:
42 ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item);
42 ChartItem(QAbstractSeriesPrivate *series,QGraphicsItem* item);
43 AbstractDomain* domain() const;
43 AbstractDomain* domain() const;
44 public Q_SLOTS:
44 public Q_SLOTS:
45 virtual void handleDomainUpdated();
45 virtual void handleDomainUpdated();
46
46
47 void reversePainter(QPainter *painter, const QRectF &clipRect);
48 QAbstractSeriesPrivate* seriesPrivate() const {return m_series;}
49
47 protected:
50 protected:
48 bool m_validData;
51 bool m_validData;
49 private:
52 private:
50 QAbstractSeriesPrivate* m_series;
53 QAbstractSeriesPrivate* m_series;
51 };
54 };
52
55
53 QT_CHARTS_END_NAMESPACE
56 QT_CHARTS_END_NAMESPACE
54
57
55 #endif /* CHARTITEM_H */
58 #endif /* CHARTITEM_H */
@@ -1,427 +1,431
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/linechartitem_p.h>
19 #include <private/linechartitem_p.h>
20 #include <QtCharts/QLineSeries>
20 #include <QtCharts/QLineSeries>
21 #include <private/qlineseries_p.h>
21 #include <private/qlineseries_p.h>
22 #include <private/chartpresenter_p.h>
22 #include <private/chartpresenter_p.h>
23 #include <private/polardomain_p.h>
23 #include <private/polardomain_p.h>
24 #include <private/chartthememanager_p.h>
24 #include <private/chartthememanager_p.h>
25 #include <private/charttheme_p.h>
25 #include <private/charttheme_p.h>
26 #include <QtGui/QPainter>
26 #include <QtGui/QPainter>
27 #include <QtWidgets/QGraphicsSceneMouseEvent>
27 #include <QtWidgets/QGraphicsSceneMouseEvent>
28
28
29 QT_CHARTS_BEGIN_NAMESPACE
29 QT_CHARTS_BEGIN_NAMESPACE
30
30
31 const qreal mouseEventMinWidth(12);
31 const qreal mouseEventMinWidth(12);
32
32
33 LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item)
33 LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item)
34 : XYChart(series,item),
34 : XYChart(series,item),
35 m_series(series),
35 m_series(series),
36 m_pointsVisible(false),
36 m_pointsVisible(false),
37 m_chartType(QChart::ChartTypeUndefined),
37 m_chartType(QChart::ChartTypeUndefined),
38 m_pointLabelsVisible(false),
38 m_pointLabelsVisible(false),
39 m_pointLabelsFormat(series->pointLabelsFormat()),
39 m_pointLabelsFormat(series->pointLabelsFormat()),
40 m_pointLabelsFont(series->pointLabelsFont()),
40 m_pointLabelsFont(series->pointLabelsFont()),
41 m_pointLabelsColor(series->pointLabelsColor()),
41 m_pointLabelsColor(series->pointLabelsColor()),
42 m_mousePressed(false)
42 m_mousePressed(false)
43 {
43 {
44 setAcceptHoverEvents(true);
44 setAcceptHoverEvents(true);
45 setFlag(QGraphicsItem::ItemIsSelectable);
45 setFlag(QGraphicsItem::ItemIsSelectable);
46 setZValue(ChartPresenter::LineChartZValue);
46 setZValue(ChartPresenter::LineChartZValue);
47 QObject::connect(series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
47 QObject::connect(series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
48 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
48 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
49 QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
49 QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
50 QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
50 QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
51 this, SLOT(handleUpdated()));
51 this, SLOT(handleUpdated()));
52 QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
52 QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
53 this, SLOT(handleUpdated()));
53 this, SLOT(handleUpdated()));
54 QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
54 QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
55 QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
55 QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
56 handleUpdated();
56 handleUpdated();
57 }
57 }
58
58
59 QRectF LineChartItem::boundingRect() const
59 QRectF LineChartItem::boundingRect() const
60 {
60 {
61 return m_rect;
61 return m_rect;
62 }
62 }
63
63
64 QPainterPath LineChartItem::shape() const
64 QPainterPath LineChartItem::shape() const
65 {
65 {
66 return m_shapePath;
66 return m_shapePath;
67 }
67 }
68
68
69 void LineChartItem::updateGeometry()
69 void LineChartItem::updateGeometry()
70 {
70 {
71 m_points = geometryPoints();
71 m_points = geometryPoints();
72 const QVector<QPointF> &points = m_points;
72 const QVector<QPointF> &points = m_points;
73
73
74 if (points.size() == 0) {
74 if (points.size() == 0) {
75 prepareGeometryChange();
75 prepareGeometryChange();
76 m_fullPath = QPainterPath();
76 m_fullPath = QPainterPath();
77 m_linePath = QPainterPath();
77 m_linePath = QPainterPath();
78 m_rect = QRect();
78 m_rect = QRect();
79 return;
79 return;
80 }
80 }
81
81
82 QPainterPath linePath;
82 QPainterPath linePath;
83 QPainterPath fullPath;
83 QPainterPath fullPath;
84 // Use worst case scenario to determine required margin.
84 // Use worst case scenario to determine required margin.
85 qreal margin = m_linePen.width() * 1.42;
85 qreal margin = m_linePen.width() * 1.42;
86
86
87 // Area series use component line series that aren't necessarily added to the chart themselves,
87 // Area series use component line series that aren't necessarily added to the chart themselves,
88 // so check if chart type is forced before trying to obtain it from the chart.
88 // so check if chart type is forced before trying to obtain it from the chart.
89 QChart::ChartType chartType = m_chartType;
89 QChart::ChartType chartType = m_chartType;
90 if (chartType == QChart::ChartTypeUndefined)
90 if (chartType == QChart::ChartTypeUndefined)
91 chartType = m_series->chart()->chartType();
91 chartType = m_series->chart()->chartType();
92
92
93 // For polar charts, we need special handling for angular (horizontal)
93 // For polar charts, we need special handling for angular (horizontal)
94 // points that are off-grid.
94 // points that are off-grid.
95 if (chartType == QChart::ChartTypePolar) {
95 if (chartType == QChart::ChartTypePolar) {
96 QPainterPath linePathLeft;
96 QPainterPath linePathLeft;
97 QPainterPath linePathRight;
97 QPainterPath linePathRight;
98 QPainterPath *currentSegmentPath = 0;
98 QPainterPath *currentSegmentPath = 0;
99 QPainterPath *previousSegmentPath = 0;
99 QPainterPath *previousSegmentPath = 0;
100 qreal minX = domain()->minX();
100 qreal minX = domain()->minX();
101 qreal maxX = domain()->maxX();
101 qreal maxX = domain()->maxX();
102 qreal minY = domain()->minY();
102 qreal minY = domain()->minY();
103 QPointF currentSeriesPoint = m_series->at(0);
103 QPointF currentSeriesPoint = m_series->at(0);
104 QPointF currentGeometryPoint = points.at(0);
104 QPointF currentGeometryPoint = points.at(0);
105 QPointF previousGeometryPoint = points.at(0);
105 QPointF previousGeometryPoint = points.at(0);
106 int size = m_linePen.width();
106 int size = m_linePen.width();
107 bool pointOffGrid = false;
107 bool pointOffGrid = false;
108 bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
108 bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
109
109
110 qreal domainRadius = domain()->size().height() / 2.0;
110 qreal domainRadius = domain()->size().height() / 2.0;
111 const QPointF centerPoint(domainRadius, domainRadius);
111 const QPointF centerPoint(domainRadius, domainRadius);
112
112
113 if (!previousPointWasOffGrid) {
113 if (!previousPointWasOffGrid) {
114 fullPath.moveTo(points.at(0));
114 fullPath.moveTo(points.at(0));
115 if (m_pointsVisible && currentSeriesPoint.y() >= minY) {
115 if (m_pointsVisible && currentSeriesPoint.y() >= minY) {
116 // Do not draw ellipses for points below minimum Y.
116 // Do not draw ellipses for points below minimum Y.
117 linePath.addEllipse(points.at(0), size, size);
117 linePath.addEllipse(points.at(0), size, size);
118 fullPath.addEllipse(points.at(0), size, size);
118 fullPath.addEllipse(points.at(0), size, size);
119 linePath.moveTo(points.at(0));
119 linePath.moveTo(points.at(0));
120 fullPath.moveTo(points.at(0));
120 fullPath.moveTo(points.at(0));
121 }
121 }
122 }
122 }
123
123
124 qreal leftMarginLine = centerPoint.x() - margin;
124 qreal leftMarginLine = centerPoint.x() - margin;
125 qreal rightMarginLine = centerPoint.x() + margin;
125 qreal rightMarginLine = centerPoint.x() + margin;
126 qreal horizontal = centerPoint.y();
126 qreal horizontal = centerPoint.y();
127
127
128 // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
128 // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
129 const int seriesLastIndex = m_series->count() - 1;
129 const int seriesLastIndex = m_series->count() - 1;
130
130
131 for (int i = 1; i < points.size(); i++) {
131 for (int i = 1; i < points.size(); i++) {
132 // Interpolating line fragments would be ugly when thick pen is used,
132 // Interpolating line fragments would be ugly when thick pen is used,
133 // so we work around it by utilizing three separate
133 // so we work around it by utilizing three separate
134 // paths for line segments and clip those with custom regions at paint time.
134 // paths for line segments and clip those with custom regions at paint time.
135 // "Right" path contains segments that cross the axis line with visible point on the
135 // "Right" path contains segments that cross the axis line with visible point on the
136 // right side of the axis line, as well as segments that have one point within the margin
136 // right side of the axis line, as well as segments that have one point within the margin
137 // on the right side of the axis line and another point on the right side of the chart.
137 // on the right side of the axis line and another point on the right side of the chart.
138 // "Left" path contains points with similarly on the left side.
138 // "Left" path contains points with similarly on the left side.
139 // "Full" path contains rest of the points.
139 // "Full" path contains rest of the points.
140 // This doesn't yield perfect results always. E.g. when segment covers more than 90
140 // This doesn't yield perfect results always. E.g. when segment covers more than 90
141 // degrees and both of the points are within the margin, one in the top half and one in the
141 // degrees and both of the points are within the margin, one in the top half and one in the
142 // bottom half of the chart, the bottom one gets clipped incorrectly.
142 // bottom half of the chart, the bottom one gets clipped incorrectly.
143 // However, this should be rare occurrence in any sensible chart.
143 // However, this should be rare occurrence in any sensible chart.
144 currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
144 currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
145 currentGeometryPoint = points.at(i);
145 currentGeometryPoint = points.at(i);
146 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
146 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
147
147
148 // Draw something unless both off-grid
148 // Draw something unless both off-grid
149 if (!pointOffGrid || !previousPointWasOffGrid) {
149 if (!pointOffGrid || !previousPointWasOffGrid) {
150 QPointF intersectionPoint;
150 QPointF intersectionPoint;
151 qreal y;
151 qreal y;
152 if (pointOffGrid != previousPointWasOffGrid) {
152 if (pointOffGrid != previousPointWasOffGrid) {
153 if (currentGeometryPoint.x() == previousGeometryPoint.x()) {
153 if (currentGeometryPoint.x() == previousGeometryPoint.x()) {
154 y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) / 2.0;
154 y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) / 2.0;
155 } else {
155 } else {
156 qreal ratio = (centerPoint.x() - currentGeometryPoint.x()) / (currentGeometryPoint.x() - previousGeometryPoint.x());
156 qreal ratio = (centerPoint.x() - currentGeometryPoint.x()) / (currentGeometryPoint.x() - previousGeometryPoint.x());
157 y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) * ratio;
157 y = currentGeometryPoint.y() + (currentGeometryPoint.y() - previousGeometryPoint.y()) * ratio;
158 }
158 }
159 intersectionPoint = QPointF(centerPoint.x(), y);
159 intersectionPoint = QPointF(centerPoint.x(), y);
160 }
160 }
161
161
162 bool dummyOk; // We know points are ok, but this is needed
162 bool dummyOk; // We know points are ok, but this is needed
163 qreal currentAngle = 0;
163 qreal currentAngle = 0;
164 qreal previousAngle = 0;
164 qreal previousAngle = 0;
165 if (const PolarDomain *pd = qobject_cast<const PolarDomain *>(domain())) {
165 if (const PolarDomain *pd = qobject_cast<const PolarDomain *>(domain())) {
166 currentAngle = pd->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
166 currentAngle = pd->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
167 previousAngle = pd->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
167 previousAngle = pd->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
168 } else {
168 } else {
169 qWarning() << Q_FUNC_INFO << "Unexpected domain: " << domain();
169 qWarning() << Q_FUNC_INFO << "Unexpected domain: " << domain();
170 }
170 }
171 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
171 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
172 // If the angle between two points is over 180 degrees (half X range),
172 // If the angle between two points is over 180 degrees (half X range),
173 // any direct segment between them becomes meaningless.
173 // any direct segment between them becomes meaningless.
174 // In this case two line segments are drawn instead, from previous
174 // In this case two line segments are drawn instead, from previous
175 // point to the center and from center to current point.
175 // point to the center and from center to current point.
176 if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
176 if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
177 && previousGeometryPoint.y() < horizontal) {
177 && previousGeometryPoint.y() < horizontal) {
178 currentSegmentPath = &linePathRight;
178 currentSegmentPath = &linePathRight;
179 } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
179 } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
180 && previousGeometryPoint.y() < horizontal) {
180 && previousGeometryPoint.y() < horizontal) {
181 currentSegmentPath = &linePathLeft;
181 currentSegmentPath = &linePathLeft;
182 } else if (previousAngle > 0.0 && previousAngle < 360.0) {
182 } else if (previousAngle > 0.0 && previousAngle < 360.0) {
183 currentSegmentPath = &linePath;
183 currentSegmentPath = &linePath;
184 } else {
184 } else {
185 currentSegmentPath = 0;
185 currentSegmentPath = 0;
186 }
186 }
187
187
188 if (currentSegmentPath) {
188 if (currentSegmentPath) {
189 if (previousSegmentPath != currentSegmentPath)
189 if (previousSegmentPath != currentSegmentPath)
190 currentSegmentPath->moveTo(previousGeometryPoint);
190 currentSegmentPath->moveTo(previousGeometryPoint);
191 if (previousPointWasOffGrid)
191 if (previousPointWasOffGrid)
192 fullPath.moveTo(intersectionPoint);
192 fullPath.moveTo(intersectionPoint);
193
193
194 currentSegmentPath->lineTo(centerPoint);
194 currentSegmentPath->lineTo(centerPoint);
195 fullPath.lineTo(centerPoint);
195 fullPath.lineTo(centerPoint);
196 }
196 }
197
197
198 previousSegmentPath = currentSegmentPath;
198 previousSegmentPath = currentSegmentPath;
199
199
200 if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
200 if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
201 && currentGeometryPoint.y() < horizontal) {
201 && currentGeometryPoint.y() < horizontal) {
202 currentSegmentPath = &linePathRight;
202 currentSegmentPath = &linePathRight;
203 } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
203 } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
204 && currentGeometryPoint.y() < horizontal) {
204 && currentGeometryPoint.y() < horizontal) {
205 currentSegmentPath = &linePathLeft;
205 currentSegmentPath = &linePathLeft;
206 } else if (currentAngle > 0.0 && currentAngle < 360.0) {
206 } else if (currentAngle > 0.0 && currentAngle < 360.0) {
207 currentSegmentPath = &linePath;
207 currentSegmentPath = &linePath;
208 } else {
208 } else {
209 currentSegmentPath = 0;
209 currentSegmentPath = 0;
210 }
210 }
211
211
212 if (currentSegmentPath) {
212 if (currentSegmentPath) {
213 if (previousSegmentPath != currentSegmentPath)
213 if (previousSegmentPath != currentSegmentPath)
214 currentSegmentPath->moveTo(centerPoint);
214 currentSegmentPath->moveTo(centerPoint);
215 if (!previousSegmentPath)
215 if (!previousSegmentPath)
216 fullPath.moveTo(centerPoint);
216 fullPath.moveTo(centerPoint);
217
217
218 currentSegmentPath->lineTo(currentGeometryPoint);
218 currentSegmentPath->lineTo(currentGeometryPoint);
219 if (pointOffGrid)
219 if (pointOffGrid)
220 fullPath.lineTo(intersectionPoint);
220 fullPath.lineTo(intersectionPoint);
221 else
221 else
222 fullPath.lineTo(currentGeometryPoint);
222 fullPath.lineTo(currentGeometryPoint);
223 }
223 }
224 } else {
224 } else {
225 if (previousAngle < 0.0 || currentAngle < 0.0
225 if (previousAngle < 0.0 || currentAngle < 0.0
226 || ((previousAngle <= 180.0 && currentAngle <= 180.0)
226 || ((previousAngle <= 180.0 && currentAngle <= 180.0)
227 && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
227 && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
228 || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
228 || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
229 currentSegmentPath = &linePathRight;
229 currentSegmentPath = &linePathRight;
230 } else if (previousAngle > 360.0 || currentAngle > 360.0
230 } else if (previousAngle > 360.0 || currentAngle > 360.0
231 || ((previousAngle > 180.0 && currentAngle > 180.0)
231 || ((previousAngle > 180.0 && currentAngle > 180.0)
232 && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
232 && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
233 || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
233 || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
234 currentSegmentPath = &linePathLeft;
234 currentSegmentPath = &linePathLeft;
235 } else {
235 } else {
236 currentSegmentPath = &linePath;
236 currentSegmentPath = &linePath;
237 }
237 }
238
238
239 if (currentSegmentPath != previousSegmentPath)
239 if (currentSegmentPath != previousSegmentPath)
240 currentSegmentPath->moveTo(previousGeometryPoint);
240 currentSegmentPath->moveTo(previousGeometryPoint);
241 if (previousPointWasOffGrid)
241 if (previousPointWasOffGrid)
242 fullPath.moveTo(intersectionPoint);
242 fullPath.moveTo(intersectionPoint);
243
243
244 if (pointOffGrid)
244 if (pointOffGrid)
245 fullPath.lineTo(intersectionPoint);
245 fullPath.lineTo(intersectionPoint);
246 else
246 else
247 fullPath.lineTo(currentGeometryPoint);
247 fullPath.lineTo(currentGeometryPoint);
248 currentSegmentPath->lineTo(currentGeometryPoint);
248 currentSegmentPath->lineTo(currentGeometryPoint);
249 }
249 }
250 } else {
250 } else {
251 currentSegmentPath = 0;
251 currentSegmentPath = 0;
252 }
252 }
253
253
254 previousPointWasOffGrid = pointOffGrid;
254 previousPointWasOffGrid = pointOffGrid;
255 if (m_pointsVisible && !pointOffGrid && currentSeriesPoint.y() >= minY) {
255 if (m_pointsVisible && !pointOffGrid && currentSeriesPoint.y() >= minY) {
256 linePath.addEllipse(points.at(i), size, size);
256 linePath.addEllipse(points.at(i), size, size);
257 fullPath.addEllipse(points.at(i), size, size);
257 fullPath.addEllipse(points.at(i), size, size);
258 linePath.moveTo(points.at(i));
258 linePath.moveTo(points.at(i));
259 fullPath.moveTo(points.at(i));
259 fullPath.moveTo(points.at(i));
260 }
260 }
261 previousSegmentPath = currentSegmentPath;
261 previousSegmentPath = currentSegmentPath;
262 previousGeometryPoint = currentGeometryPoint;
262 previousGeometryPoint = currentGeometryPoint;
263 }
263 }
264 m_linePathPolarRight = linePathRight;
264 m_linePathPolarRight = linePathRight;
265 m_linePathPolarLeft = linePathLeft;
265 m_linePathPolarLeft = linePathLeft;
266 // Note: This construction of m_fullpath is not perfect. The partial segments that are
266 // Note: This construction of m_fullpath is not perfect. The partial segments that are
267 // outside left/right clip regions at axis boundary still generate hover/click events,
267 // outside left/right clip regions at axis boundary still generate hover/click events,
268 // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
268 // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
269 } else { // not polar
269 } else { // not polar
270 linePath.moveTo(points.at(0));
270 linePath.moveTo(points.at(0));
271 if (m_pointsVisible) {
271 if (m_pointsVisible) {
272 int size = m_linePen.width();
272 int size = m_linePen.width();
273 linePath.addEllipse(points.at(0), size, size);
273 linePath.addEllipse(points.at(0), size, size);
274 linePath.moveTo(points.at(0));
274 linePath.moveTo(points.at(0));
275 for (int i = 1; i < points.size(); i++) {
275 for (int i = 1; i < points.size(); i++) {
276 linePath.lineTo(points.at(i));
276 linePath.lineTo(points.at(i));
277 linePath.addEllipse(points.at(i), size, size);
277 linePath.addEllipse(points.at(i), size, size);
278 linePath.moveTo(points.at(i));
278 linePath.moveTo(points.at(i));
279 }
279 }
280 } else {
280 } else {
281 for (int i = 1; i < points.size(); i++)
281 for (int i = 1; i < points.size(); i++)
282 linePath.lineTo(points.at(i));
282 linePath.lineTo(points.at(i));
283 }
283 }
284 fullPath = linePath;
284 fullPath = linePath;
285 }
285 }
286
286
287 QPainterPathStroker stroker;
287 QPainterPathStroker stroker;
288 // QPainter::drawLine does not respect join styles, for example BevelJoin becomes MiterJoin.
288 // QPainter::drawLine does not respect join styles, for example BevelJoin becomes MiterJoin.
289 // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
289 // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
290 // multiply line width with square root of two when defining shape and bounding rectangle.
290 // multiply line width with square root of two when defining shape and bounding rectangle.
291 stroker.setWidth(margin);
291 stroker.setWidth(margin);
292 stroker.setJoinStyle(Qt::MiterJoin);
292 stroker.setJoinStyle(Qt::MiterJoin);
293 stroker.setCapStyle(Qt::SquareCap);
293 stroker.setCapStyle(Qt::SquareCap);
294 stroker.setMiterLimit(m_linePen.miterLimit());
294 stroker.setMiterLimit(m_linePen.miterLimit());
295
295
296 QPainterPath checkShapePath = stroker.createStroke(fullPath);
296 QPainterPath checkShapePath = stroker.createStroke(fullPath);
297
297
298 // Only zoom in if the bounding rects of the paths fit inside int limits. QWidget::update() uses
298 // Only zoom in if the bounding rects of the paths fit inside int limits. QWidget::update() uses
299 // a region that has to be compatible with QRect.
299 // a region that has to be compatible with QRect.
300 if (checkShapePath.boundingRect().height() <= INT_MAX
300 if (checkShapePath.boundingRect().height() <= INT_MAX
301 && checkShapePath.boundingRect().width() <= INT_MAX
301 && checkShapePath.boundingRect().width() <= INT_MAX
302 && linePath.boundingRect().height() <= INT_MAX
302 && linePath.boundingRect().height() <= INT_MAX
303 && linePath.boundingRect().width() <= INT_MAX
303 && linePath.boundingRect().width() <= INT_MAX
304 && fullPath.boundingRect().height() <= INT_MAX
304 && fullPath.boundingRect().height() <= INT_MAX
305 && fullPath.boundingRect().width() <= INT_MAX) {
305 && fullPath.boundingRect().width() <= INT_MAX) {
306 prepareGeometryChange();
306 prepareGeometryChange();
307
307
308 m_linePath = linePath;
308 m_linePath = linePath;
309 m_fullPath = fullPath;
309 m_fullPath = fullPath;
310 m_shapePath = checkShapePath;
310 m_shapePath = checkShapePath;
311
311
312 m_rect = m_shapePath.boundingRect();
312 m_rect = m_shapePath.boundingRect();
313 } else {
313 } else {
314 update();
314 update();
315 }
315 }
316 }
316 }
317
317
318 void LineChartItem::handleUpdated()
318 void LineChartItem::handleUpdated()
319 {
319 {
320 // If points visibility has changed, a geometry update is needed.
320 // If points visibility has changed, a geometry update is needed.
321 // Also, if pen changes when points are visible, geometry update is needed.
321 // Also, if pen changes when points are visible, geometry update is needed.
322 bool doGeometryUpdate =
322 bool doGeometryUpdate =
323 (m_pointsVisible != m_series->pointsVisible())
323 (m_pointsVisible != m_series->pointsVisible())
324 || (m_series->pointsVisible() && (m_linePen != m_series->pen()));
324 || (m_series->pointsVisible() && (m_linePen != m_series->pen()));
325 setVisible(m_series->isVisible());
325 setVisible(m_series->isVisible());
326 setOpacity(m_series->opacity());
326 setOpacity(m_series->opacity());
327 m_pointsVisible = m_series->pointsVisible();
327 m_pointsVisible = m_series->pointsVisible();
328 m_linePen = m_series->pen();
328 m_linePen = m_series->pen();
329 m_pointLabelsFormat = m_series->pointLabelsFormat();
329 m_pointLabelsFormat = m_series->pointLabelsFormat();
330 m_pointLabelsVisible = m_series->pointLabelsVisible();
330 m_pointLabelsVisible = m_series->pointLabelsVisible();
331 m_pointLabelsFont = m_series->pointLabelsFont();
331 m_pointLabelsFont = m_series->pointLabelsFont();
332 m_pointLabelsColor = m_series->pointLabelsColor();
332 m_pointLabelsColor = m_series->pointLabelsColor();
333 if (doGeometryUpdate)
333 if (doGeometryUpdate)
334 updateGeometry();
334 updateGeometry();
335 update();
335 update();
336 }
336 }
337
337
338 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
338 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
339 {
339 {
340 Q_UNUSED(widget)
340 Q_UNUSED(widget)
341 Q_UNUSED(option)
341 Q_UNUSED(option)
342
342
343 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
343 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
344
344
345 painter->save();
345 painter->save();
346 painter->setPen(m_linePen);
346 painter->setPen(m_linePen);
347 bool alwaysUsePath = false;
347 bool alwaysUsePath = false;
348
348
349 if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
349 if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
350 qreal halfWidth = domain()->size().width() / 2.0;
350 qreal halfWidth = domain()->size().width() / 2.0;
351 QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
351 QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
352 QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
352 QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
353 QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
353 QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
354 QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
354 QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
355 QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
355 QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
356 painter->setClipRegion(clipRegionLeft);
356 painter->setClipRegion(clipRegionLeft);
357 painter->drawPath(m_linePathPolarLeft);
357 painter->drawPath(m_linePathPolarLeft);
358 painter->setClipRegion(clipRegionRight);
358 painter->setClipRegion(clipRegionRight);
359 painter->drawPath(m_linePathPolarRight);
359 painter->drawPath(m_linePathPolarRight);
360 painter->setClipRegion(fullPolarClipRegion);
360 painter->setClipRegion(fullPolarClipRegion);
361 alwaysUsePath = true; // required for proper clipping
361 alwaysUsePath = true; // required for proper clipping
362 } else {
362 } else {
363 painter->setClipRect(clipRect);
363 painter->setClipRect(clipRect);
364 }
364 }
365
365
366 reversePainter(painter, clipRect);
367
366 if (m_pointsVisible) {
368 if (m_pointsVisible) {
367 painter->setBrush(m_linePen.color());
369 painter->setBrush(m_linePen.color());
368 painter->drawPath(m_linePath);
370 painter->drawPath(m_linePath);
369 } else {
371 } else {
370 painter->setBrush(QBrush(Qt::NoBrush));
372 painter->setBrush(QBrush(Qt::NoBrush));
371 if (m_linePen.style() != Qt::SolidLine || alwaysUsePath) {
373 if (m_linePen.style() != Qt::SolidLine || alwaysUsePath) {
372 // If pen style is not solid line, always fall back to path painting
374 // If pen style is not solid line, always fall back to path painting
373 // to ensure proper continuity of the pattern
375 // to ensure proper continuity of the pattern
374 painter->drawPath(m_linePath);
376 painter->drawPath(m_linePath);
375 } else {
377 } else {
376 for (int i(1); i < m_points.size(); i++)
378 for (int i(1); i < m_points.size(); i++)
377 painter->drawLine(m_points.at(i - 1), m_points.at(i));
379 painter->drawLine(m_points.at(i - 1), m_points.at(i));
378 }
380 }
379 }
381 }
380
382
383 reversePainter(painter, clipRect);
384
381 if (m_pointLabelsVisible)
385 if (m_pointLabelsVisible)
382 m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
386 m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
383
387
384 painter->restore();
388 painter->restore();
385
389
386 }
390 }
387
391
388 void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
392 void LineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
389 {
393 {
390 emit XYChart::pressed(domain()->calculateDomainPoint(event->pos()));
394 emit XYChart::pressed(domain()->calculateDomainPoint(event->pos()));
391 m_lastMousePos = event->pos();
395 m_lastMousePos = event->pos();
392 m_mousePressed = true;
396 m_mousePressed = true;
393 QGraphicsItem::mousePressEvent(event);
397 QGraphicsItem::mousePressEvent(event);
394 }
398 }
395
399
396 void LineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
400 void LineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
397 {
401 {
398 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
402 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
399 // event->accept();
403 // event->accept();
400 QGraphicsItem::hoverEnterEvent(event);
404 QGraphicsItem::hoverEnterEvent(event);
401 }
405 }
402
406
403 void LineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
407 void LineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
404 {
408 {
405 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
409 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
406 // event->accept();
410 // event->accept();
407 QGraphicsItem::hoverEnterEvent(event);
411 QGraphicsItem::hoverEnterEvent(event);
408 }
412 }
409
413
410 void LineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
414 void LineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
411 {
415 {
412 emit XYChart::released(domain()->calculateDomainPoint(m_lastMousePos));
416 emit XYChart::released(domain()->calculateDomainPoint(m_lastMousePos));
413 if (m_mousePressed)
417 if (m_mousePressed)
414 emit XYChart::clicked(domain()->calculateDomainPoint(m_lastMousePos));
418 emit XYChart::clicked(domain()->calculateDomainPoint(m_lastMousePos));
415 m_mousePressed = false;
419 m_mousePressed = false;
416 QGraphicsItem::mouseReleaseEvent(event);
420 QGraphicsItem::mouseReleaseEvent(event);
417 }
421 }
418
422
419 void LineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
423 void LineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
420 {
424 {
421 emit XYChart::doubleClicked(domain()->calculateDomainPoint(m_lastMousePos));
425 emit XYChart::doubleClicked(domain()->calculateDomainPoint(m_lastMousePos));
422 QGraphicsItem::mouseDoubleClickEvent(event);
426 QGraphicsItem::mouseDoubleClickEvent(event);
423 }
427 }
424
428
425 #include "moc_linechartitem_p.cpp"
429 #include "moc_linechartitem_p.cpp"
426
430
427 QT_CHARTS_END_NAMESPACE
431 QT_CHARTS_END_NAMESPACE
@@ -1,326 +1,360
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <QtCharts/QAbstractSeries>
19 #include <QtCharts/QAbstractSeries>
20 #include <private/qabstractseries_p.h>
20 #include <private/qabstractseries_p.h>
21 #include <private/chartdataset_p.h>
21 #include <private/chartdataset_p.h>
22 #include <QtCharts/QChart>
22 #include <QtCharts/QChart>
23 #include <private/qchart_p.h>
23 #include <private/qchart_p.h>
24 #include <private/chartitem_p.h>
24 #include <private/chartitem_p.h>
25 #include <private/xydomain_p.h>
25 #include <private/xydomain_p.h>
26 #include <private/xlogydomain_p.h>
26 #include <private/xlogydomain_p.h>
27 #include <private/logxydomain_p.h>
27 #include <private/logxydomain_p.h>
28 #include <private/logxlogydomain_p.h>
28 #include <private/logxlogydomain_p.h>
29
29
30 QT_CHARTS_BEGIN_NAMESPACE
30 QT_CHARTS_BEGIN_NAMESPACE
31
31
32 /*!
32 /*!
33 \class QAbstractSeries
33 \class QAbstractSeries
34 \inmodule Qt Charts
34 \inmodule Qt Charts
35 \brief Base class for all Qt Chart series.
35 \brief Base class for all Qt Chart series.
36 \mainclass
36 \mainclass
37
37
38 Usually you use the series type specific inherited classes instead of the base class.
38 Usually you use the series type specific inherited classes instead of the base class.
39 \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries,
39 \sa QXYSeries, QLineSeries, QSplineSeries, QScatterSeries, QAreaSeries, QAbstractBarSeries, QStackedBarSeries,
40 QPercentBarSeries, QPieSeries
40 QPercentBarSeries, QPieSeries
41 */
41 */
42 /*!
42 /*!
43 \qmltype AbstractSeries
43 \qmltype AbstractSeries
44 \instantiates QAbstractSeries
44 \instantiates QAbstractSeries
45 \inqmlmodule QtCharts
45 \inqmlmodule QtCharts
46
46
47 \brief Base class for all Qt Chart series.
47 \brief Base class for all Qt Chart series.
48
48
49 AbstractSeries is the base class for all series.
49 AbstractSeries is the base class for all series.
50 The class cannot be instantiated by the user.
50 The class cannot be instantiated by the user.
51 */
51 */
52
52
53 /*!
53 /*!
54 \enum QAbstractSeries::SeriesType
54 \enum QAbstractSeries::SeriesType
55
55
56 The type of the series object.
56 The type of the series object.
57
57
58 \value SeriesTypeLine
58 \value SeriesTypeLine
59 \value SeriesTypeArea
59 \value SeriesTypeArea
60 \value SeriesTypeBar
60 \value SeriesTypeBar
61 \value SeriesTypeStackedBar
61 \value SeriesTypeStackedBar
62 \value SeriesTypePercentBar
62 \value SeriesTypePercentBar
63 \value SeriesTypePie
63 \value SeriesTypePie
64 \value SeriesTypeScatter
64 \value SeriesTypeScatter
65 \value SeriesTypeSpline
65 \value SeriesTypeSpline
66 \value SeriesTypeHorizontalBar
66 \value SeriesTypeHorizontalBar
67 \value SeriesTypeHorizontalStackedBar
67 \value SeriesTypeHorizontalStackedBar
68 \value SeriesTypeHorizontalPercentBar
68 \value SeriesTypeHorizontalPercentBar
69 \value SeriesTypeBoxPlot
69 \value SeriesTypeBoxPlot
70 */
70 */
71
71
72 /*!
72 /*!
73 \property QAbstractSeries::type
73 \property QAbstractSeries::type
74 The type of the series.
74 The type of the series.
75 */
75 */
76 /*!
76 /*!
77 \qmlproperty ChartView.SeriesType AbstractSeries::type
77 \qmlproperty ChartView.SeriesType AbstractSeries::type
78 The type of the series.
78 The type of the series.
79 */
79 */
80
80
81 /*!
81 /*!
82 \property QAbstractSeries::name
82 \property QAbstractSeries::name
83 \brief name of the series property. The name is shown in legend for series and supports html formatting.
83 \brief name of the series property. The name is shown in legend for series and supports html formatting.
84 */
84 */
85 /*!
85 /*!
86 \qmlproperty string AbstractSeries::name
86 \qmlproperty string AbstractSeries::name
87 Name of the series. The name is shown in legend for series and supports html formatting.
87 Name of the series. The name is shown in legend for series and supports html formatting.
88 */
88 */
89
89
90 /*!
90 /*!
91 \fn void QAbstractSeries::nameChanged()
91 \fn void QAbstractSeries::nameChanged()
92 This signal is emitted when the series name changes.
92 This signal is emitted when the series name changes.
93 */
93 */
94 /*!
94 /*!
95 \qmlsignal AbstractSeries::onNameChanged()
95 \qmlsignal AbstractSeries::onNameChanged()
96 This signal is emitted when the series name changes.
96 This signal is emitted when the series name changes.
97 */
97 */
98
98
99 /*!
99 /*!
100 \property QAbstractSeries::visible
100 \property QAbstractSeries::visible
101 \brief whether the series is visible or not; true by default.
101 \brief whether the series is visible or not; true by default.
102 */
102 */
103 /*!
103 /*!
104 \qmlproperty bool AbstractSeries::visible
104 \qmlproperty bool AbstractSeries::visible
105 Visibility of the series. True by default.
105 Visibility of the series. True by default.
106 */
106 */
107
107
108 /*!
108 /*!
109 \fn void QAbstractSeries::visibleChanged()
109 \fn void QAbstractSeries::visibleChanged()
110 Emitted when the series visibility changes.
110 Emitted when the series visibility changes.
111 */
111 */
112 /*!
112 /*!
113 \qmlsignal AbstractSeries::onVisibleChanged()
113 \qmlsignal AbstractSeries::onVisibleChanged()
114 Emitted when the series visibility changes.
114 Emitted when the series visibility changes.
115 */
115 */
116
116
117 /*!
117 /*!
118 \property QAbstractSeries::opacity
118 \property QAbstractSeries::opacity
119 \brief The opacity of the series.
119 \brief The opacity of the series.
120
120
121 By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).
121 By default the opacity is 1.0. The valid values range from 0.0 (transparent) to 1.0 (opaque).
122 */
122 */
123 /*!
123 /*!
124 \qmlproperty real AbstractSeries::opacity
124 \qmlproperty real AbstractSeries::opacity
125 The opacity of the series. By default the opacity is 1.0.
125 The opacity of the series. By default the opacity is 1.0.
126 The valid values range from 0.0 (transparent) to 1.0 (opaque).
126 The valid values range from 0.0 (transparent) to 1.0 (opaque).
127 */
127 */
128
128
129 /*!
129 /*!
130 \fn void QAbstractSeries::opacityChanged()
130 \fn void QAbstractSeries::opacityChanged()
131 Emitted when the opacity of the series changes.
131 Emitted when the opacity of the series changes.
132 */
132 */
133 /*!
133 /*!
134 \qmlsignal AbstractSeries::onOpacityChanged()
134 \qmlsignal AbstractSeries::onOpacityChanged()
135 Emitted when the opacity of the series changes.
135 Emitted when the opacity of the series changes.
136 */
136 */
137
137
138 /*!
138 /*!
139 \internal
139 \internal
140 \brief Constructs QAbstractSeries object with \a parent.
140 \brief Constructs QAbstractSeries object with \a parent.
141 */
141 */
142 QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
142 QAbstractSeries::QAbstractSeries(QAbstractSeriesPrivate &d, QObject *parent) :
143 QObject(parent),
143 QObject(parent),
144 d_ptr(&d)
144 d_ptr(&d)
145 {
145 {
146 }
146 }
147
147
148 /*!
148 /*!
149 \brief Virtual destructor for the chart series.
149 \brief Virtual destructor for the chart series.
150 */
150 */
151 QAbstractSeries::~QAbstractSeries()
151 QAbstractSeries::~QAbstractSeries()
152 {
152 {
153 if (d_ptr->m_chart)
153 if (d_ptr->m_chart)
154 qFatal("Series still bound to a chart when destroyed!");
154 qFatal("Series still bound to a chart when destroyed!");
155 }
155 }
156
156
157 void QAbstractSeries::setName(const QString &name)
157 void QAbstractSeries::setName(const QString &name)
158 {
158 {
159 if (name != d_ptr->m_name) {
159 if (name != d_ptr->m_name) {
160 d_ptr->m_name = name;
160 d_ptr->m_name = name;
161 emit nameChanged();
161 emit nameChanged();
162 }
162 }
163 }
163 }
164
164
165 QString QAbstractSeries::name() const
165 QString QAbstractSeries::name() const
166 {
166 {
167 return d_ptr->m_name;
167 return d_ptr->m_name;
168 }
168 }
169
169
170 void QAbstractSeries::setVisible(bool visible)
170 void QAbstractSeries::setVisible(bool visible)
171 {
171 {
172 if (visible != d_ptr->m_visible) {
172 if (visible != d_ptr->m_visible) {
173 d_ptr->m_visible = visible;
173 d_ptr->m_visible = visible;
174 emit visibleChanged();
174 emit visibleChanged();
175 }
175 }
176 }
176 }
177
177
178 bool QAbstractSeries::isVisible() const
178 bool QAbstractSeries::isVisible() const
179 {
179 {
180 return d_ptr->m_visible;
180 return d_ptr->m_visible;
181 }
181 }
182
182
183 qreal QAbstractSeries::opacity() const
183 qreal QAbstractSeries::opacity() const
184 {
184 {
185 return d_ptr->m_opacity;
185 return d_ptr->m_opacity;
186 }
186 }
187
187
188 void QAbstractSeries::setOpacity(qreal opacity)
188 void QAbstractSeries::setOpacity(qreal opacity)
189 {
189 {
190 if (opacity != d_ptr->m_opacity) {
190 if (opacity != d_ptr->m_opacity) {
191 d_ptr->m_opacity = opacity;
191 d_ptr->m_opacity = opacity;
192 emit opacityChanged();
192 emit opacityChanged();
193 }
193 }
194 }
194 }
195
195
196 /*!
196 /*!
197 \brief Returns the chart where series belongs to.
197 \brief Returns the chart where series belongs to.
198
198
199 Set automatically when the series is added to the chart
199 Set automatically when the series is added to the chart
200 and unset when the series is removed from the chart.
200 and unset when the series is removed from the chart.
201 */
201 */
202 QChart *QAbstractSeries::chart() const
202 QChart *QAbstractSeries::chart() const
203 {
203 {
204 return d_ptr->m_chart;
204 return d_ptr->m_chart;
205 }
205 }
206
206
207 /*!
207 /*!
208 \brief Sets the visibility of the series to true.
208 \brief Sets the visibility of the series to true.
209
209
210 \sa setVisible(), isVisible()
210 \sa setVisible(), isVisible()
211 */
211 */
212 void QAbstractSeries::show()
212 void QAbstractSeries::show()
213 {
213 {
214 setVisible(true);
214 setVisible(true);
215 }
215 }
216
216
217 /*!
217 /*!
218 \brief Sets the visibility of the series to false.
218 \brief Sets the visibility of the series to false.
219
219
220 \sa setVisible(), isVisible()
220 \sa setVisible(), isVisible()
221 */
221 */
222 void QAbstractSeries::hide()
222 void QAbstractSeries::hide()
223 {
223 {
224 setVisible(false);
224 setVisible(false);
225 }
225 }
226
226
227 /*!
227 /*!
228 Attach \a axis to the series.
228 Attach \a axis to the series.
229 \return true if the axis was attached successfully, false otherwise.
229 \return true if the axis was attached successfully, false otherwise.
230 \note If multiple axes of same orientation are attached to same series,
230 \note If multiple axes of same orientation are attached to same series,
231 they will have same min/max ranges.
231 they will have same min/max ranges.
232 \sa QChart::addAxis(), QChart::createDefaultAxes()
232 \sa QChart::addAxis(), QChart::createDefaultAxes()
233 */
233 */
234 bool QAbstractSeries::attachAxis(QAbstractAxis* axis)
234 bool QAbstractSeries::attachAxis(QAbstractAxis* axis)
235 {
235 {
236 if(d_ptr->m_chart) {
236 if(d_ptr->m_chart) {
237 return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis);
237 return d_ptr->m_chart->d_ptr->m_dataset->attachAxis(this, axis);
238 } else {
238 } else {
239 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
239 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
240 return false;
240 return false;
241 }
241 }
242 }
242 }
243
243
244 /*!
244 /*!
245 Detach \a axis from the series.
245 Detach \a axis from the series.
246 \return true if the axis was detached successfully, false otherwise.
246 \return true if the axis was detached successfully, false otherwise.
247 \sa QChart::removeAxis()
247 \sa QChart::removeAxis()
248 */
248 */
249 bool QAbstractSeries::detachAxis(QAbstractAxis* axis)
249 bool QAbstractSeries::detachAxis(QAbstractAxis* axis)
250 {
250 {
251 if(d_ptr->m_chart) {
251 if(d_ptr->m_chart) {
252 return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis);
252 return d_ptr->m_chart->d_ptr->m_dataset->detachAxis(this, axis);
253 }
253 }
254 else {
254 else {
255 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
255 qWarning()<<"Series not in the chart. Please addSeries to chart first.";
256 return false;
256 return false;
257 }
257 }
258 }
258 }
259
259
260 /*!
260 /*!
261 Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except
261 Returns the list of axes attached to the series. Usually there is an x-axis and a y-axis attached to a series, except
262 in case of a QPieSeries, which does not have any axes attached.
262 in case of a QPieSeries, which does not have any axes attached.
263 \sa attachAxis(), detachAxis()
263 \sa attachAxis(), detachAxis()
264 */
264 */
265 QList<QAbstractAxis*> QAbstractSeries::attachedAxes()
265 QList<QAbstractAxis*> QAbstractSeries::attachedAxes()
266 {
266 {
267 return d_ptr->m_axes;
267 return d_ptr->m_axes;
268 }
268 }
269
269
270 ///////////////////////////////////////////////////////////////////////////////////////////////////
270 ///////////////////////////////////////////////////////////////////////////////////////////////////
271
271
272 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q)
272 QAbstractSeriesPrivate::QAbstractSeriesPrivate(QAbstractSeries *q)
273 : q_ptr(q),
273 : q_ptr(q),
274 m_chart(0),
274 m_chart(0),
275 m_item(0),
275 m_item(0),
276 m_domain(new XYDomain()),
276 m_domain(new XYDomain()),
277 m_visible(true),
277 m_visible(true),
278 m_opacity(1.0)
278 m_opacity(1.0)
279 {
279 {
280 }
280 }
281
281
282 QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
282 QAbstractSeriesPrivate::~QAbstractSeriesPrivate()
283 {
283 {
284 }
284 }
285
285
286 void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain)
286 void QAbstractSeriesPrivate::setDomain(AbstractDomain* domain)
287 {
287 {
288 Q_ASSERT(domain);
288 Q_ASSERT(domain);
289 if(m_domain.data()!=domain) {
289 if(m_domain.data()!=domain) {
290 if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated()));
290 if(!m_item.isNull()) QObject::disconnect(m_domain.data(), SIGNAL(updated()), m_item.data(), SLOT(handleDomainUpdated()));
291 m_domain.reset(domain);
291 m_domain.reset(domain);
292 if(!m_item.isNull()) {
292 if(!m_item.isNull()) {
293 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
293 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
294 m_item->handleDomainUpdated();
294 m_item->handleDomainUpdated();
295 }
295 }
296 }
296 }
297 }
297 }
298
298
299 void QAbstractSeriesPrivate::setPresenter(ChartPresenter *presenter)
299 void QAbstractSeriesPrivate::setPresenter(ChartPresenter *presenter)
300 {
300 {
301 m_presenter = presenter;
301 m_presenter = presenter;
302 }
302 }
303
303
304 ChartPresenter *QAbstractSeriesPrivate::presenter() const
304 ChartPresenter *QAbstractSeriesPrivate::presenter() const
305 {
305 {
306 return m_presenter;
306 return m_presenter;
307 }
307 }
308
308
309 void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
309 void QAbstractSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
310 {
310 {
311 Q_ASSERT(!m_item.isNull());
311 Q_ASSERT(!m_item.isNull());
312 Q_UNUSED(parent);
312 Q_UNUSED(parent);
313 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
313 QObject::connect(m_domain.data(), SIGNAL(updated()),m_item.data(), SLOT(handleDomainUpdated()));
314 }
314 }
315
315
316 void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
316 void QAbstractSeriesPrivate::initializeAnimations(QChart::AnimationOptions options)
317 {
317 {
318 Q_UNUSED(options);
318 Q_UNUSED(options);
319 }
319 }
320
320
321 bool QAbstractSeriesPrivate::reverseXAxis()
322 {
323 bool reverseXAxis = false;
324 if (m_axes.size() != 0 && !(m_chart->chartType() == QChart::ChartTypePolar)) {
325 int i = 0;
326 while (i < m_axes.size()) {
327 if (m_axes.at(i)->orientation() == Qt::Horizontal && m_axes.at(i)->isReverse()) {
328 reverseXAxis = true;
329 break;
330 }
331 i++;
332 }
333 }
334
335 return reverseXAxis;
336 }
337
338 bool QAbstractSeriesPrivate::reverseYAxis()
339 {
340 bool reverseYAxis = false;
341 if (m_axes.size() != 0 && !(m_chart->chartType() == QChart::ChartTypePolar)) {
342 int i = 0;
343 while (i < m_axes.size()) {
344 if (m_axes.at(i)->orientation() == Qt::Vertical && m_axes.at(i)->isReverse()) {
345 reverseYAxis = true;
346 break;
347 }
348 i++;
349 }
350 }
351
352 return reverseYAxis;
353 }
354
321 #include "moc_qabstractseries.cpp"
355 #include "moc_qabstractseries.cpp"
322 #include "moc_qabstractseries_p.cpp"
356 #include "moc_qabstractseries_p.cpp"
323
357
324 QT_CHARTS_END_NAMESPACE
358 QT_CHARTS_END_NAMESPACE
325
359
326
360
@@ -1,105 +1,108
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 // W A R N I N G
19 // W A R N I N G
20 // -------------
20 // -------------
21 //
21 //
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
22 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
23 // implementation detail. This header file may change from version to
23 // implementation detail. This header file may change from version to
24 // version without notice, or even be removed.
24 // version without notice, or even be removed.
25 //
25 //
26 // We mean it.
26 // We mean it.
27
27
28 #ifndef QABSTRACTSERIES_P_H
28 #ifndef QABSTRACTSERIES_P_H
29 #define QABSTRACTSERIES_P_H
29 #define QABSTRACTSERIES_P_H
30
30
31 #include <QtCharts/QAbstractSeries>
31 #include <QtCharts/QAbstractSeries>
32 #include <QtCharts/QChart>
32 #include <QtCharts/QChart>
33 #include <private/abstractdomain_p.h>
33 #include <private/abstractdomain_p.h>
34
34
35 QT_BEGIN_NAMESPACE
35 QT_BEGIN_NAMESPACE
36 class QGraphicsItem;
36 class QGraphicsItem;
37 QT_END_NAMESPACE
37 QT_END_NAMESPACE
38
38
39 QT_CHARTS_BEGIN_NAMESPACE
39 QT_CHARTS_BEGIN_NAMESPACE
40
40
41 class ChartPresenter;
41 class ChartPresenter;
42 class ChartElement;
42 class ChartElement;
43 class LegendMarker;
43 class LegendMarker;
44 class QLegend;
44 class QLegend;
45 class ChartDataSet;
45 class ChartDataSet;
46 class QAbstractAxis;
46 class QAbstractAxis;
47 class QLegendMarker;
47 class QLegendMarker;
48 class ChartTheme;
48 class ChartTheme;
49 class ChartAnimation;
49 class ChartAnimation;
50 class ChartItem;
50 class ChartItem;
51 class BoxPlotChartItem;
51 class BoxPlotChartItem;
52
52
53 class QAbstractSeriesPrivate : public QObject
53 class QAbstractSeriesPrivate : public QObject
54 {
54 {
55 Q_OBJECT
55 Q_OBJECT
56 public:
56 public:
57 QAbstractSeriesPrivate(QAbstractSeries *q);
57 QAbstractSeriesPrivate(QAbstractSeries *q);
58 ~QAbstractSeriesPrivate();
58 ~QAbstractSeriesPrivate();
59
59
60 virtual void initializeDomain() = 0;
60 virtual void initializeDomain() = 0;
61 virtual void initializeAxes() = 0;
61 virtual void initializeAxes() = 0;
62 virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
62 virtual void initializeTheme(int index, ChartTheme* theme, bool forced = false) = 0;
63 virtual void initializeGraphics(QGraphicsItem* parent) = 0;
63 virtual void initializeGraphics(QGraphicsItem* parent) = 0;
64 virtual void initializeAnimations(QChart::AnimationOptions options) = 0;
64 virtual void initializeAnimations(QChart::AnimationOptions options) = 0;
65
65
66 virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
66 virtual QList<QLegendMarker*> createLegendMarkers(QLegend* legend) = 0;
67
67
68 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
68 virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation) const = 0;
69 virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
69 virtual QAbstractAxis* createDefaultAxis(Qt::Orientation) const = 0;
70
70
71 ChartItem* chartItem() { return m_item.data(); }
71 ChartItem* chartItem() { return m_item.data(); }
72
72
73 virtual void setDomain(AbstractDomain* domain);
73 virtual void setDomain(AbstractDomain* domain);
74 AbstractDomain* domain() { return m_domain.data(); }
74 AbstractDomain* domain() { return m_domain.data(); }
75
75
76 virtual void setPresenter(ChartPresenter *presenter);
76 virtual void setPresenter(ChartPresenter *presenter);
77 ChartPresenter *presenter() const;
77 ChartPresenter *presenter() const;
78
78
79 QChart* chart() { return m_chart; }
79 QChart* chart() { return m_chart; }
80 bool reverseXAxis();
81 bool reverseYAxis();
80
82
81 Q_SIGNALS:
83 Q_SIGNALS:
82 void countChanged();
84 void countChanged();
83
85
84 protected:
86 protected:
85 QAbstractSeries *q_ptr;
87 QAbstractSeries *q_ptr;
86 QChart *m_chart;
88 QChart *m_chart;
87 QScopedPointer<ChartItem> m_item;
89 QScopedPointer<ChartItem> m_item;
88 QList<QAbstractAxis*> m_axes;
90 QList<QAbstractAxis*> m_axes;
91
89 private:
92 private:
90 QScopedPointer<AbstractDomain> m_domain;
93 QScopedPointer<AbstractDomain> m_domain;
91 QString m_name;
94 QString m_name;
92 bool m_visible;
95 bool m_visible;
93 qreal m_opacity;
96 qreal m_opacity;
94 ChartPresenter *m_presenter;
97 ChartPresenter *m_presenter;
95
98
96 friend class QAbstractSeries;
99 friend class QAbstractSeries;
97 friend class ChartDataSet;
100 friend class ChartDataSet;
98 friend class ChartPresenter;
101 friend class ChartPresenter;
99 friend class QLegendPrivate;
102 friend class QLegendPrivate;
100 friend class BoxPlotChartItem;
103 friend class BoxPlotChartItem;
101 };
104 };
102
105
103 QT_CHARTS_END_NAMESPACE
106 QT_CHARTS_END_NAMESPACE
104
107
105 #endif
108 #endif
@@ -1,251 +1,261
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/scatterchartitem_p.h>
19 #include <private/scatterchartitem_p.h>
20 #include <QtCharts/QScatterSeries>
20 #include <QtCharts/QScatterSeries>
21 #include <private/qscatterseries_p.h>
21 #include <private/qscatterseries_p.h>
22 #include <private/chartpresenter_p.h>
22 #include <private/chartpresenter_p.h>
23 #include <private/abstractdomain_p.h>
23 #include <private/abstractdomain_p.h>
24 #include <QtCharts/QChart>
24 #include <QtCharts/QChart>
25 #include <QtGui/QPainter>
25 #include <QtGui/QPainter>
26 #include <QtWidgets/QGraphicsScene>
26 #include <QtWidgets/QGraphicsScene>
27 #include <QtCore/QDebug>
27 #include <QtCore/QDebug>
28 #include <QtWidgets/QGraphicsSceneMouseEvent>
28 #include <QtWidgets/QGraphicsSceneMouseEvent>
29
29
30 QT_CHARTS_BEGIN_NAMESPACE
30 QT_CHARTS_BEGIN_NAMESPACE
31
31
32 ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item)
32 ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item)
33 : XYChart(series,item),
33 : XYChart(series,item),
34 m_series(series),
34 m_series(series),
35 m_items(this),
35 m_items(this),
36 m_visible(true),
36 m_visible(true),
37 m_shape(QScatterSeries::MarkerShapeRectangle),
37 m_shape(QScatterSeries::MarkerShapeRectangle),
38 m_size(15),
38 m_size(15),
39 m_pointLabelsVisible(false),
39 m_pointLabelsVisible(false),
40 m_pointLabelsFormat(series->pointLabelsFormat()),
40 m_pointLabelsFormat(series->pointLabelsFormat()),
41 m_pointLabelsFont(series->pointLabelsFont()),
41 m_pointLabelsFont(series->pointLabelsFont()),
42 m_pointLabelsColor(series->pointLabelsColor()),
42 m_pointLabelsColor(series->pointLabelsColor()),
43 m_mousePressed(false)
43 m_mousePressed(false)
44 {
44 {
45 QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
45 QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
46 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
46 QObject::connect(m_series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
47 QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
47 QObject::connect(m_series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
48 QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
48 QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
49 this, SLOT(handleUpdated()));
49 this, SLOT(handleUpdated()));
50 QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
50 QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
51 this, SLOT(handleUpdated()));
51 this, SLOT(handleUpdated()));
52 QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
52 QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
53 QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
53 QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
54
54
55 setZValue(ChartPresenter::ScatterSeriesZValue);
55 setZValue(ChartPresenter::ScatterSeriesZValue);
56 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
56 setFlags(QGraphicsItem::ItemClipsChildrenToShape);
57
57
58 handleUpdated();
58 handleUpdated();
59
59
60 m_items.setHandlesChildEvents(false);
60 m_items.setHandlesChildEvents(false);
61 }
61 }
62
62
63 QRectF ScatterChartItem::boundingRect() const
63 QRectF ScatterChartItem::boundingRect() const
64 {
64 {
65 return m_rect;
65 return m_rect;
66 }
66 }
67
67
68 void ScatterChartItem::createPoints(int count)
68 void ScatterChartItem::createPoints(int count)
69 {
69 {
70 for (int i = 0; i < count; ++i) {
70 for (int i = 0; i < count; ++i) {
71
71
72 QGraphicsItem *item = 0;
72 QGraphicsItem *item = 0;
73
73
74 switch (m_shape) {
74 switch (m_shape) {
75 case QScatterSeries::MarkerShapeCircle: {
75 case QScatterSeries::MarkerShapeCircle: {
76 item = new CircleMarker(0, 0, m_size, m_size, this);
76 item = new CircleMarker(0, 0, m_size, m_size, this);
77 const QRectF &rect = item->boundingRect();
77 const QRectF &rect = item->boundingRect();
78 item->setPos(-rect.width() / 2, -rect.height() / 2);
78 item->setPos(-rect.width() / 2, -rect.height() / 2);
79 break;
79 break;
80 }
80 }
81 case QScatterSeries::MarkerShapeRectangle:
81 case QScatterSeries::MarkerShapeRectangle:
82 item = new RectangleMarker(0, 0, m_size, m_size, this);
82 item = new RectangleMarker(0, 0, m_size, m_size, this);
83 item->setPos(-m_size / 2, -m_size / 2);
83 item->setPos(-m_size / 2, -m_size / 2);
84 break;
84 break;
85 default:
85 default:
86 qWarning() << "Unsupported marker type";
86 qWarning() << "Unsupported marker type";
87 break;
87 break;
88 }
88 }
89 m_items.addToGroup(item);
89 m_items.addToGroup(item);
90 }
90 }
91 }
91 }
92
92
93 void ScatterChartItem::deletePoints(int count)
93 void ScatterChartItem::deletePoints(int count)
94 {
94 {
95 QList<QGraphicsItem *> items = m_items.childItems();
95 QList<QGraphicsItem *> items = m_items.childItems();
96
96
97 for (int i = 0; i < count; ++i) {
97 for (int i = 0; i < count; ++i) {
98 QGraphicsItem *item = items.takeLast();
98 QGraphicsItem *item = items.takeLast();
99 m_markerMap.remove(item);
99 m_markerMap.remove(item);
100 delete(item);
100 delete(item);
101 }
101 }
102 }
102 }
103
103
104 void ScatterChartItem::markerSelected(QGraphicsItem *marker)
104 void ScatterChartItem::markerSelected(QGraphicsItem *marker)
105 {
105 {
106 emit XYChart::clicked(m_markerMap[marker]);
106 emit XYChart::clicked(m_markerMap[marker]);
107 }
107 }
108
108
109 void ScatterChartItem::markerHovered(QGraphicsItem *marker, bool state)
109 void ScatterChartItem::markerHovered(QGraphicsItem *marker, bool state)
110 {
110 {
111 emit XYChart::hovered(m_markerMap[marker], state);
111 emit XYChart::hovered(m_markerMap[marker], state);
112 }
112 }
113
113
114 void ScatterChartItem::markerPressed(QGraphicsItem *marker)
114 void ScatterChartItem::markerPressed(QGraphicsItem *marker)
115 {
115 {
116 emit XYChart::pressed(m_markerMap[marker]);
116 emit XYChart::pressed(m_markerMap[marker]);
117 }
117 }
118
118
119 void ScatterChartItem::markerReleased(QGraphicsItem *marker)
119 void ScatterChartItem::markerReleased(QGraphicsItem *marker)
120 {
120 {
121 emit XYChart::released(m_markerMap[marker]);
121 emit XYChart::released(m_markerMap[marker]);
122 }
122 }
123
123
124 void ScatterChartItem::markerDoubleClicked(QGraphicsItem *marker)
124 void ScatterChartItem::markerDoubleClicked(QGraphicsItem *marker)
125 {
125 {
126 emit XYChart::doubleClicked(m_markerMap[marker]);
126 emit XYChart::doubleClicked(m_markerMap[marker]);
127 }
127 }
128
128
129 void ScatterChartItem::updateGeometry()
129 void ScatterChartItem::updateGeometry()
130 {
130 {
131
131
132 const QVector<QPointF>& points = geometryPoints();
132 const QVector<QPointF>& points = geometryPoints();
133
133
134 if (points.size() == 0) {
134 if (points.size() == 0) {
135 deletePoints(m_items.childItems().count());
135 deletePoints(m_items.childItems().count());
136 return;
136 return;
137 }
137 }
138
138
139 int diff = m_items.childItems().size() - points.size();
139 int diff = m_items.childItems().size() - points.size();
140
140
141 if (diff > 0)
141 if (diff > 0)
142 deletePoints(diff);
142 deletePoints(diff);
143 else if (diff < 0)
143 else if (diff < 0)
144 createPoints(-diff);
144 createPoints(-diff);
145
145
146 if (diff != 0)
146 if (diff != 0)
147 handleUpdated();
147 handleUpdated();
148
148
149 QList<QGraphicsItem *> items = m_items.childItems();
149 QList<QGraphicsItem *> items = m_items.childItems();
150
150
151 QRectF clipRect(QPointF(0,0),domain()->size());
151 QRectF clipRect(QPointF(0,0),domain()->size());
152
152
153 // Only zoom in if the clipRect fits inside int limits. QWidget::update() uses
153 // Only zoom in if the clipRect fits inside int limits. QWidget::update() uses
154 // a region that has to be compatible with QRect.
154 // a region that has to be compatible with QRect.
155 if (clipRect.height() <= INT_MAX
155 if (clipRect.height() <= INT_MAX
156 && clipRect.width() <= INT_MAX) {
156 && clipRect.width() <= INT_MAX) {
157 QVector<bool> offGridStatus = offGridStatusVector();
157 QVector<bool> offGridStatus = offGridStatusVector();
158 const int seriesLastIndex = m_series->count() - 1;
158 const int seriesLastIndex = m_series->count() - 1;
159
159
160 for (int i = 0; i < points.size(); i++) {
160 for (int i = 0; i < points.size(); i++) {
161 QGraphicsItem *item = items.at(i);
161 QGraphicsItem *item = items.at(i);
162 const QPointF &point = points.at(i);
162 const QPointF &point = points.at(i);
163 const QRectF &rect = item->boundingRect();
163 const QRectF &rect = item->boundingRect();
164 // During remove animation series may have different number of points,
164 // During remove animation series may have different number of points,
165 // so ensure we don't go over the index. Animation handling itself ensures that
165 // so ensure we don't go over the index. Animation handling itself ensures that
166 // if there is actually no points in the series, then it won't generate a fake point,
166 // if there is actually no points in the series, then it won't generate a fake point,
167 // so we can be assured there is always at least one point in m_series here.
167 // so we can be assured there is always at least one point in m_series here.
168 // Note that marker map values can be technically incorrect during the animation,
168 // Note that marker map values can be technically incorrect during the animation,
169 // if it was caused by an insert, but this shouldn't be a problem as the points are
169 // if it was caused by an insert, but this shouldn't be a problem as the points are
170 // fake anyway. After remove animation stops, geometry is updated to correct one.
170 // fake anyway. After remove animation stops, geometry is updated to correct one.
171 m_markerMap[item] = m_series->at(qMin(seriesLastIndex, i));
171 m_markerMap[item] = m_series->at(qMin(seriesLastIndex, i));
172 item->setPos(point.x() - rect.width() / 2, point.y() - rect.height() / 2);
172 QPointF position;
173 if (seriesPrivate()->reverseXAxis())
174 position.setX(domain()->size().width() - point.x() - rect.width() / 2);
175 else
176 position.setX(point.x() - rect.width() / 2);
177 if (seriesPrivate()->reverseYAxis())
178 position.setY(domain()->size().height() - point.y() - rect.height() / 2);
179 else
180 position.setY(point.y() - rect.height() / 2);
181 item->setPos(position);
182
173
183
174 if (!m_visible || offGridStatus.at(i))
184 if (!m_visible || offGridStatus.at(i))
175 item->setVisible(false);
185 item->setVisible(false);
176 else
186 else
177 item->setVisible(true);
187 item->setVisible(true);
178 }
188 }
179
189
180 prepareGeometryChange();
190 prepareGeometryChange();
181 m_rect = clipRect;
191 m_rect = clipRect;
182 }
192 }
183 }
193 }
184
194
185 void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
195 void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
186 {
196 {
187 Q_UNUSED(option)
197 Q_UNUSED(option)
188 Q_UNUSED(widget)
198 Q_UNUSED(widget)
189
199
190 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
200 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
191
201
192 painter->save();
202 painter->save();
193 painter->setClipRect(clipRect);
203 painter->setClipRect(clipRect);
194
204
195 if (m_pointLabelsVisible) {
205 if (m_pointLabelsVisible) {
196 m_series->d_func()->drawSeriesPointLabels(painter, m_points,
206 m_series->d_func()->drawSeriesPointLabels(painter, m_points,
197 m_series->markerSize() / 2
207 m_series->markerSize() / 2
198 + m_series->pen().width());
208 + m_series->pen().width());
199 }
209 }
200
210
201 painter->restore();
211 painter->restore();
202 }
212 }
203
213
204 void ScatterChartItem::setPen(const QPen &pen)
214 void ScatterChartItem::setPen(const QPen &pen)
205 {
215 {
206 foreach (QGraphicsItem *item , m_items.childItems())
216 foreach (QGraphicsItem *item , m_items.childItems())
207 static_cast<QAbstractGraphicsShapeItem*>(item)->setPen(pen);
217 static_cast<QAbstractGraphicsShapeItem*>(item)->setPen(pen);
208 }
218 }
209
219
210 void ScatterChartItem::setBrush(const QBrush &brush)
220 void ScatterChartItem::setBrush(const QBrush &brush)
211 {
221 {
212 foreach (QGraphicsItem *item , m_items.childItems())
222 foreach (QGraphicsItem *item , m_items.childItems())
213 static_cast<QAbstractGraphicsShapeItem*>(item)->setBrush(brush);
223 static_cast<QAbstractGraphicsShapeItem*>(item)->setBrush(brush);
214 }
224 }
215
225
216 void ScatterChartItem::handleUpdated()
226 void ScatterChartItem::handleUpdated()
217 {
227 {
218 int count = m_items.childItems().count();
228 int count = m_items.childItems().count();
219
229
220 if (count == 0)
230 if (count == 0)
221 return;
231 return;
222
232
223 bool recreate = m_visible != m_series->isVisible()
233 bool recreate = m_visible != m_series->isVisible()
224 || m_size != m_series->markerSize()
234 || m_size != m_series->markerSize()
225 || m_shape != m_series->markerShape();
235 || m_shape != m_series->markerShape();
226
236
227 m_visible = m_series->isVisible();
237 m_visible = m_series->isVisible();
228 m_size = m_series->markerSize();
238 m_size = m_series->markerSize();
229 m_shape = m_series->markerShape();
239 m_shape = m_series->markerShape();
230 setOpacity(m_series->opacity());
240 setOpacity(m_series->opacity());
231 m_pointLabelsFormat = m_series->pointLabelsFormat();
241 m_pointLabelsFormat = m_series->pointLabelsFormat();
232 m_pointLabelsVisible = m_series->pointLabelsVisible();
242 m_pointLabelsVisible = m_series->pointLabelsVisible();
233 m_pointLabelsFont = m_series->pointLabelsFont();
243 m_pointLabelsFont = m_series->pointLabelsFont();
234 m_pointLabelsColor = m_series->pointLabelsColor();
244 m_pointLabelsColor = m_series->pointLabelsColor();
235
245
236 if (recreate) {
246 if (recreate) {
237 deletePoints(count);
247 deletePoints(count);
238 createPoints(count);
248 createPoints(count);
239
249
240 // Updating geometry is now safe, because it won't call handleUpdated unless it creates/deletes points
250 // Updating geometry is now safe, because it won't call handleUpdated unless it creates/deletes points
241 updateGeometry();
251 updateGeometry();
242 }
252 }
243
253
244 setPen(m_series->pen());
254 setPen(m_series->pen());
245 setBrush(m_series->brush());
255 setBrush(m_series->brush());
246 update();
256 update();
247 }
257 }
248
258
249 #include "moc_scatterchartitem_p.cpp"
259 #include "moc_scatterchartitem_p.cpp"
250
260
251 QT_CHARTS_END_NAMESPACE
261 QT_CHARTS_END_NAMESPACE
@@ -1,502 +1,506
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <private/splinechartitem_p.h>
19 #include <private/splinechartitem_p.h>
20 #include <private/qsplineseries_p.h>
20 #include <private/qsplineseries_p.h>
21 #include <private/chartpresenter_p.h>
21 #include <private/chartpresenter_p.h>
22 #include <private/splineanimation_p.h>
22 #include <private/splineanimation_p.h>
23 #include <private/polardomain_p.h>
23 #include <private/polardomain_p.h>
24 #include <QtGui/QPainter>
24 #include <QtGui/QPainter>
25 #include <QtWidgets/QGraphicsSceneMouseEvent>
25 #include <QtWidgets/QGraphicsSceneMouseEvent>
26
26
27 QT_CHARTS_BEGIN_NAMESPACE
27 QT_CHARTS_BEGIN_NAMESPACE
28
28
29 SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item)
29 SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item)
30 : XYChart(series,item),
30 : XYChart(series,item),
31 m_series(series),
31 m_series(series),
32 m_pointsVisible(false),
32 m_pointsVisible(false),
33 m_animation(0),
33 m_animation(0),
34 m_pointLabelsVisible(false),
34 m_pointLabelsVisible(false),
35 m_pointLabelsFormat(series->pointLabelsFormat()),
35 m_pointLabelsFormat(series->pointLabelsFormat()),
36 m_pointLabelsFont(series->pointLabelsFont()),
36 m_pointLabelsFont(series->pointLabelsFont()),
37 m_pointLabelsColor(series->pointLabelsColor()),
37 m_pointLabelsColor(series->pointLabelsColor()),
38 m_mousePressed(false)
38 m_mousePressed(false)
39 {
39 {
40 setAcceptHoverEvents(true);
40 setAcceptHoverEvents(true);
41 setFlag(QGraphicsItem::ItemIsSelectable);
41 setFlag(QGraphicsItem::ItemIsSelectable);
42 setZValue(ChartPresenter::SplineChartZValue);
42 setZValue(ChartPresenter::SplineChartZValue);
43 QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
43 QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated()));
44 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
44 QObject::connect(series, SIGNAL(visibleChanged()), this, SLOT(handleUpdated()));
45 QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
45 QObject::connect(series, SIGNAL(opacityChanged()), this, SLOT(handleUpdated()));
46 QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
46 QObject::connect(series, SIGNAL(pointLabelsFormatChanged(QString)),
47 this, SLOT(handleUpdated()));
47 this, SLOT(handleUpdated()));
48 QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
48 QObject::connect(series, SIGNAL(pointLabelsVisibilityChanged(bool)),
49 this, SLOT(handleUpdated()));
49 this, SLOT(handleUpdated()));
50 QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
50 QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated()));
51 QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
51 QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated()));
52 handleUpdated();
52 handleUpdated();
53 }
53 }
54
54
55 QRectF SplineChartItem::boundingRect() const
55 QRectF SplineChartItem::boundingRect() const
56 {
56 {
57 return m_rect;
57 return m_rect;
58 }
58 }
59
59
60 QPainterPath SplineChartItem::shape() const
60 QPainterPath SplineChartItem::shape() const
61 {
61 {
62 return m_fullPath;
62 return m_fullPath;
63 }
63 }
64
64
65 void SplineChartItem::setAnimation(SplineAnimation *animation)
65 void SplineChartItem::setAnimation(SplineAnimation *animation)
66 {
66 {
67 m_animation = animation;
67 m_animation = animation;
68 XYChart::setAnimation(animation);
68 XYChart::setAnimation(animation);
69 }
69 }
70
70
71 ChartAnimation *SplineChartItem::animation() const
71 ChartAnimation *SplineChartItem::animation() const
72 {
72 {
73 return m_animation;
73 return m_animation;
74 }
74 }
75
75
76 void SplineChartItem::setControlGeometryPoints(QVector<QPointF>& points)
76 void SplineChartItem::setControlGeometryPoints(QVector<QPointF>& points)
77 {
77 {
78 m_controlPoints = points;
78 m_controlPoints = points;
79 }
79 }
80
80
81 QVector<QPointF> SplineChartItem::controlGeometryPoints() const
81 QVector<QPointF> SplineChartItem::controlGeometryPoints() const
82 {
82 {
83 return m_controlPoints;
83 return m_controlPoints;
84 }
84 }
85
85
86 void SplineChartItem::updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index)
86 void SplineChartItem::updateChart(QVector<QPointF> &oldPoints, QVector<QPointF> &newPoints, int index)
87 {
87 {
88 QVector<QPointF> controlPoints;
88 QVector<QPointF> controlPoints;
89 if (newPoints.count() >= 2)
89 if (newPoints.count() >= 2)
90 controlPoints = calculateControlPoints(newPoints);
90 controlPoints = calculateControlPoints(newPoints);
91
91
92 if (m_animation)
92 if (m_animation)
93 m_animation->setup(oldPoints, newPoints, m_controlPoints, controlPoints, index);
93 m_animation->setup(oldPoints, newPoints, m_controlPoints, controlPoints, index);
94
94
95 m_points = newPoints;
95 m_points = newPoints;
96 m_controlPoints = controlPoints;
96 m_controlPoints = controlPoints;
97 setDirty(false);
97 setDirty(false);
98
98
99 if (m_animation)
99 if (m_animation)
100 presenter()->startAnimation(m_animation);
100 presenter()->startAnimation(m_animation);
101 else
101 else
102 updateGeometry();
102 updateGeometry();
103 }
103 }
104
104
105 void SplineChartItem::updateGeometry()
105 void SplineChartItem::updateGeometry()
106 {
106 {
107 const QVector<QPointF> &points = m_points;
107 const QVector<QPointF> &points = m_points;
108 const QVector<QPointF> &controlPoints = m_controlPoints;
108 const QVector<QPointF> &controlPoints = m_controlPoints;
109
109
110 if ((points.size() < 2) || (controlPoints.size() < 2)) {
110 if ((points.size() < 2) || (controlPoints.size() < 2)) {
111 prepareGeometryChange();
111 prepareGeometryChange();
112 m_path = QPainterPath();
112 m_path = QPainterPath();
113 m_rect = QRect();
113 m_rect = QRect();
114 return;
114 return;
115 }
115 }
116
116
117 Q_ASSERT(points.count() * 2 - 2 == controlPoints.count());
117 Q_ASSERT(points.count() * 2 - 2 == controlPoints.count());
118
118
119 QPainterPath splinePath;
119 QPainterPath splinePath;
120 QPainterPath fullPath;
120 QPainterPath fullPath;
121 // Use worst case scenario to determine required margin.
121 // Use worst case scenario to determine required margin.
122 qreal margin = m_linePen.width() * 1.42;
122 qreal margin = m_linePen.width() * 1.42;
123
123
124 if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
124 if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
125 QPainterPath splinePathLeft;
125 QPainterPath splinePathLeft;
126 QPainterPath splinePathRight;
126 QPainterPath splinePathRight;
127 QPainterPath *currentSegmentPath = 0;
127 QPainterPath *currentSegmentPath = 0;
128 QPainterPath *previousSegmentPath = 0;
128 QPainterPath *previousSegmentPath = 0;
129 qreal minX = domain()->minX();
129 qreal minX = domain()->minX();
130 qreal maxX = domain()->maxX();
130 qreal maxX = domain()->maxX();
131 qreal minY = domain()->minY();
131 qreal minY = domain()->minY();
132 QPointF currentSeriesPoint = m_series->at(0);
132 QPointF currentSeriesPoint = m_series->at(0);
133 QPointF currentGeometryPoint = points.at(0);
133 QPointF currentGeometryPoint = points.at(0);
134 QPointF previousGeometryPoint = points.at(0);
134 QPointF previousGeometryPoint = points.at(0);
135 bool pointOffGrid = false;
135 bool pointOffGrid = false;
136 bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
136 bool previousPointWasOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
137 m_visiblePoints.clear();
137 m_visiblePoints.clear();
138 m_visiblePoints.reserve(points.size());
138 m_visiblePoints.reserve(points.size());
139
139
140 qreal domainRadius = domain()->size().height() / 2.0;
140 qreal domainRadius = domain()->size().height() / 2.0;
141 const QPointF centerPoint(domainRadius, domainRadius);
141 const QPointF centerPoint(domainRadius, domainRadius);
142
142
143 if (!previousPointWasOffGrid) {
143 if (!previousPointWasOffGrid) {
144 fullPath.moveTo(points.at(0));
144 fullPath.moveTo(points.at(0));
145 // Do not draw points for points below minimum Y.
145 // Do not draw points for points below minimum Y.
146 if (m_pointsVisible && currentSeriesPoint.y() >= minY)
146 if (m_pointsVisible && currentSeriesPoint.y() >= minY)
147 m_visiblePoints.append(currentGeometryPoint);
147 m_visiblePoints.append(currentGeometryPoint);
148 }
148 }
149
149
150 qreal leftMarginLine = centerPoint.x() - margin;
150 qreal leftMarginLine = centerPoint.x() - margin;
151 qreal rightMarginLine = centerPoint.x() + margin;
151 qreal rightMarginLine = centerPoint.x() + margin;
152 qreal horizontal = centerPoint.y();
152 qreal horizontal = centerPoint.y();
153
153
154 // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
154 // See ScatterChartItem::updateGeometry() for explanation why seriesLastIndex is needed
155 const int seriesLastIndex = m_series->count() - 1;
155 const int seriesLastIndex = m_series->count() - 1;
156
156
157 for (int i = 1; i < points.size(); i++) {
157 for (int i = 1; i < points.size(); i++) {
158 // Interpolating spline fragments accurately is not trivial, and would anyway be ugly
158 // Interpolating spline fragments accurately is not trivial, and would anyway be ugly
159 // when thick pen is used, so we work around it by utilizing three separate
159 // when thick pen is used, so we work around it by utilizing three separate
160 // paths for spline segments and clip those with custom regions at paint time.
160 // paths for spline segments and clip those with custom regions at paint time.
161 // "Right" path contains segments that cross the axis line with visible point on the
161 // "Right" path contains segments that cross the axis line with visible point on the
162 // right side of the axis line, as well as segments that have one point within the margin
162 // right side of the axis line, as well as segments that have one point within the margin
163 // on the right side of the axis line and another point on the right side of the chart.
163 // on the right side of the axis line and another point on the right side of the chart.
164 // "Left" path contains points with similarly on the left side.
164 // "Left" path contains points with similarly on the left side.
165 // "Full" path contains rest of the points.
165 // "Full" path contains rest of the points.
166 // This doesn't yield perfect results always. E.g. when segment covers more than 90
166 // This doesn't yield perfect results always. E.g. when segment covers more than 90
167 // degrees and both of the points are within the margin, one in the top half and one in the
167 // degrees and both of the points are within the margin, one in the top half and one in the
168 // bottom half of the chart, the bottom one gets clipped incorrectly.
168 // bottom half of the chart, the bottom one gets clipped incorrectly.
169 // However, this should be rare occurrence in any sensible chart.
169 // However, this should be rare occurrence in any sensible chart.
170 currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
170 currentSeriesPoint = m_series->at(qMin(seriesLastIndex, i));
171 currentGeometryPoint = points.at(i);
171 currentGeometryPoint = points.at(i);
172 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
172 pointOffGrid = (currentSeriesPoint.x() < minX || currentSeriesPoint.x() > maxX);
173
173
174 // Draw something unless both off-grid
174 // Draw something unless both off-grid
175 if (!pointOffGrid || !previousPointWasOffGrid) {
175 if (!pointOffGrid || !previousPointWasOffGrid) {
176 bool dummyOk; // We know points are ok, but this is needed
176 bool dummyOk; // We know points are ok, but this is needed
177 qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
177 qreal currentAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(currentSeriesPoint.x(), dummyOk);
178 qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
178 qreal previousAngle = static_cast<PolarDomain *>(domain())->toAngularCoordinate(m_series->at(i - 1).x(), dummyOk);
179
179
180 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
180 if ((qAbs(currentAngle - previousAngle) > 180.0)) {
181 // If the angle between two points is over 180 degrees (half X range),
181 // If the angle between two points is over 180 degrees (half X range),
182 // any direct segment between them becomes meaningless.
182 // any direct segment between them becomes meaningless.
183 // In this case two line segments are drawn instead, from previous
183 // In this case two line segments are drawn instead, from previous
184 // point to the center and from center to current point.
184 // point to the center and from center to current point.
185 if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
185 if ((previousAngle < 0.0 || (previousAngle <= 180.0 && previousGeometryPoint.x() < rightMarginLine))
186 && previousGeometryPoint.y() < horizontal) {
186 && previousGeometryPoint.y() < horizontal) {
187 currentSegmentPath = &splinePathRight;
187 currentSegmentPath = &splinePathRight;
188 } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
188 } else if ((previousAngle > 360.0 || (previousAngle > 180.0 && previousGeometryPoint.x() > leftMarginLine))
189 && previousGeometryPoint.y() < horizontal) {
189 && previousGeometryPoint.y() < horizontal) {
190 currentSegmentPath = &splinePathLeft;
190 currentSegmentPath = &splinePathLeft;
191 } else if (previousAngle > 0.0 && previousAngle < 360.0) {
191 } else if (previousAngle > 0.0 && previousAngle < 360.0) {
192 currentSegmentPath = &splinePath;
192 currentSegmentPath = &splinePath;
193 } else {
193 } else {
194 currentSegmentPath = 0;
194 currentSegmentPath = 0;
195 }
195 }
196
196
197 if (currentSegmentPath) {
197 if (currentSegmentPath) {
198 if (previousSegmentPath != currentSegmentPath)
198 if (previousSegmentPath != currentSegmentPath)
199 currentSegmentPath->moveTo(previousGeometryPoint);
199 currentSegmentPath->moveTo(previousGeometryPoint);
200 if (!previousSegmentPath)
200 if (!previousSegmentPath)
201 fullPath.moveTo(previousGeometryPoint);
201 fullPath.moveTo(previousGeometryPoint);
202
202
203 currentSegmentPath->lineTo(centerPoint);
203 currentSegmentPath->lineTo(centerPoint);
204 fullPath.lineTo(centerPoint);
204 fullPath.lineTo(centerPoint);
205 }
205 }
206
206
207 previousSegmentPath = currentSegmentPath;
207 previousSegmentPath = currentSegmentPath;
208
208
209 if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
209 if ((currentAngle < 0.0 || (currentAngle <= 180.0 && currentGeometryPoint.x() < rightMarginLine))
210 && currentGeometryPoint.y() < horizontal) {
210 && currentGeometryPoint.y() < horizontal) {
211 currentSegmentPath = &splinePathRight;
211 currentSegmentPath = &splinePathRight;
212 } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
212 } else if ((currentAngle > 360.0 || (currentAngle > 180.0 &&currentGeometryPoint.x() > leftMarginLine))
213 && currentGeometryPoint.y() < horizontal) {
213 && currentGeometryPoint.y() < horizontal) {
214 currentSegmentPath = &splinePathLeft;
214 currentSegmentPath = &splinePathLeft;
215 } else if (currentAngle > 0.0 && currentAngle < 360.0) {
215 } else if (currentAngle > 0.0 && currentAngle < 360.0) {
216 currentSegmentPath = &splinePath;
216 currentSegmentPath = &splinePath;
217 } else {
217 } else {
218 currentSegmentPath = 0;
218 currentSegmentPath = 0;
219 }
219 }
220
220
221 if (currentSegmentPath) {
221 if (currentSegmentPath) {
222 if (previousSegmentPath != currentSegmentPath)
222 if (previousSegmentPath != currentSegmentPath)
223 currentSegmentPath->moveTo(centerPoint);
223 currentSegmentPath->moveTo(centerPoint);
224 if (!previousSegmentPath)
224 if (!previousSegmentPath)
225 fullPath.moveTo(centerPoint);
225 fullPath.moveTo(centerPoint);
226
226
227 currentSegmentPath->lineTo(currentGeometryPoint);
227 currentSegmentPath->lineTo(currentGeometryPoint);
228 fullPath.lineTo(currentGeometryPoint);
228 fullPath.lineTo(currentGeometryPoint);
229 }
229 }
230 } else {
230 } else {
231 QPointF cp1 = controlPoints[2 * (i - 1)];
231 QPointF cp1 = controlPoints[2 * (i - 1)];
232 QPointF cp2 = controlPoints[(2 * i) - 1];
232 QPointF cp2 = controlPoints[(2 * i) - 1];
233
233
234 if (previousAngle < 0.0 || currentAngle < 0.0
234 if (previousAngle < 0.0 || currentAngle < 0.0
235 || ((previousAngle <= 180.0 && currentAngle <= 180.0)
235 || ((previousAngle <= 180.0 && currentAngle <= 180.0)
236 && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
236 && ((previousGeometryPoint.x() < rightMarginLine && previousGeometryPoint.y() < horizontal)
237 || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
237 || (currentGeometryPoint.x() < rightMarginLine && currentGeometryPoint.y() < horizontal)))) {
238 currentSegmentPath = &splinePathRight;
238 currentSegmentPath = &splinePathRight;
239 } else if (previousAngle > 360.0 || currentAngle > 360.0
239 } else if (previousAngle > 360.0 || currentAngle > 360.0
240 || ((previousAngle > 180.0 && currentAngle > 180.0)
240 || ((previousAngle > 180.0 && currentAngle > 180.0)
241 && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
241 && ((previousGeometryPoint.x() > leftMarginLine && previousGeometryPoint.y() < horizontal)
242 || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
242 || (currentGeometryPoint.x() > leftMarginLine && currentGeometryPoint.y() < horizontal)))) {
243 currentSegmentPath = &splinePathLeft;
243 currentSegmentPath = &splinePathLeft;
244 } else {
244 } else {
245 currentSegmentPath = &splinePath;
245 currentSegmentPath = &splinePath;
246 }
246 }
247
247
248 if (currentSegmentPath != previousSegmentPath)
248 if (currentSegmentPath != previousSegmentPath)
249 currentSegmentPath->moveTo(previousGeometryPoint);
249 currentSegmentPath->moveTo(previousGeometryPoint);
250 if (!previousSegmentPath)
250 if (!previousSegmentPath)
251 fullPath.moveTo(previousGeometryPoint);
251 fullPath.moveTo(previousGeometryPoint);
252
252
253 fullPath.cubicTo(cp1, cp2, currentGeometryPoint);
253 fullPath.cubicTo(cp1, cp2, currentGeometryPoint);
254 currentSegmentPath->cubicTo(cp1, cp2, currentGeometryPoint);
254 currentSegmentPath->cubicTo(cp1, cp2, currentGeometryPoint);
255 }
255 }
256 } else {
256 } else {
257 currentSegmentPath = 0;
257 currentSegmentPath = 0;
258 }
258 }
259
259
260 previousPointWasOffGrid = pointOffGrid;
260 previousPointWasOffGrid = pointOffGrid;
261 if (!pointOffGrid && m_pointsVisible && currentSeriesPoint.y() >= minY)
261 if (!pointOffGrid && m_pointsVisible && currentSeriesPoint.y() >= minY)
262 m_visiblePoints.append(currentGeometryPoint);
262 m_visiblePoints.append(currentGeometryPoint);
263 previousSegmentPath = currentSegmentPath;
263 previousSegmentPath = currentSegmentPath;
264 previousGeometryPoint = currentGeometryPoint;
264 previousGeometryPoint = currentGeometryPoint;
265 }
265 }
266
266
267 m_pathPolarRight = splinePathRight;
267 m_pathPolarRight = splinePathRight;
268 m_pathPolarLeft = splinePathLeft;
268 m_pathPolarLeft = splinePathLeft;
269 // Note: This construction of m_fullpath is not perfect. The partial segments that are
269 // Note: This construction of m_fullpath is not perfect. The partial segments that are
270 // outside left/right clip regions at axis boundary still generate hover/click events,
270 // outside left/right clip regions at axis boundary still generate hover/click events,
271 // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
271 // because shape doesn't get clipped. It doesn't seem possible to do sensibly.
272 } else { // not polar
272 } else { // not polar
273 splinePath.moveTo(points.at(0));
273 splinePath.moveTo(points.at(0));
274 for (int i = 0; i < points.size() - 1; i++) {
274 for (int i = 0; i < points.size() - 1; i++) {
275 const QPointF &point = points.at(i + 1);
275 const QPointF &point = points.at(i + 1);
276 splinePath.cubicTo(controlPoints[2 * i], controlPoints[2 * i + 1], point);
276 splinePath.cubicTo(controlPoints[2 * i], controlPoints[2 * i + 1], point);
277 }
277 }
278 fullPath = splinePath;
278 fullPath = splinePath;
279 }
279 }
280
280
281 QPainterPathStroker stroker;
281 QPainterPathStroker stroker;
282 // The full path is comprised of three separate paths.
282 // The full path is comprised of three separate paths.
283 // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
283 // This is why we are prepared for the "worst case" scenario, i.e. use always MiterJoin and
284 // multiply line width with square root of two when defining shape and bounding rectangle.
284 // multiply line width with square root of two when defining shape and bounding rectangle.
285 stroker.setWidth(margin);
285 stroker.setWidth(margin);
286 stroker.setJoinStyle(Qt::MiterJoin);
286 stroker.setJoinStyle(Qt::MiterJoin);
287 stroker.setCapStyle(Qt::SquareCap);
287 stroker.setCapStyle(Qt::SquareCap);
288 stroker.setMiterLimit(m_linePen.miterLimit());
288 stroker.setMiterLimit(m_linePen.miterLimit());
289
289
290 // Only zoom in if the bounding rects of the path fit inside int limits. QWidget::update() uses
290 // Only zoom in if the bounding rects of the path fit inside int limits. QWidget::update() uses
291 // a region that has to be compatible with QRect.
291 // a region that has to be compatible with QRect.
292 QPainterPath checkShapePath = stroker.createStroke(fullPath);
292 QPainterPath checkShapePath = stroker.createStroke(fullPath);
293 if (checkShapePath.boundingRect().height() <= INT_MAX
293 if (checkShapePath.boundingRect().height() <= INT_MAX
294 && checkShapePath.boundingRect().width() <= INT_MAX
294 && checkShapePath.boundingRect().width() <= INT_MAX
295 && splinePath.boundingRect().height() <= INT_MAX
295 && splinePath.boundingRect().height() <= INT_MAX
296 && splinePath.boundingRect().width() <= INT_MAX) {
296 && splinePath.boundingRect().width() <= INT_MAX) {
297 m_path = splinePath;
297 m_path = splinePath;
298
298
299 prepareGeometryChange();
299 prepareGeometryChange();
300
300
301 m_fullPath = checkShapePath;
301 m_fullPath = checkShapePath;
302 m_rect = m_fullPath.boundingRect();
302 m_rect = m_fullPath.boundingRect();
303 }
303 }
304 }
304 }
305
305
306 /*!
306 /*!
307 Calculates control points which are needed by QPainterPath.cubicTo function to draw the cubic Bezier cureve between two points.
307 Calculates control points which are needed by QPainterPath.cubicTo function to draw the cubic Bezier cureve between two points.
308 */
308 */
309 QVector<QPointF> SplineChartItem::calculateControlPoints(const QVector<QPointF> &points)
309 QVector<QPointF> SplineChartItem::calculateControlPoints(const QVector<QPointF> &points)
310 {
310 {
311 QVector<QPointF> controlPoints;
311 QVector<QPointF> controlPoints;
312 controlPoints.resize(points.count() * 2 - 2);
312 controlPoints.resize(points.count() * 2 - 2);
313
313
314 int n = points.count() - 1;
314 int n = points.count() - 1;
315
315
316 if (n == 1) {
316 if (n == 1) {
317 //for n==1
317 //for n==1
318 controlPoints[0].setX((2 * points[0].x() + points[1].x()) / 3);
318 controlPoints[0].setX((2 * points[0].x() + points[1].x()) / 3);
319 controlPoints[0].setY((2 * points[0].y() + points[1].y()) / 3);
319 controlPoints[0].setY((2 * points[0].y() + points[1].y()) / 3);
320 controlPoints[1].setX(2 * controlPoints[0].x() - points[0].x());
320 controlPoints[1].setX(2 * controlPoints[0].x() - points[0].x());
321 controlPoints[1].setY(2 * controlPoints[0].y() - points[0].y());
321 controlPoints[1].setY(2 * controlPoints[0].y() - points[0].y());
322 return controlPoints;
322 return controlPoints;
323 }
323 }
324
324
325 // Calculate first Bezier control points
325 // Calculate first Bezier control points
326 // Set of equations for P0 to Pn points.
326 // Set of equations for P0 to Pn points.
327 //
327 //
328 // | 2 1 0 0 ... 0 0 0 ... 0 0 0 | | P1_1 | | P0 + 2 * P1 |
328 // | 2 1 0 0 ... 0 0 0 ... 0 0 0 | | P1_1 | | P0 + 2 * P1 |
329 // | 1 4 1 0 ... 0 0 0 ... 0 0 0 | | P1_2 | | 4 * P1 + 2 * P2 |
329 // | 1 4 1 0 ... 0 0 0 ... 0 0 0 | | P1_2 | | 4 * P1 + 2 * P2 |
330 // | 0 1 4 1 ... 0 0 0 ... 0 0 0 | | P1_3 | | 4 * P2 + 2 * P3 |
330 // | 0 1 4 1 ... 0 0 0 ... 0 0 0 | | P1_3 | | 4 * P2 + 2 * P3 |
331 // | . . . . . . . . . . . . | | ... | | ... |
331 // | . . . . . . . . . . . . | | ... | | ... |
332 // | 0 0 0 0 ... 1 4 1 ... 0 0 0 | * | P1_i | = | 4 * P(i-1) + 2 * Pi |
332 // | 0 0 0 0 ... 1 4 1 ... 0 0 0 | * | P1_i | = | 4 * P(i-1) + 2 * Pi |
333 // | . . . . . . . . . . . . | | ... | | ... |
333 // | . . . . . . . . . . . . | | ... | | ... |
334 // | 0 0 0 0 0 0 0 0 ... 1 4 1 | | P1_(n-1)| | 4 * P(n-2) + 2 * P(n-1) |
334 // | 0 0 0 0 0 0 0 0 ... 1 4 1 | | P1_(n-1)| | 4 * P(n-2) + 2 * P(n-1) |
335 // | 0 0 0 0 0 0 0 0 ... 0 2 7 | | P1_n | | 8 * P(n-1) + Pn |
335 // | 0 0 0 0 0 0 0 0 ... 0 2 7 | | P1_n | | 8 * P(n-1) + Pn |
336 //
336 //
337 QVector<qreal> vector;
337 QVector<qreal> vector;
338 vector.resize(n);
338 vector.resize(n);
339
339
340 vector[0] = points[0].x() + 2 * points[1].x();
340 vector[0] = points[0].x() + 2 * points[1].x();
341
341
342
342
343 for (int i = 1; i < n - 1; ++i)
343 for (int i = 1; i < n - 1; ++i)
344 vector[i] = 4 * points[i].x() + 2 * points[i + 1].x();
344 vector[i] = 4 * points[i].x() + 2 * points[i + 1].x();
345
345
346 vector[n - 1] = (8 * points[n - 1].x() + points[n].x()) / 2.0;
346 vector[n - 1] = (8 * points[n - 1].x() + points[n].x()) / 2.0;
347
347
348 QVector<qreal> xControl = firstControlPoints(vector);
348 QVector<qreal> xControl = firstControlPoints(vector);
349
349
350 vector[0] = points[0].y() + 2 * points[1].y();
350 vector[0] = points[0].y() + 2 * points[1].y();
351
351
352 for (int i = 1; i < n - 1; ++i)
352 for (int i = 1; i < n - 1; ++i)
353 vector[i] = 4 * points[i].y() + 2 * points[i + 1].y();
353 vector[i] = 4 * points[i].y() + 2 * points[i + 1].y();
354
354
355 vector[n - 1] = (8 * points[n - 1].y() + points[n].y()) / 2.0;
355 vector[n - 1] = (8 * points[n - 1].y() + points[n].y()) / 2.0;
356
356
357 QVector<qreal> yControl = firstControlPoints(vector);
357 QVector<qreal> yControl = firstControlPoints(vector);
358
358
359 for (int i = 0, j = 0; i < n; ++i, ++j) {
359 for (int i = 0, j = 0; i < n; ++i, ++j) {
360
360
361 controlPoints[j].setX(xControl[i]);
361 controlPoints[j].setX(xControl[i]);
362 controlPoints[j].setY(yControl[i]);
362 controlPoints[j].setY(yControl[i]);
363
363
364 j++;
364 j++;
365
365
366 if (i < n - 1) {
366 if (i < n - 1) {
367 controlPoints[j].setX(2 * points[i + 1].x() - xControl[i + 1]);
367 controlPoints[j].setX(2 * points[i + 1].x() - xControl[i + 1]);
368 controlPoints[j].setY(2 * points[i + 1].y() - yControl[i + 1]);
368 controlPoints[j].setY(2 * points[i + 1].y() - yControl[i + 1]);
369 } else {
369 } else {
370 controlPoints[j].setX((points[n].x() + xControl[n - 1]) / 2);
370 controlPoints[j].setX((points[n].x() + xControl[n - 1]) / 2);
371 controlPoints[j].setY((points[n].y() + yControl[n - 1]) / 2);
371 controlPoints[j].setY((points[n].y() + yControl[n - 1]) / 2);
372 }
372 }
373 }
373 }
374 return controlPoints;
374 return controlPoints;
375 }
375 }
376
376
377 QVector<qreal> SplineChartItem::firstControlPoints(const QVector<qreal>& vector)
377 QVector<qreal> SplineChartItem::firstControlPoints(const QVector<qreal>& vector)
378 {
378 {
379 QVector<qreal> result;
379 QVector<qreal> result;
380
380
381 int count = vector.count();
381 int count = vector.count();
382 result.resize(count);
382 result.resize(count);
383 result[0] = vector[0] / 2.0;
383 result[0] = vector[0] / 2.0;
384
384
385 QVector<qreal> temp;
385 QVector<qreal> temp;
386 temp.resize(count);
386 temp.resize(count);
387 temp[0] = 0;
387 temp[0] = 0;
388
388
389 qreal b = 2.0;
389 qreal b = 2.0;
390
390
391 for (int i = 1; i < count; i++) {
391 for (int i = 1; i < count; i++) {
392 temp[i] = 1 / b;
392 temp[i] = 1 / b;
393 b = (i < count - 1 ? 4.0 : 3.5) - temp[i];
393 b = (i < count - 1 ? 4.0 : 3.5) - temp[i];
394 result[i] = (vector[i] - result[i - 1]) / b;
394 result[i] = (vector[i] - result[i - 1]) / b;
395 }
395 }
396
396
397 for (int i = 1; i < count; i++)
397 for (int i = 1; i < count; i++)
398 result[count - i - 1] -= temp[count - i] * result[count - i];
398 result[count - i - 1] -= temp[count - i] * result[count - i];
399
399
400 return result;
400 return result;
401 }
401 }
402
402
403 //handlers
403 //handlers
404
404
405 void SplineChartItem::handleUpdated()
405 void SplineChartItem::handleUpdated()
406 {
406 {
407 setVisible(m_series->isVisible());
407 setVisible(m_series->isVisible());
408 setOpacity(m_series->opacity());
408 setOpacity(m_series->opacity());
409 m_pointsVisible = m_series->pointsVisible();
409 m_pointsVisible = m_series->pointsVisible();
410 m_linePen = m_series->pen();
410 m_linePen = m_series->pen();
411 m_pointPen = m_series->pen();
411 m_pointPen = m_series->pen();
412 m_pointPen.setWidthF(2 * m_pointPen.width());
412 m_pointPen.setWidthF(2 * m_pointPen.width());
413 m_pointLabelsFormat = m_series->pointLabelsFormat();
413 m_pointLabelsFormat = m_series->pointLabelsFormat();
414 m_pointLabelsVisible = m_series->pointLabelsVisible();
414 m_pointLabelsVisible = m_series->pointLabelsVisible();
415 m_pointLabelsFont = m_series->pointLabelsFont();
415 m_pointLabelsFont = m_series->pointLabelsFont();
416 m_pointLabelsColor = m_series->pointLabelsColor();
416 m_pointLabelsColor = m_series->pointLabelsColor();
417 update();
417 update();
418 }
418 }
419
419
420 //painter
420 //painter
421
421
422 void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
422 void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
423 {
423 {
424 Q_UNUSED(widget)
424 Q_UNUSED(widget)
425 Q_UNUSED(option)
425 Q_UNUSED(option)
426
426
427 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
427 QRectF clipRect = QRectF(QPointF(0, 0), domain()->size());
428
428
429 painter->save();
429 painter->save();
430 painter->setPen(m_linePen);
430 painter->setPen(m_linePen);
431 painter->setBrush(Qt::NoBrush);
431 painter->setBrush(Qt::NoBrush);
432
432
433 if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
433 if (m_series->chart()->chartType() == QChart::ChartTypePolar) {
434 qreal halfWidth = domain()->size().width() / 2.0;
434 qreal halfWidth = domain()->size().width() / 2.0;
435 QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
435 QRectF clipRectLeft = QRectF(0, 0, halfWidth, domain()->size().height());
436 QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
436 QRectF clipRectRight = QRectF(halfWidth, 0, halfWidth, domain()->size().height());
437 QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
437 QRegion fullPolarClipRegion(clipRect.toRect(), QRegion::Ellipse);
438 QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
438 QRegion clipRegionLeft(fullPolarClipRegion.intersected(clipRectLeft.toRect()));
439 QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
439 QRegion clipRegionRight(fullPolarClipRegion.intersected(clipRectRight.toRect()));
440 painter->setClipRegion(clipRegionLeft);
440 painter->setClipRegion(clipRegionLeft);
441 painter->drawPath(m_pathPolarLeft);
441 painter->drawPath(m_pathPolarLeft);
442 painter->setClipRegion(clipRegionRight);
442 painter->setClipRegion(clipRegionRight);
443 painter->drawPath(m_pathPolarRight);
443 painter->drawPath(m_pathPolarRight);
444 painter->setClipRegion(fullPolarClipRegion);
444 painter->setClipRegion(fullPolarClipRegion);
445 } else {
445 } else {
446 painter->setClipRect(clipRect);
446 painter->setClipRect(clipRect);
447 }
447 }
448
448
449 reversePainter(painter, clipRect);
450
449 painter->drawPath(m_path);
451 painter->drawPath(m_path);
450
452
451 if (m_pointsVisible) {
453 if (m_pointsVisible) {
452 painter->setPen(m_pointPen);
454 painter->setPen(m_pointPen);
453 if (m_series->chart()->chartType() == QChart::ChartTypePolar)
455 if (m_series->chart()->chartType() == QChart::ChartTypePolar)
454 painter->drawPoints(m_visiblePoints);
456 painter->drawPoints(m_visiblePoints);
455 else
457 else
456 painter->drawPoints(geometryPoints());
458 painter->drawPoints(geometryPoints());
457 }
459 }
458
460
461 reversePainter(painter, clipRect);
462
459 if (m_pointLabelsVisible)
463 if (m_pointLabelsVisible)
460 m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
464 m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2);
461
465
462 painter->restore();
466 painter->restore();
463 }
467 }
464
468
465 void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
469 void SplineChartItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
466 {
470 {
467 emit XYChart::pressed(domain()->calculateDomainPoint(event->pos()));
471 emit XYChart::pressed(domain()->calculateDomainPoint(event->pos()));
468 m_lastMousePos = event->pos();
472 m_lastMousePos = event->pos();
469 m_mousePressed = true;
473 m_mousePressed = true;
470 QGraphicsItem::mousePressEvent(event);
474 QGraphicsItem::mousePressEvent(event);
471 }
475 }
472
476
473 void SplineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
477 void SplineChartItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
474 {
478 {
475 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
479 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), true);
476 QGraphicsItem::hoverEnterEvent(event);
480 QGraphicsItem::hoverEnterEvent(event);
477 }
481 }
478
482
479 void SplineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
483 void SplineChartItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
480 {
484 {
481 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
485 emit XYChart::hovered(domain()->calculateDomainPoint(event->pos()), false);
482 QGraphicsItem::hoverLeaveEvent(event);
486 QGraphicsItem::hoverLeaveEvent(event);
483 }
487 }
484
488
485 void SplineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
489 void SplineChartItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
486 {
490 {
487 emit XYChart::released(domain()->calculateDomainPoint(m_lastMousePos));
491 emit XYChart::released(domain()->calculateDomainPoint(m_lastMousePos));
488 if (m_mousePressed)
492 if (m_mousePressed)
489 emit XYChart::clicked(domain()->calculateDomainPoint(m_lastMousePos));
493 emit XYChart::clicked(domain()->calculateDomainPoint(m_lastMousePos));
490 m_mousePressed = false;
494 m_mousePressed = false;
491 QGraphicsItem::mouseReleaseEvent(event);
495 QGraphicsItem::mouseReleaseEvent(event);
492 }
496 }
493
497
494 void SplineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
498 void SplineChartItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
495 {
499 {
496 emit XYChart::doubleClicked(domain()->calculateDomainPoint(m_lastMousePos));
500 emit XYChart::doubleClicked(domain()->calculateDomainPoint(m_lastMousePos));
497 QGraphicsItem::mouseDoubleClickEvent(event);
501 QGraphicsItem::mouseDoubleClickEvent(event);
498 }
502 }
499
503
500 #include "moc_splinechartitem_p.cpp"
504 #include "moc_splinechartitem_p.cpp"
501
505
502 QT_CHARTS_END_NAMESPACE
506 QT_CHARTS_END_NAMESPACE
@@ -1,864 +1,870
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <QtCharts/QXYSeries>
19 #include <QtCharts/QXYSeries>
20 #include <private/qxyseries_p.h>
20 #include <private/qxyseries_p.h>
21 #include <private/abstractdomain_p.h>
21 #include <private/abstractdomain_p.h>
22 #include <QtCharts/QValueAxis>
22 #include <QtCharts/QValueAxis>
23 #include <private/xychart_p.h>
23 #include <private/xychart_p.h>
24 #include <QtCharts/QXYLegendMarker>
24 #include <QtCharts/QXYLegendMarker>
25 #include <private/charthelpers_p.h>
25 #include <private/charthelpers_p.h>
26 #include <private/qchart_p.h>
26 #include <private/qchart_p.h>
27 #include <QtGui/QPainter>
27 #include <QtGui/QPainter>
28
28
29 QT_CHARTS_BEGIN_NAMESPACE
29 QT_CHARTS_BEGIN_NAMESPACE
30
30
31 /*!
31 /*!
32 \class QXYSeries
32 \class QXYSeries
33 \inmodule Qt Charts
33 \inmodule Qt Charts
34 \brief The QXYSeries class is a base class for line, spline and scatter series.
34 \brief The QXYSeries class is a base class for line, spline and scatter series.
35 */
35 */
36 /*!
36 /*!
37 \qmltype XYSeries
37 \qmltype XYSeries
38 \instantiates QXYSeries
38 \instantiates QXYSeries
39 \inqmlmodule QtCharts
39 \inqmlmodule QtCharts
40
40
41 \inherits AbstractSeries
41 \inherits AbstractSeries
42
42
43 \brief The XYSeries type is a base type for line, spline and scatter series.
43 \brief The XYSeries type is a base type for line, spline and scatter series.
44
44
45 The XYSeries class is a base class for line, spline and scatter series.
45 The XYSeries class is a base class for line, spline and scatter series.
46 The class cannot be instantiated directly.
46 The class cannot be instantiated directly.
47 */
47 */
48
48
49 /*!
49 /*!
50 \qmlproperty AbstractAxis XYSeries::axisX
50 \qmlproperty AbstractAxis XYSeries::axisX
51 The x axis used for the series. If you leave both axisX and axisXTop undefined, a ValueAxis is created for
51 The x axis used for the series. If you leave both axisX and axisXTop undefined, a ValueAxis is created for
52 the series.
52 the series.
53 \sa axisXTop
53 \sa axisXTop
54 */
54 */
55
55
56 /*!
56 /*!
57 \qmlproperty AbstractAxis XYSeries::axisY
57 \qmlproperty AbstractAxis XYSeries::axisY
58 The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
58 The y axis used for the series. If you leave both axisY and axisYRight undefined, a ValueAxis is created for
59 the series.
59 the series.
60 \sa axisYRight
60 \sa axisYRight
61 */
61 */
62
62
63 /*!
63 /*!
64 \qmlproperty AbstractAxis XYSeries::axisXTop
64 \qmlproperty AbstractAxis XYSeries::axisXTop
65 The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
65 The x axis used for the series, drawn on top of the chart view. Note that you can only provide either axisX or
66 axisXTop, but not both.
66 axisXTop, but not both.
67 \sa axisX
67 \sa axisX
68 */
68 */
69
69
70 /*!
70 /*!
71 \qmlproperty AbstractAxis XYSeries::axisYRight
71 \qmlproperty AbstractAxis XYSeries::axisYRight
72 The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
72 The y axis used for the series, drawn to the right on the chart view. Note that you can only provide either axisY
73 or axisYRight, but not both.
73 or axisYRight, but not both.
74 \sa axisY
74 \sa axisY
75 */
75 */
76
76
77 /*!
77 /*!
78 \qmlproperty AbstractAxis XYSeries::axisAngular
78 \qmlproperty AbstractAxis XYSeries::axisAngular
79 The angular axis used for the series, drawn around the polar chart view.
79 The angular axis used for the series, drawn around the polar chart view.
80 \sa axisX
80 \sa axisX
81 */
81 */
82
82
83 /*!
83 /*!
84 \qmlproperty AbstractAxis XYSeries::axisRadial
84 \qmlproperty AbstractAxis XYSeries::axisRadial
85 The radial axis used for the series, drawn inside the polar chart view.
85 The radial axis used for the series, drawn inside the polar chart view.
86 \sa axisY
86 \sa axisY
87 */
87 */
88
88
89 /*!
89 /*!
90 \property QXYSeries::pointsVisible
90 \property QXYSeries::pointsVisible
91 Controls if the data points are visible and should be drawn.
91 Controls if the data points are visible and should be drawn.
92 */
92 */
93 /*!
93 /*!
94 \qmlproperty bool XYSeries::pointsVisible
94 \qmlproperty bool XYSeries::pointsVisible
95 Controls if the data points are visible and should be drawn.
95 Controls if the data points are visible and should be drawn.
96 */
96 */
97
97
98 /*!
98 /*!
99 \fn QPen QXYSeries::pen() const
99 \fn QPen QXYSeries::pen() const
100 \brief Returns pen used to draw points for series.
100 \brief Returns pen used to draw points for series.
101 \sa setPen()
101 \sa setPen()
102 */
102 */
103
103
104 /*!
104 /*!
105 \fn QBrush QXYSeries::brush() const
105 \fn QBrush QXYSeries::brush() const
106 \brief Returns brush used to draw points for series.
106 \brief Returns brush used to draw points for series.
107 \sa setBrush()
107 \sa setBrush()
108 */
108 */
109
109
110 /*!
110 /*!
111 \property QXYSeries::color
111 \property QXYSeries::color
112 The color of the series. This is line (pen) color in case of QLineSeries or QSplineSeries and
112 The color of the series. This is line (pen) color in case of QLineSeries or QSplineSeries and
113 fill (brush) color in case of QScatterSeries or QAreaSeries.
113 fill (brush) color in case of QScatterSeries or QAreaSeries.
114 \sa QXYSeries::pen(), QXYSeries::brush()
114 \sa QXYSeries::pen(), QXYSeries::brush()
115 */
115 */
116 /*!
116 /*!
117 \qmlproperty color XYSeries::color
117 \qmlproperty color XYSeries::color
118 The color of the series. This is line (pen) color in case of LineSeries or SplineSeries and
118 The color of the series. This is line (pen) color in case of LineSeries or SplineSeries and
119 fill (brush) color in case of ScatterSeries or AreaSeries.
119 fill (brush) color in case of ScatterSeries or AreaSeries.
120 */
120 */
121
121
122 /*!
122 /*!
123 \property QXYSeries::pointLabelsFormat
123 \property QXYSeries::pointLabelsFormat
124 The \a format used for showing labels with series points.
124 The \a format used for showing labels with series points.
125
125
126 QXYSeries supports the following format tags:
126 QXYSeries supports the following format tags:
127 \table
127 \table
128 \row
128 \row
129 \li @xPoint \li The x value of the data point
129 \li @xPoint \li The x value of the data point
130 \row
130 \row
131 \li @yPoint \li The y value of the data point
131 \li @yPoint \li The y value of the data point
132 \endtable
132 \endtable
133
133
134 For example, the following usage of the format tags would produce labels that have the data
134 For example, the following usage of the format tags would produce labels that have the data
135 point (x, y) shown inside brackets separated by a comma:
135 point (x, y) shown inside brackets separated by a comma:
136 \code
136 \code
137 series->setPointLabelsFormat("(@xPoint, @yPoint)");
137 series->setPointLabelsFormat("(@xPoint, @yPoint)");
138 \endcode
138 \endcode
139
139
140 By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
140 By default, the labels format is set to '@xPoint, @yPoint'. The labels are shown on the plot
141 area, labels on the edge of the plot area are cut. If the points are close to each other the
141 area, labels on the edge of the plot area are cut. If the points are close to each other the
142 labels may overlap.
142 labels may overlap.
143
143
144 \sa QXYSeries::pointLabelsVisible, QXYSeries::pointLabelsFont, QXYSeries::pointLabelsColor
144 \sa QXYSeries::pointLabelsVisible, QXYSeries::pointLabelsFont, QXYSeries::pointLabelsColor
145 */
145 */
146 /*!
146 /*!
147 \qmlproperty string XYSeries::pointLabelsFormat
147 \qmlproperty string XYSeries::pointLabelsFormat
148 The \a format used for showing labels with series points.
148 The \a format used for showing labels with series points.
149
149
150 \sa QXYSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
150 \sa QXYSeries::pointLabelsFormat, pointLabelsVisible, pointLabelsFont, pointLabelsColor
151 */
151 */
152 /*!
152 /*!
153 \fn void QXYSeries::pointLabelsFormatChanged(const QString &format)
153 \fn void QXYSeries::pointLabelsFormatChanged(const QString &format)
154 Signal is emitted when the \a format of data point labels is changed.
154 Signal is emitted when the \a format of data point labels is changed.
155 */
155 */
156 /*!
156 /*!
157 \qmlsignal XYSeries::onPointLabelsFormatChanged(string format)
157 \qmlsignal XYSeries::onPointLabelsFormatChanged(string format)
158 Signal is emitted when the \a format of data point labels is changed.
158 Signal is emitted when the \a format of data point labels is changed.
159 */
159 */
160
160
161 /*!
161 /*!
162 \property QXYSeries::pointLabelsVisible
162 \property QXYSeries::pointLabelsVisible
163 Defines the visibility for data point labels. False by default.
163 Defines the visibility for data point labels. False by default.
164
164
165 \sa QXYSeries::pointLabelsFormat
165 \sa QXYSeries::pointLabelsFormat
166 */
166 */
167 /*!
167 /*!
168 \qmlproperty bool XYSeries::pointLabelsVisible
168 \qmlproperty bool XYSeries::pointLabelsVisible
169 Defines the visibility for data point labels.
169 Defines the visibility for data point labels.
170
170
171 \sa pointLabelsFormat
171 \sa pointLabelsFormat
172 */
172 */
173 /*!
173 /*!
174 \fn void QXYSeries::pointLabelsVisibilityChanged(bool visible)
174 \fn void QXYSeries::pointLabelsVisibilityChanged(bool visible)
175 The visibility of the data point labels is changed to \a visible.
175 The visibility of the data point labels is changed to \a visible.
176 */
176 */
177 /*!
177 /*!
178 \qmlsignal XYSeries::onPointLabelsVisibilityChanged(bool visible)
178 \qmlsignal XYSeries::onPointLabelsVisibilityChanged(bool visible)
179 The visibility of the data point labels is changed to \a visible.
179 The visibility of the data point labels is changed to \a visible.
180 */
180 */
181
181
182 /*!
182 /*!
183 \property QXYSeries::pointLabelsFont
183 \property QXYSeries::pointLabelsFont
184 Defines the font used for data point labels.
184 Defines the font used for data point labels.
185
185
186 \sa QXYSeries::pointLabelsFormat
186 \sa QXYSeries::pointLabelsFormat
187 */
187 */
188 /*!
188 /*!
189 \qmlproperty font XYSeries::pointLabelsFont
189 \qmlproperty font XYSeries::pointLabelsFont
190 Defines the font used for data point labels.
190 Defines the font used for data point labels.
191
191
192 \sa pointLabelsFormat
192 \sa pointLabelsFormat
193 */
193 */
194 /*!
194 /*!
195 \fn void QXYSeries::pointLabelsFontChanged(const QFont &font);
195 \fn void QXYSeries::pointLabelsFontChanged(const QFont &font);
196 The font used for data point labels is changed to \a font.
196 The font used for data point labels is changed to \a font.
197 */
197 */
198 /*!
198 /*!
199 \qmlsignal XYSeries::onPointLabelsFontChanged(Font font)
199 \qmlsignal XYSeries::onPointLabelsFontChanged(Font font)
200 The font used for data point labels is changed to \a font.
200 The font used for data point labels is changed to \a font.
201 */
201 */
202
202
203 /*!
203 /*!
204 \property QXYSeries::pointLabelsColor
204 \property QXYSeries::pointLabelsColor
205 Defines the color used for data point labels. By default, the color is the color of the brush
205 Defines the color used for data point labels. By default, the color is the color of the brush
206 defined in theme for labels.
206 defined in theme for labels.
207
207
208 \sa QXYSeries::pointLabelsFormat
208 \sa QXYSeries::pointLabelsFormat
209 */
209 */
210 /*!
210 /*!
211 \qmlproperty font XYSeries::pointLabelsColor
211 \qmlproperty font XYSeries::pointLabelsColor
212 Defines the color used for data point labels. By default, the color is the color of the brush
212 Defines the color used for data point labels. By default, the color is the color of the brush
213 defined in theme for labels.
213 defined in theme for labels.
214
214
215 \sa pointLabelsFormat
215 \sa pointLabelsFormat
216 */
216 */
217 /*!
217 /*!
218 \fn void QXYSeries::pointLabelsColorChanged(const QColor &color);
218 \fn void QXYSeries::pointLabelsColorChanged(const QColor &color);
219 The color used for data point labels is changed to \a color.
219 The color used for data point labels is changed to \a color.
220 */
220 */
221 /*!
221 /*!
222 \qmlsignal XYSeries::onPointLabelsColorChanged(Color color)
222 \qmlsignal XYSeries::onPointLabelsColorChanged(Color color)
223 The color used for data point labels is changed to \a color.
223 The color used for data point labels is changed to \a color.
224 */
224 */
225
225
226 /*!
226 /*!
227 \fn void QXYSeries::clicked(const QPointF& point)
227 \fn void QXYSeries::clicked(const QPointF& point)
228 \brief Signal is emitted when user clicks the \a point on chart. The \a point is the point
228 \brief Signal is emitted when user clicks the \a point on chart. The \a point is the point
229 where the press was triggered.
229 where the press was triggered.
230 \sa pressed, released, doubleClicked
230 \sa pressed, released, doubleClicked
231 */
231 */
232 /*!
232 /*!
233 \qmlsignal XYSeries::onClicked(QPointF point)
233 \qmlsignal XYSeries::onClicked(QPointF point)
234 Signal is emitted when user clicks the \a point on chart. The \a point is the point where the
234 Signal is emitted when user clicks the \a point on chart. The \a point is the point where the
235 press was triggered. For example:
235 press was triggered. For example:
236 \code
236 \code
237 LineSeries {
237 LineSeries {
238 XYPoint { x: 0; y: 0 }
238 XYPoint { x: 0; y: 0 }
239 XYPoint { x: 1.1; y: 2.1 }
239 XYPoint { x: 1.1; y: 2.1 }
240 onClicked: console.log("onClicked: " + point.x + ", " + point.y);
240 onClicked: console.log("onClicked: " + point.x + ", " + point.y);
241 }
241 }
242 \endcode
242 \endcode
243 \sa onPressed, onReleased, onDoubleClicked
243 \sa onPressed, onReleased, onDoubleClicked
244 */
244 */
245
245
246 /*!
246 /*!
247 \fn void QXYSeries::hovered(const QPointF &point, bool state)
247 \fn void QXYSeries::hovered(const QPointF &point, bool state)
248 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
248 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
249 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
249 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
250 the series.
250 the series.
251 */
251 */
252 /*!
252 /*!
253 \qmlsignal XYSeries::onHovered(point point, bool state)
253 \qmlsignal XYSeries::onHovered(point point, bool state)
254 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
254 This signal is emitted when user has hovered over or away from the series. \a point shows the origin (coordinate)
255 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
255 of the hover event. \a state is true when user has hovered over the series and false when hover has moved away from
256 the series.
256 the series.
257 */
257 */
258
258
259 /*!
259 /*!
260 \fn void QXYSeries::pressed(const QPointF& point)
260 \fn void QXYSeries::pressed(const QPointF& point)
261 \brief Signal is emitted when user presses the \a point on chart.
261 \brief Signal is emitted when user presses the \a point on chart.
262 \sa clicked, released, doubleClicked
262 \sa clicked, released, doubleClicked
263 */
263 */
264 /*!
264 /*!
265 \qmlsignal XYSeries::onPressed(QPointF point)
265 \qmlsignal XYSeries::onPressed(QPointF point)
266 Signal is emitted when user presses the \a point on chart. For example:
266 Signal is emitted when user presses the \a point on chart. For example:
267 \code
267 \code
268 LineSeries {
268 LineSeries {
269 XYPoint { x: 0; y: 0 }
269 XYPoint { x: 0; y: 0 }
270 XYPoint { x: 1.1; y: 2.1 }
270 XYPoint { x: 1.1; y: 2.1 }
271 onPressed: console.log("onPressed: " + point.x + ", " + point.y);
271 onPressed: console.log("onPressed: " + point.x + ", " + point.y);
272 }
272 }
273 \endcode
273 \endcode
274 \sa onClicked, onReleased, onDoubleClicked
274 \sa onClicked, onReleased, onDoubleClicked
275 */
275 */
276
276
277 /*!
277 /*!
278 \fn void QXYSeries::released(const QPointF& point)
278 \fn void QXYSeries::released(const QPointF& point)
279 \brief Signal is emitted when user releases a press that was triggered on a \a point on chart.
279 \brief Signal is emitted when user releases a press that was triggered on a \a point on chart.
280 \sa pressed, clicked, doubleClicked
280 \sa pressed, clicked, doubleClicked
281 */
281 */
282 /*!
282 /*!
283 \qmlsignal XYSeries::onReleased(QPointF point)
283 \qmlsignal XYSeries::onReleased(QPointF point)
284 Signal is emitted when user releases a press that was triggered on a \a point on chart.
284 Signal is emitted when user releases a press that was triggered on a \a point on chart.
285 For example:
285 For example:
286 \code
286 \code
287 LineSeries {
287 LineSeries {
288 XYPoint { x: 0; y: 0 }
288 XYPoint { x: 0; y: 0 }
289 XYPoint { x: 1.1; y: 2.1 }
289 XYPoint { x: 1.1; y: 2.1 }
290 onReleased: console.log("onReleased: " + point.x + ", " + point.y);
290 onReleased: console.log("onReleased: " + point.x + ", " + point.y);
291 }
291 }
292 \endcode
292 \endcode
293 \sa onPressed, onClicked, onDoubleClicked
293 \sa onPressed, onClicked, onDoubleClicked
294 */
294 */
295
295
296 /*!
296 /*!
297 \fn void QXYSeries::doubleClicked(const QPointF& point)
297 \fn void QXYSeries::doubleClicked(const QPointF& point)
298 \brief Signal is emitted when user doubleclicks the \a point on chart. The \a point is the
298 \brief Signal is emitted when user doubleclicks the \a point on chart. The \a point is the
299 point where the first press was triggered.
299 point where the first press was triggered.
300 \sa pressed, released, clicked
300 \sa pressed, released, clicked
301 */
301 */
302 /*!
302 /*!
303 \qmlsignal XYSeries::onDoubleClicked(QPointF point)
303 \qmlsignal XYSeries::onDoubleClicked(QPointF point)
304 Signal is emitted when user doubleclicks the \a point on chart. The \a point is the point where
304 Signal is emitted when user doubleclicks the \a point on chart. The \a point is the point where
305 the first press was triggered. For example:
305 the first press was triggered. For example:
306 \code
306 \code
307 LineSeries {
307 LineSeries {
308 XYPoint { x: 0; y: 0 }
308 XYPoint { x: 0; y: 0 }
309 XYPoint { x: 1.1; y: 2.1 }
309 XYPoint { x: 1.1; y: 2.1 }
310 onDoubleClicked: console.log("onDoubleClicked: " + point.x + ", " + point.y);
310 onDoubleClicked: console.log("onDoubleClicked: " + point.x + ", " + point.y);
311 }
311 }
312 \endcode
312 \endcode
313 \sa onPressed, onReleased, onClicked
313 \sa onPressed, onReleased, onClicked
314 */
314 */
315
315
316 /*!
316 /*!
317 \fn void QXYSeries::pointReplaced(int index)
317 \fn void QXYSeries::pointReplaced(int index)
318 Signal is emitted when a point has been replaced at \a index.
318 Signal is emitted when a point has been replaced at \a index.
319 \sa replace()
319 \sa replace()
320 */
320 */
321 /*!
321 /*!
322 \qmlsignal XYSeries::onPointReplaced(int index)
322 \qmlsignal XYSeries::onPointReplaced(int index)
323 Signal is emitted when a point has been replaced at \a index.
323 Signal is emitted when a point has been replaced at \a index.
324 */
324 */
325
325
326 /*!
326 /*!
327 \fn void QXYSeries::pointsReplaced()
327 \fn void QXYSeries::pointsReplaced()
328 Signal is emitted when all points have been replaced with other points.
328 Signal is emitted when all points have been replaced with other points.
329 \sa replace()
329 \sa replace()
330 */
330 */
331 /*!
331 /*!
332 \qmlsignal XYSeries::onPointsReplaced()
332 \qmlsignal XYSeries::onPointsReplaced()
333 Signal is emitted when all points have been replaced with other points.
333 Signal is emitted when all points have been replaced with other points.
334 */
334 */
335
335
336 /*!
336 /*!
337 \fn void QXYSeries::pointAdded(int index)
337 \fn void QXYSeries::pointAdded(int index)
338 Signal is emitted when a point has been added at \a index.
338 Signal is emitted when a point has been added at \a index.
339 \sa append(), insert()
339 \sa append(), insert()
340 */
340 */
341 /*!
341 /*!
342 \qmlsignal XYSeries::onPointAdded(int index)
342 \qmlsignal XYSeries::onPointAdded(int index)
343 Signal is emitted when a point has been added at \a index.
343 Signal is emitted when a point has been added at \a index.
344 */
344 */
345
345
346 /*!
346 /*!
347 \fn void QXYSeries::pointRemoved(int index)
347 \fn void QXYSeries::pointRemoved(int index)
348 Signal is emitted when a point has been removed from \a index.
348 Signal is emitted when a point has been removed from \a index.
349 \sa remove()
349 \sa remove()
350 */
350 */
351
351
352 /*!
352 /*!
353 \qmlsignal XYSeries::onPointRemoved(int index)
353 \qmlsignal XYSeries::onPointRemoved(int index)
354 Signal is emitted when a point has been removed from \a index.
354 Signal is emitted when a point has been removed from \a index.
355 */
355 */
356
356
357 /*!
357 /*!
358 \fn void QXYSeries::colorChanged(QColor color)
358 \fn void QXYSeries::colorChanged(QColor color)
359 \brief Signal is emitted when the line (pen) color has changed to \a color.
359 \brief Signal is emitted when the line (pen) color has changed to \a color.
360 */
360 */
361 /*!
361 /*!
362 \qmlsignal XYSeries::onColorChanged(color color)
362 \qmlsignal XYSeries::onColorChanged(color color)
363 Signal is emitted when the line (pen) color has changed to \a color.
363 Signal is emitted when the line (pen) color has changed to \a color.
364 */
364 */
365
365
366 /*!
366 /*!
367 \fn void QXYSeriesPrivate::updated()
367 \fn void QXYSeriesPrivate::updated()
368 \brief \internal
368 \brief \internal
369 */
369 */
370
370
371 /*!
371 /*!
372 \qmlmethod XYSeries::append(real x, real y)
372 \qmlmethod XYSeries::append(real x, real y)
373 Append point (\a x, \a y) to the series
373 Append point (\a x, \a y) to the series
374 */
374 */
375
375
376 /*!
376 /*!
377 \qmlmethod XYSeries::replace(real oldX, real oldY, real newX, real newY)
377 \qmlmethod XYSeries::replace(real oldX, real oldY, real newX, real newY)
378 Replaces point (\a oldX, \a oldY) with point (\a newX, \a newY). Does nothing, if point (oldX, oldY) does not
378 Replaces point (\a oldX, \a oldY) with point (\a newX, \a newY). Does nothing, if point (oldX, oldY) does not
379 exist.
379 exist.
380 */
380 */
381
381
382 /*!
382 /*!
383 \qmlmethod XYSeries::remove(real x, real y)
383 \qmlmethod XYSeries::remove(real x, real y)
384 Removes point (\a x, \a y) from the series. Does nothing, if point (x, y) does not exist.
384 Removes point (\a x, \a y) from the series. Does nothing, if point (x, y) does not exist.
385 */
385 */
386
386
387 /*!
387 /*!
388 \qmlmethod XYSeries::insert(int index, real x, real y)
388 \qmlmethod XYSeries::insert(int index, real x, real y)
389 Inserts point (\a x, \a y) to the \a index. If index is 0 or smaller than 0 the point is prepended to the list of
389 Inserts point (\a x, \a y) to the \a index. If index is 0 or smaller than 0 the point is prepended to the list of
390 points. If index is the same as or bigger than count, the point is appended to the list of points.
390 points. If index is the same as or bigger than count, the point is appended to the list of points.
391 */
391 */
392
392
393 /*!
393 /*!
394 \qmlmethod QPointF XYSeries::at(int index)
394 \qmlmethod QPointF XYSeries::at(int index)
395 Returns point at \a index. Returns (0, 0) if the index is not valid.
395 Returns point at \a index. Returns (0, 0) if the index is not valid.
396 */
396 */
397
397
398 /*!
398 /*!
399 \internal
399 \internal
400
400
401 Constructs empty series object which is a child of \a parent.
401 Constructs empty series object which is a child of \a parent.
402 When series object is added to QChart instance ownerships is transferred.
402 When series object is added to QChart instance ownerships is transferred.
403 */
403 */
404 QXYSeries::QXYSeries(QXYSeriesPrivate &d, QObject *parent)
404 QXYSeries::QXYSeries(QXYSeriesPrivate &d, QObject *parent)
405 : QAbstractSeries(d, parent)
405 : QAbstractSeries(d, parent)
406 {
406 {
407 }
407 }
408
408
409 /*!
409 /*!
410 Destroys the object. Series added to QChart instances are owned by those,
410 Destroys the object. Series added to QChart instances are owned by those,
411 and are destroyed when QChart instances are destroyed.
411 and are destroyed when QChart instances are destroyed.
412 */
412 */
413 QXYSeries::~QXYSeries()
413 QXYSeries::~QXYSeries()
414 {
414 {
415 }
415 }
416
416
417 /*!
417 /*!
418 Adds data point (\a x, \a y) to the series.
418 Adds data point (\a x, \a y) to the series.
419 */
419 */
420 void QXYSeries::append(qreal x, qreal y)
420 void QXYSeries::append(qreal x, qreal y)
421 {
421 {
422 append(QPointF(x, y));
422 append(QPointF(x, y));
423 }
423 }
424
424
425 /*!
425 /*!
426 This is an overloaded function.
426 This is an overloaded function.
427 Adds data \a point to the series.
427 Adds data \a point to the series.
428 */
428 */
429 void QXYSeries::append(const QPointF &point)
429 void QXYSeries::append(const QPointF &point)
430 {
430 {
431 Q_D(QXYSeries);
431 Q_D(QXYSeries);
432
432
433 if (isValidValue(point)) {
433 if (isValidValue(point)) {
434 d->m_points << point;
434 d->m_points << point;
435 emit pointAdded(d->m_points.count() - 1);
435 emit pointAdded(d->m_points.count() - 1);
436 }
436 }
437 }
437 }
438
438
439 /*!
439 /*!
440 This is an overloaded function.
440 This is an overloaded function.
441 Adds list of data \a points to the series.
441 Adds list of data \a points to the series.
442 */
442 */
443 void QXYSeries::append(const QList<QPointF> &points)
443 void QXYSeries::append(const QList<QPointF> &points)
444 {
444 {
445 foreach (const QPointF &point , points)
445 foreach (const QPointF &point , points)
446 append(point);
446 append(point);
447 }
447 }
448
448
449 /*!
449 /*!
450 Replaces data point (\a oldX, \a oldY) with data point (\a newX, \a newY).
450 Replaces data point (\a oldX, \a oldY) with data point (\a newX, \a newY).
451 \sa QXYSeries::pointReplaced()
451 \sa QXYSeries::pointReplaced()
452 */
452 */
453 void QXYSeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
453 void QXYSeries::replace(qreal oldX, qreal oldY, qreal newX, qreal newY)
454 {
454 {
455 replace(QPointF(oldX, oldY), QPointF(newX, newY));
455 replace(QPointF(oldX, oldY), QPointF(newX, newY));
456 }
456 }
457
457
458 /*!
458 /*!
459 Replaces \a oldPoint with \a newPoint.
459 Replaces \a oldPoint with \a newPoint.
460 \sa QXYSeries::pointReplaced()
460 \sa QXYSeries::pointReplaced()
461 */
461 */
462 void QXYSeries::replace(const QPointF &oldPoint, const QPointF &newPoint)
462 void QXYSeries::replace(const QPointF &oldPoint, const QPointF &newPoint)
463 {
463 {
464 Q_D(QXYSeries);
464 Q_D(QXYSeries);
465 int index = d->m_points.indexOf(oldPoint);
465 int index = d->m_points.indexOf(oldPoint);
466 if (index == -1)
466 if (index == -1)
467 return;
467 return;
468 replace(index, newPoint);
468 replace(index, newPoint);
469 }
469 }
470
470
471 /*!
471 /*!
472 Replaces the point at \a index with data point (\a newX, \a newY).
472 Replaces the point at \a index with data point (\a newX, \a newY).
473 \sa QXYSeries::pointReplaced()
473 \sa QXYSeries::pointReplaced()
474 */
474 */
475 void QXYSeries::replace(int index, qreal newX, qreal newY)
475 void QXYSeries::replace(int index, qreal newX, qreal newY)
476 {
476 {
477 replace(index, QPointF(newX, newY));
477 replace(index, QPointF(newX, newY));
478 }
478 }
479
479
480 /*!
480 /*!
481 Replaces the point at \a index with \a newPoint.
481 Replaces the point at \a index with \a newPoint.
482 \sa QXYSeries::pointReplaced()
482 \sa QXYSeries::pointReplaced()
483 */
483 */
484 void QXYSeries::replace(int index, const QPointF &newPoint)
484 void QXYSeries::replace(int index, const QPointF &newPoint)
485 {
485 {
486 Q_D(QXYSeries);
486 Q_D(QXYSeries);
487 if (isValidValue(newPoint)) {
487 if (isValidValue(newPoint)) {
488 d->m_points[index] = newPoint;
488 d->m_points[index] = newPoint;
489 emit pointReplaced(index);
489 emit pointReplaced(index);
490 }
490 }
491 }
491 }
492
492
493 /*!
493 /*!
494 Replaces the current points with \a points.
494 Replaces the current points with \a points.
495 \note This is much faster than replacing data points one by one,
495 \note This is much faster than replacing data points one by one,
496 or first clearing all data, and then appending the new data. Emits QXYSeries::pointsReplaced()
496 or first clearing all data, and then appending the new data. Emits QXYSeries::pointsReplaced()
497 when the points have been replaced.
497 when the points have been replaced.
498 \sa QXYSeries::pointsReplaced()
498 \sa QXYSeries::pointsReplaced()
499 */
499 */
500 void QXYSeries::replace(QList<QPointF> points)
500 void QXYSeries::replace(QList<QPointF> points)
501 {
501 {
502 Q_D(QXYSeries);
502 Q_D(QXYSeries);
503 d->m_points = points.toVector();
503 d->m_points = points.toVector();
504 emit pointsReplaced();
504 emit pointsReplaced();
505 }
505 }
506
506
507 /*!
507 /*!
508 Removes the point (\a x, \a y) from the series.
508 Removes the point (\a x, \a y) from the series.
509 */
509 */
510 void QXYSeries::remove(qreal x, qreal y)
510 void QXYSeries::remove(qreal x, qreal y)
511 {
511 {
512 remove(QPointF(x, y));
512 remove(QPointF(x, y));
513 }
513 }
514
514
515 /*!
515 /*!
516 Removes the \a point from the series.
516 Removes the \a point from the series.
517 */
517 */
518 void QXYSeries::remove(const QPointF &point)
518 void QXYSeries::remove(const QPointF &point)
519 {
519 {
520 Q_D(QXYSeries);
520 Q_D(QXYSeries);
521 int index = d->m_points.indexOf(point);
521 int index = d->m_points.indexOf(point);
522 if (index == -1)
522 if (index == -1)
523 return;
523 return;
524 remove(index);
524 remove(index);
525 }
525 }
526
526
527 /*!
527 /*!
528 Removes the point at \a index from the series.
528 Removes the point at \a index from the series.
529 */
529 */
530 void QXYSeries::remove(int index)
530 void QXYSeries::remove(int index)
531 {
531 {
532 Q_D(QXYSeries);
532 Q_D(QXYSeries);
533 d->m_points.remove(index);
533 d->m_points.remove(index);
534 emit pointRemoved(index);
534 emit pointRemoved(index);
535 }
535 }
536
536
537 /*!
537 /*!
538 Inserts a \a point in the series at \a index position.
538 Inserts a \a point in the series at \a index position.
539 */
539 */
540 void QXYSeries::insert(int index, const QPointF &point)
540 void QXYSeries::insert(int index, const QPointF &point)
541 {
541 {
542 Q_D(QXYSeries);
542 Q_D(QXYSeries);
543 if (isValidValue(point)) {
543 if (isValidValue(point)) {
544 index = qMax(0, qMin(index, d->m_points.size()));
544 index = qMax(0, qMin(index, d->m_points.size()));
545 d->m_points.insert(index, point);
545 d->m_points.insert(index, point);
546 emit pointAdded(index);
546 emit pointAdded(index);
547 }
547 }
548 }
548 }
549
549
550 /*!
550 /*!
551 Removes all points from the series.
551 Removes all points from the series.
552 */
552 */
553 void QXYSeries::clear()
553 void QXYSeries::clear()
554 {
554 {
555 Q_D(QXYSeries);
555 Q_D(QXYSeries);
556 for (int i = d->m_points.size() - 1; i >= 0; i--)
556 for (int i = d->m_points.size() - 1; i >= 0; i--)
557 remove(d->m_points.at(i));
557 remove(d->m_points.at(i));
558 }
558 }
559
559
560 /*!
560 /*!
561 Returns list of points in the series.
561 Returns list of points in the series.
562 */
562 */
563 QList<QPointF> QXYSeries::points() const
563 QList<QPointF> QXYSeries::points() const
564 {
564 {
565 Q_D(const QXYSeries);
565 Q_D(const QXYSeries);
566 return d->m_points.toList();
566 return d->m_points.toList();
567 }
567 }
568
568
569 /*!
569 /*!
570 Returns point at \a index in internal points vector.
570 Returns point at \a index in internal points vector.
571 */
571 */
572 const QPointF &QXYSeries::at(int index) const
572 const QPointF &QXYSeries::at(int index) const
573 {
573 {
574 Q_D(const QXYSeries);
574 Q_D(const QXYSeries);
575 return d->m_points.at(index);
575 return d->m_points.at(index);
576 }
576 }
577
577
578 /*!
578 /*!
579 Returns number of data points within series.
579 Returns number of data points within series.
580 */
580 */
581 int QXYSeries::count() const
581 int QXYSeries::count() const
582 {
582 {
583 Q_D(const QXYSeries);
583 Q_D(const QXYSeries);
584 return d->m_points.count();
584 return d->m_points.count();
585 }
585 }
586
586
587
587
588 /*!
588 /*!
589 Sets \a pen used for drawing points on the chart. If the pen is not defined, the
589 Sets \a pen used for drawing points on the chart. If the pen is not defined, the
590 pen from chart theme is used.
590 pen from chart theme is used.
591 \sa QChart::setTheme()
591 \sa QChart::setTheme()
592 */
592 */
593 void QXYSeries::setPen(const QPen &pen)
593 void QXYSeries::setPen(const QPen &pen)
594 {
594 {
595 Q_D(QXYSeries);
595 Q_D(QXYSeries);
596 if (d->m_pen != pen) {
596 if (d->m_pen != pen) {
597 bool emitColorChanged = d->m_pen.color() != pen.color();
597 bool emitColorChanged = d->m_pen.color() != pen.color();
598 d->m_pen = pen;
598 d->m_pen = pen;
599 emit d->updated();
599 emit d->updated();
600 if (emitColorChanged)
600 if (emitColorChanged)
601 emit colorChanged(pen.color());
601 emit colorChanged(pen.color());
602 }
602 }
603 }
603 }
604
604
605 QPen QXYSeries::pen() const
605 QPen QXYSeries::pen() const
606 {
606 {
607 Q_D(const QXYSeries);
607 Q_D(const QXYSeries);
608 if (d->m_pen == QChartPrivate::defaultPen())
608 if (d->m_pen == QChartPrivate::defaultPen())
609 return QPen();
609 return QPen();
610 else
610 else
611 return d->m_pen;
611 return d->m_pen;
612 }
612 }
613
613
614 /*!
614 /*!
615 Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
615 Sets \a brush used for drawing points on the chart. If the brush is not defined, brush
616 from chart theme setting is used.
616 from chart theme setting is used.
617 \sa QChart::setTheme()
617 \sa QChart::setTheme()
618 */
618 */
619 void QXYSeries::setBrush(const QBrush &brush)
619 void QXYSeries::setBrush(const QBrush &brush)
620 {
620 {
621 Q_D(QXYSeries);
621 Q_D(QXYSeries);
622 if (d->m_brush != brush) {
622 if (d->m_brush != brush) {
623 d->m_brush = brush;
623 d->m_brush = brush;
624 emit d->updated();
624 emit d->updated();
625 }
625 }
626 }
626 }
627
627
628 QBrush QXYSeries::brush() const
628 QBrush QXYSeries::brush() const
629 {
629 {
630 Q_D(const QXYSeries);
630 Q_D(const QXYSeries);
631 if (d->m_brush == QChartPrivate::defaultBrush())
631 if (d->m_brush == QChartPrivate::defaultBrush())
632 return QBrush();
632 return QBrush();
633 else
633 else
634 return d->m_brush;
634 return d->m_brush;
635 }
635 }
636
636
637 void QXYSeries::setColor(const QColor &color)
637 void QXYSeries::setColor(const QColor &color)
638 {
638 {
639 QPen p = pen();
639 QPen p = pen();
640 if (p.color() != color) {
640 if (p.color() != color) {
641 p.setColor(color);
641 p.setColor(color);
642 setPen(p);
642 setPen(p);
643 }
643 }
644 }
644 }
645
645
646 QColor QXYSeries::color() const
646 QColor QXYSeries::color() const
647 {
647 {
648 return pen().color();
648 return pen().color();
649 }
649 }
650
650
651 void QXYSeries::setPointsVisible(bool visible)
651 void QXYSeries::setPointsVisible(bool visible)
652 {
652 {
653 Q_D(QXYSeries);
653 Q_D(QXYSeries);
654 if (d->m_pointsVisible != visible) {
654 if (d->m_pointsVisible != visible) {
655 d->m_pointsVisible = visible;
655 d->m_pointsVisible = visible;
656 emit d->updated();
656 emit d->updated();
657 }
657 }
658 }
658 }
659
659
660 bool QXYSeries::pointsVisible() const
660 bool QXYSeries::pointsVisible() const
661 {
661 {
662 Q_D(const QXYSeries);
662 Q_D(const QXYSeries);
663 return d->m_pointsVisible;
663 return d->m_pointsVisible;
664 }
664 }
665
665
666 void QXYSeries::setPointLabelsFormat(const QString &format)
666 void QXYSeries::setPointLabelsFormat(const QString &format)
667 {
667 {
668 Q_D(QXYSeries);
668 Q_D(QXYSeries);
669 if (d->m_pointLabelsFormat != format) {
669 if (d->m_pointLabelsFormat != format) {
670 d->m_pointLabelsFormat = format;
670 d->m_pointLabelsFormat = format;
671 emit pointLabelsFormatChanged(format);
671 emit pointLabelsFormatChanged(format);
672 }
672 }
673 }
673 }
674
674
675 QString QXYSeries::pointLabelsFormat() const
675 QString QXYSeries::pointLabelsFormat() const
676 {
676 {
677 Q_D(const QXYSeries);
677 Q_D(const QXYSeries);
678 return d->m_pointLabelsFormat;
678 return d->m_pointLabelsFormat;
679 }
679 }
680
680
681 void QXYSeries::setPointLabelsVisible(bool visible)
681 void QXYSeries::setPointLabelsVisible(bool visible)
682 {
682 {
683 Q_D(QXYSeries);
683 Q_D(QXYSeries);
684 if (d->m_pointLabelsVisible != visible) {
684 if (d->m_pointLabelsVisible != visible) {
685 d->m_pointLabelsVisible = visible;
685 d->m_pointLabelsVisible = visible;
686 emit pointLabelsVisibilityChanged(visible);
686 emit pointLabelsVisibilityChanged(visible);
687 }
687 }
688 }
688 }
689
689
690 bool QXYSeries::pointLabelsVisible() const
690 bool QXYSeries::pointLabelsVisible() const
691 {
691 {
692 Q_D(const QXYSeries);
692 Q_D(const QXYSeries);
693 return d->m_pointLabelsVisible;
693 return d->m_pointLabelsVisible;
694 }
694 }
695
695
696 void QXYSeries::setPointLabelsFont(const QFont &font)
696 void QXYSeries::setPointLabelsFont(const QFont &font)
697 {
697 {
698 Q_D(QXYSeries);
698 Q_D(QXYSeries);
699 if (d->m_pointLabelsFont != font) {
699 if (d->m_pointLabelsFont != font) {
700 d->m_pointLabelsFont = font;
700 d->m_pointLabelsFont = font;
701 emit pointLabelsFontChanged(font);
701 emit pointLabelsFontChanged(font);
702 }
702 }
703 }
703 }
704
704
705 QFont QXYSeries::pointLabelsFont() const
705 QFont QXYSeries::pointLabelsFont() const
706 {
706 {
707 Q_D(const QXYSeries);
707 Q_D(const QXYSeries);
708 return d->m_pointLabelsFont;
708 return d->m_pointLabelsFont;
709 }
709 }
710
710
711 void QXYSeries::setPointLabelsColor(const QColor &color)
711 void QXYSeries::setPointLabelsColor(const QColor &color)
712 {
712 {
713 Q_D(QXYSeries);
713 Q_D(QXYSeries);
714 if (d->m_pointLabelsColor != color) {
714 if (d->m_pointLabelsColor != color) {
715 d->m_pointLabelsColor = color;
715 d->m_pointLabelsColor = color;
716 emit pointLabelsColorChanged(color);
716 emit pointLabelsColorChanged(color);
717 }
717 }
718 }
718 }
719
719
720 QColor QXYSeries::pointLabelsColor() const
720 QColor QXYSeries::pointLabelsColor() const
721 {
721 {
722 Q_D(const QXYSeries);
722 Q_D(const QXYSeries);
723 if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
723 if (d->m_pointLabelsColor == QChartPrivate::defaultPen().color())
724 return QPen().color();
724 return QPen().color();
725 else
725 else
726 return d->m_pointLabelsColor;
726 return d->m_pointLabelsColor;
727 }
727 }
728
728
729 /*!
729 /*!
730 Stream operator for adding a data \a point to the series.
730 Stream operator for adding a data \a point to the series.
731 \sa append()
731 \sa append()
732 */
732 */
733 QXYSeries &QXYSeries::operator<< (const QPointF &point)
733 QXYSeries &QXYSeries::operator<< (const QPointF &point)
734 {
734 {
735 append(point);
735 append(point);
736 return *this;
736 return *this;
737 }
737 }
738
738
739
739
740 /*!
740 /*!
741 Stream operator for adding a list of \a points to the series.
741 Stream operator for adding a list of \a points to the series.
742 \sa append()
742 \sa append()
743 */
743 */
744
744
745 QXYSeries &QXYSeries::operator<< (const QList<QPointF>& points)
745 QXYSeries &QXYSeries::operator<< (const QList<QPointF>& points)
746 {
746 {
747 append(points);
747 append(points);
748 return *this;
748 return *this;
749 }
749 }
750
750
751 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
751 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
752
752
753
753
754 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q)
754 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q)
755 : QAbstractSeriesPrivate(q),
755 : QAbstractSeriesPrivate(q),
756 m_pen(QChartPrivate::defaultPen()),
756 m_pen(QChartPrivate::defaultPen()),
757 m_brush(QChartPrivate::defaultBrush()),
757 m_brush(QChartPrivate::defaultBrush()),
758 m_pointsVisible(false),
758 m_pointsVisible(false),
759 m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
759 m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")),
760 m_pointLabelsVisible(false),
760 m_pointLabelsVisible(false),
761 m_pointLabelsFont(QChartPrivate::defaultFont()),
761 m_pointLabelsFont(QChartPrivate::defaultFont()),
762 m_pointLabelsColor(QChartPrivate::defaultPen().color())
762 m_pointLabelsColor(QChartPrivate::defaultPen().color())
763 {
763 {
764 }
764 }
765
765
766 void QXYSeriesPrivate::initializeDomain()
766 void QXYSeriesPrivate::initializeDomain()
767 {
767 {
768 qreal minX(0);
768 qreal minX(0);
769 qreal minY(0);
769 qreal minY(0);
770 qreal maxX(1);
770 qreal maxX(1);
771 qreal maxY(1);
771 qreal maxY(1);
772
772
773 Q_Q(QXYSeries);
773 Q_Q(QXYSeries);
774
774
775 const QList<QPointF>& points = q->points();
775 const QList<QPointF>& points = q->points();
776
776
777 if (!points.isEmpty()) {
777 if (!points.isEmpty()) {
778 minX = points[0].x();
778 minX = points[0].x();
779 minY = points[0].y();
779 minY = points[0].y();
780 maxX = minX;
780 maxX = minX;
781 maxY = minY;
781 maxY = minY;
782
782
783 for (int i = 0; i < points.count(); i++) {
783 for (int i = 0; i < points.count(); i++) {
784 qreal x = points[i].x();
784 qreal x = points[i].x();
785 qreal y = points[i].y();
785 qreal y = points[i].y();
786 minX = qMin(minX, x);
786 minX = qMin(minX, x);
787 minY = qMin(minY, y);
787 minY = qMin(minY, y);
788 maxX = qMax(maxX, x);
788 maxX = qMax(maxX, x);
789 maxY = qMax(maxY, y);
789 maxY = qMax(maxY, y);
790 }
790 }
791 }
791 }
792
792
793 domain()->setRange(minX, maxX, minY, maxY);
793 domain()->setRange(minX, maxX, minY, maxY);
794 }
794 }
795
795
796 QList<QLegendMarker*> QXYSeriesPrivate::createLegendMarkers(QLegend* legend)
796 QList<QLegendMarker*> QXYSeriesPrivate::createLegendMarkers(QLegend* legend)
797 {
797 {
798 Q_Q(QXYSeries);
798 Q_Q(QXYSeries);
799 QList<QLegendMarker*> list;
799 QList<QLegendMarker*> list;
800 return list << new QXYLegendMarker(q,legend);
800 return list << new QXYLegendMarker(q,legend);
801 }
801 }
802
802
803 void QXYSeriesPrivate::initializeAxes()
803 void QXYSeriesPrivate::initializeAxes()
804 {
804 {
805
805
806 }
806 }
807
807
808 QAbstractAxis::AxisType QXYSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
808 QAbstractAxis::AxisType QXYSeriesPrivate::defaultAxisType(Qt::Orientation orientation) const
809 {
809 {
810 Q_UNUSED(orientation);
810 Q_UNUSED(orientation);
811 return QAbstractAxis::AxisTypeValue;
811 return QAbstractAxis::AxisTypeValue;
812 }
812 }
813
813
814 QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
814 QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
815 {
815 {
816 Q_UNUSED(orientation);
816 Q_UNUSED(orientation);
817 return new QValueAxis;
817 return new QValueAxis;
818 }
818 }
819
819
820 void QXYSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options)
820 void QXYSeriesPrivate::initializeAnimations(QtCharts::QChart::AnimationOptions options)
821 {
821 {
822 XYChart *item = static_cast<XYChart *>(m_item.data());
822 XYChart *item = static_cast<XYChart *>(m_item.data());
823 Q_ASSERT(item);
823 Q_ASSERT(item);
824 if (item->animation())
824 if (item->animation())
825 item->animation()->stopAndDestroyLater();
825 item->animation()->stopAndDestroyLater();
826
826
827 if (options.testFlag(QChart::SeriesAnimations))
827 if (options.testFlag(QChart::SeriesAnimations))
828 item->setAnimation(new XYAnimation(item));
828 item->setAnimation(new XYAnimation(item));
829 else
829 else
830 item->setAnimation(0);
830 item->setAnimation(0);
831 QAbstractSeriesPrivate::initializeAnimations(options);
831 QAbstractSeriesPrivate::initializeAnimations(options);
832 }
832 }
833
833
834 void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
834 void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QPointF> &points,
835 const int offset)
835 const int offset)
836 {
836 {
837 static const QString xPointTag(QLatin1String("@xPoint"));
837 static const QString xPointTag(QLatin1String("@xPoint"));
838 static const QString yPointTag(QLatin1String("@yPoint"));
838 static const QString yPointTag(QLatin1String("@yPoint"));
839 const int labelOffset = offset + 2;
839 const int labelOffset = offset + 2;
840
840
841 painter->setFont(m_pointLabelsFont);
841 painter->setFont(m_pointLabelsFont);
842 painter->setPen(QPen(m_pointLabelsColor));
842 painter->setPen(QPen(m_pointLabelsColor));
843 QFontMetrics fm(painter->font());
843 QFontMetrics fm(painter->font());
844 // m_points is used for the label here as it has the series point information
844 // m_points is used for the label here as it has the series point information
845 // points variable passed is used for positioning because it has the coordinates
845 // points variable passed is used for positioning because it has the coordinates
846 for (int i(0); i < m_points.size(); i++) {
846 for (int i(0); i < m_points.size(); i++) {
847 QString pointLabel = m_pointLabelsFormat;
847 QString pointLabel = m_pointLabelsFormat;
848 pointLabel.replace(xPointTag, presenter()->numberToString(m_points.at(i).x()));
848 pointLabel.replace(xPointTag, presenter()->numberToString(m_points.at(i).x()));
849 pointLabel.replace(yPointTag, presenter()->numberToString(m_points.at(i).y()));
849 pointLabel.replace(yPointTag, presenter()->numberToString(m_points.at(i).y()));
850
850
851 // Position text in relation to the point
851 // Position text in relation to the point
852 int pointLabelWidth = fm.width(pointLabel);
852 int pointLabelWidth = fm.width(pointLabel);
853 QPointF position(points.at(i));
853 QPointF position(points.at(i));
854 position.setX(position.x() - pointLabelWidth / 2);
854 if (!reverseXAxis())
855 position.setY(position.y() - labelOffset);
855 position.setX(position.x() - pointLabelWidth / 2);
856 else
857 position.setX(domain()->size().width() - position.x() - pointLabelWidth / 2);
858 if (!reverseYAxis())
859 position.setY(position.y() - labelOffset);
860 else
861 position.setY(domain()->size().height() - position.y() - labelOffset);
856
862
857 painter->drawText(position, pointLabel);
863 painter->drawText(position, pointLabel);
858 }
864 }
859 }
865 }
860
866
861 #include "moc_qxyseries.cpp"
867 #include "moc_qxyseries.cpp"
862 #include "moc_qxyseries_p.cpp"
868 #include "moc_qxyseries_p.cpp"
863
869
864 QT_CHARTS_END_NAMESPACE
870 QT_CHARTS_END_NAMESPACE
@@ -1,314 +1,316
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include <QtCharts/QChart>
19 #include <QtCharts/QChart>
20 #include <QtCharts/QAbstractAxis>
20 #include <QtCharts/QAbstractAxis>
21 #include <QtCharts/QValueAxis>
21 #include <QtCharts/QValueAxis>
22 #include <QtCharts/QLogValueAxis>
22 #include <QtCharts/QLogValueAxis>
23 #include "declarativecategoryaxis.h"
23 #include "declarativecategoryaxis.h"
24 #include <QtCharts/QBarCategoryAxis>
24 #include <QtCharts/QBarCategoryAxis>
25 #include "declarativechart.h"
25 #include "declarativechart.h"
26 #include "declarativepolarchart.h"
26 #include "declarativepolarchart.h"
27 #include "declarativexypoint.h"
27 #include "declarativexypoint.h"
28 #include "declarativelineseries.h"
28 #include "declarativelineseries.h"
29 #include "declarativesplineseries.h"
29 #include "declarativesplineseries.h"
30 #include "declarativeareaseries.h"
30 #include "declarativeareaseries.h"
31 #include "declarativescatterseries.h"
31 #include "declarativescatterseries.h"
32 #include "declarativebarseries.h"
32 #include "declarativebarseries.h"
33 #include "declarativeboxplotseries.h"
33 #include "declarativeboxplotseries.h"
34 #include "declarativepieseries.h"
34 #include "declarativepieseries.h"
35 #include "declarativeaxes.h"
35 #include "declarativeaxes.h"
36 #include <QtCharts/QVXYModelMapper>
36 #include <QtCharts/QVXYModelMapper>
37 #include <QtCharts/QHXYModelMapper>
37 #include <QtCharts/QHXYModelMapper>
38 #include <QtCharts/QHPieModelMapper>
38 #include <QtCharts/QHPieModelMapper>
39 #include <QtCharts/QVPieModelMapper>
39 #include <QtCharts/QVPieModelMapper>
40 #include <QtCharts/QHBarModelMapper>
40 #include <QtCharts/QHBarModelMapper>
41 #include <QtCharts/QVBarModelMapper>
41 #include <QtCharts/QVBarModelMapper>
42 #include "declarativemargins.h"
42 #include "declarativemargins.h"
43 #include <QtCharts/QAreaLegendMarker>
43 #include <QtCharts/QAreaLegendMarker>
44 #include <QtCharts/QBarLegendMarker>
44 #include <QtCharts/QBarLegendMarker>
45 #include <QtCharts/QPieLegendMarker>
45 #include <QtCharts/QPieLegendMarker>
46 #include <QtCharts/QXYLegendMarker>
46 #include <QtCharts/QXYLegendMarker>
47 #include <QtCharts/QBoxPlotModelMapper>
47 #include <QtCharts/QBoxPlotModelMapper>
48 #include <QtCharts/QVBoxPlotModelMapper>
48 #include <QtCharts/QVBoxPlotModelMapper>
49 #ifndef QT_ON_ARM
49 #ifndef QT_ON_ARM
50 #include <QtCharts/QDateTimeAxis>
50 #include <QtCharts/QDateTimeAxis>
51 #endif
51 #endif
52 #include <QtCore/QAbstractItemModel>
52 #include <QtCore/QAbstractItemModel>
53 #include <QtQml>
53 #include <QtQml>
54
54
55 QT_CHARTS_USE_NAMESPACE
55 QT_CHARTS_USE_NAMESPACE
56
56
57 QML_DECLARE_TYPE(QList<QPieSlice *>)
57 QML_DECLARE_TYPE(QList<QPieSlice *>)
58 QML_DECLARE_TYPE(QList<QBarSet *>)
58 QML_DECLARE_TYPE(QList<QBarSet *>)
59 QML_DECLARE_TYPE(QList<QAbstractAxis *>)
59 QML_DECLARE_TYPE(QList<QAbstractAxis *>)
60
60
61 QML_DECLARE_TYPE(DeclarativeChart)
61 QML_DECLARE_TYPE(DeclarativeChart)
62 QML_DECLARE_TYPE(DeclarativePolarChart)
62 QML_DECLARE_TYPE(DeclarativePolarChart)
63 QML_DECLARE_TYPE(DeclarativeMargins)
63 QML_DECLARE_TYPE(DeclarativeMargins)
64 QML_DECLARE_TYPE(DeclarativeAreaSeries)
64 QML_DECLARE_TYPE(DeclarativeAreaSeries)
65 QML_DECLARE_TYPE(DeclarativeBarSeries)
65 QML_DECLARE_TYPE(DeclarativeBarSeries)
66 QML_DECLARE_TYPE(DeclarativeBarSet)
66 QML_DECLARE_TYPE(DeclarativeBarSet)
67 QML_DECLARE_TYPE(DeclarativeBoxPlotSeries)
67 QML_DECLARE_TYPE(DeclarativeBoxPlotSeries)
68 QML_DECLARE_TYPE(DeclarativeBoxSet)
68 QML_DECLARE_TYPE(DeclarativeBoxSet)
69 QML_DECLARE_TYPE(DeclarativeLineSeries)
69 QML_DECLARE_TYPE(DeclarativeLineSeries)
70 QML_DECLARE_TYPE(DeclarativePieSeries)
70 QML_DECLARE_TYPE(DeclarativePieSeries)
71 QML_DECLARE_TYPE(DeclarativePieSlice)
71 QML_DECLARE_TYPE(DeclarativePieSlice)
72 QML_DECLARE_TYPE(DeclarativeScatterSeries)
72 QML_DECLARE_TYPE(DeclarativeScatterSeries)
73 QML_DECLARE_TYPE(DeclarativeSplineSeries)
73 QML_DECLARE_TYPE(DeclarativeSplineSeries)
74
74
75 QML_DECLARE_TYPE(QAbstractAxis)
75 QML_DECLARE_TYPE(QAbstractAxis)
76 QML_DECLARE_TYPE(QValueAxis)
76 QML_DECLARE_TYPE(QValueAxis)
77 QML_DECLARE_TYPE(QBarCategoryAxis)
77 QML_DECLARE_TYPE(QBarCategoryAxis)
78 QML_DECLARE_TYPE(QCategoryAxis)
78 QML_DECLARE_TYPE(QCategoryAxis)
79 QML_DECLARE_TYPE(QDateTimeAxis)
79 QML_DECLARE_TYPE(QDateTimeAxis)
80 QML_DECLARE_TYPE(QLogValueAxis)
80 QML_DECLARE_TYPE(QLogValueAxis)
81
81
82 QML_DECLARE_TYPE(QLegend)
82 QML_DECLARE_TYPE(QLegend)
83 QML_DECLARE_TYPE(QLegendMarker)
83 QML_DECLARE_TYPE(QLegendMarker)
84 QML_DECLARE_TYPE(QAreaLegendMarker)
84 QML_DECLARE_TYPE(QAreaLegendMarker)
85 QML_DECLARE_TYPE(QBarLegendMarker)
85 QML_DECLARE_TYPE(QBarLegendMarker)
86 QML_DECLARE_TYPE(QPieLegendMarker)
86 QML_DECLARE_TYPE(QPieLegendMarker)
87
87
88 QML_DECLARE_TYPE(QHPieModelMapper)
88 QML_DECLARE_TYPE(QHPieModelMapper)
89 QML_DECLARE_TYPE(QHXYModelMapper)
89 QML_DECLARE_TYPE(QHXYModelMapper)
90 QML_DECLARE_TYPE(QPieModelMapper)
90 QML_DECLARE_TYPE(QPieModelMapper)
91 QML_DECLARE_TYPE(QHBarModelMapper)
91 QML_DECLARE_TYPE(QHBarModelMapper)
92 QML_DECLARE_TYPE(QBarModelMapper)
92 QML_DECLARE_TYPE(QBarModelMapper)
93 QML_DECLARE_TYPE(QVBarModelMapper)
93 QML_DECLARE_TYPE(QVBarModelMapper)
94 QML_DECLARE_TYPE(QVPieModelMapper)
94 QML_DECLARE_TYPE(QVPieModelMapper)
95 QML_DECLARE_TYPE(QVXYModelMapper)
95 QML_DECLARE_TYPE(QVXYModelMapper)
96 QML_DECLARE_TYPE(QXYLegendMarker)
96 QML_DECLARE_TYPE(QXYLegendMarker)
97 QML_DECLARE_TYPE(QXYModelMapper)
97 QML_DECLARE_TYPE(QXYModelMapper)
98 QML_DECLARE_TYPE(QBoxPlotModelMapper)
98 QML_DECLARE_TYPE(QBoxPlotModelMapper)
99 QML_DECLARE_TYPE(QVBoxPlotModelMapper)
99 QML_DECLARE_TYPE(QVBoxPlotModelMapper)
100
100
101 QML_DECLARE_TYPE(QAbstractSeries)
101 QML_DECLARE_TYPE(QAbstractSeries)
102 QML_DECLARE_TYPE(QXYSeries)
102 QML_DECLARE_TYPE(QXYSeries)
103 QML_DECLARE_TYPE(QAbstractBarSeries)
103 QML_DECLARE_TYPE(QAbstractBarSeries)
104 QML_DECLARE_TYPE(QBarSeries)
104 QML_DECLARE_TYPE(QBarSeries)
105 QML_DECLARE_TYPE(QBarSet)
105 QML_DECLARE_TYPE(QBarSet)
106 QML_DECLARE_TYPE(QAreaSeries)
106 QML_DECLARE_TYPE(QAreaSeries)
107 QML_DECLARE_TYPE(QHorizontalBarSeries)
107 QML_DECLARE_TYPE(QHorizontalBarSeries)
108 QML_DECLARE_TYPE(QHorizontalPercentBarSeries)
108 QML_DECLARE_TYPE(QHorizontalPercentBarSeries)
109 QML_DECLARE_TYPE(QHorizontalStackedBarSeries)
109 QML_DECLARE_TYPE(QHorizontalStackedBarSeries)
110 QML_DECLARE_TYPE(QLineSeries)
110 QML_DECLARE_TYPE(QLineSeries)
111 QML_DECLARE_TYPE(QPercentBarSeries)
111 QML_DECLARE_TYPE(QPercentBarSeries)
112 QML_DECLARE_TYPE(QPieSeries)
112 QML_DECLARE_TYPE(QPieSeries)
113 QML_DECLARE_TYPE(QPieSlice)
113 QML_DECLARE_TYPE(QPieSlice)
114 QML_DECLARE_TYPE(QScatterSeries)
114 QML_DECLARE_TYPE(QScatterSeries)
115 QML_DECLARE_TYPE(QSplineSeries)
115 QML_DECLARE_TYPE(QSplineSeries)
116 QML_DECLARE_TYPE(QStackedBarSeries)
116 QML_DECLARE_TYPE(QStackedBarSeries)
117
117
118 QT_CHARTS_BEGIN_NAMESPACE
118 QT_CHARTS_BEGIN_NAMESPACE
119
119
120 class QtChartsQml2Plugin : public QQmlExtensionPlugin
120 class QtChartsQml2Plugin : public QQmlExtensionPlugin
121 {
121 {
122 Q_OBJECT
122 Q_OBJECT
123
123
124 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
124 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
125
125
126 public:
126 public:
127 virtual void registerTypes(const char *uri)
127 virtual void registerTypes(const char *uri)
128 {
128 {
129 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCharts"));
129 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCharts"));
130
130
131 // @uri QtCharts
131 // @uri QtCharts
132
132
133 qRegisterMetaType<QList<QPieSlice *> >();
133 qRegisterMetaType<QList<QPieSlice *> >();
134 qRegisterMetaType<QList<QBarSet *> >();
134 qRegisterMetaType<QList<QBarSet *> >();
135 qRegisterMetaType<QList<QAbstractAxis *> >();
135 qRegisterMetaType<QList<QAbstractAxis *> >();
136
136
137 // QtCharts 1.0
137 // QtCharts 1.0
138 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
138 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
139 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
139 qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint");
140 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
140 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
141 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
141 qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries");
142 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
142 qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries");
143 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
143 qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries");
144 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
144 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
145 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
145 qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries");
146 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
146 qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries");
147 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
147 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
148 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
148 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
149 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
149 qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet");
150 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
150 qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper");
151 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
151 qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper");
152 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
152 qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper");
153 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
153 qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper");
154 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
154 qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper");
155 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
155 qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper");
156
156
157 qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
157 qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis");
158 qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
158 qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis");
159 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
159 qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend",
160 QLatin1String("Trying to create uncreatable: Legend."));
160 QLatin1String("Trying to create uncreatable: Legend."));
161 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
161 qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries",
162 QLatin1String("Trying to create uncreatable: XYSeries."));
162 QLatin1String("Trying to create uncreatable: XYSeries."));
163 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
163 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel",
164 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
164 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
165 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
165 qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper",
166 QLatin1String("Trying to create uncreatable: XYModelMapper."));
166 QLatin1String("Trying to create uncreatable: XYModelMapper."));
167 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
167 qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper",
168 QLatin1String("Trying to create uncreatable: PieModelMapper."));
168 QLatin1String("Trying to create uncreatable: PieModelMapper."));
169 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
169 qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper",
170 QLatin1String("Trying to create uncreatable: BarModelMapper."));
170 QLatin1String("Trying to create uncreatable: BarModelMapper."));
171 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
171 qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries",
172 QLatin1String("Trying to create uncreatable: AbstractSeries."));
172 QLatin1String("Trying to create uncreatable: AbstractSeries."));
173 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
173 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries",
174 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
174 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
175 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
175 qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis",
176 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
176 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
177 qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
177 qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase",
178 QLatin1String("Trying to create uncreatable: BarsetBase."));
178 QLatin1String("Trying to create uncreatable: BarsetBase."));
179 qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
179 qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries",
180 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
180 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
181 qmlRegisterUncreatableType<DeclarativeAxes>(uri, 1, 0, "DeclarativeAxes",
181 qmlRegisterUncreatableType<DeclarativeAxes>(uri, 1, 0, "DeclarativeAxes",
182 QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
182 QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
183
183
184 // QtCharts 1.1
184 // QtCharts 1.1
185 qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView");
185 qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView");
186 qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
186 qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries");
187 qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
187 qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries");
188 qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
188 qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries");
189 qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
189 qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries");
190 qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
190 qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries");
191 qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
191 qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries");
192 qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
192 qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries");
193 qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
193 qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries");
194 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
194 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries");
195 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
195 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries");
196 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
196 qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries");
197 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
197 qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet");
198 qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
198 qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis");
199 #ifndef QT_ON_ARM
199 #ifndef QT_ON_ARM
200 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
200 qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis");
201 #endif
201 #endif
202 qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
202 qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis");
203 qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
203 qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange");
204 qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
204 qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis");
205 qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins",
205 qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins",
206 QLatin1String("Trying to create uncreatable: Margins."));
206 QLatin1String("Trying to create uncreatable: Margins."));
207
207
208 // QtCharts 1.2
208 // QtCharts 1.2
209 qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView");
209 qmlRegisterType<DeclarativeChart, 2>(uri, 1, 2, "ChartView");
210 qmlRegisterType<DeclarativeScatterSeries, 2>(uri, 1, 2, "ScatterSeries");
210 qmlRegisterType<DeclarativeScatterSeries, 2>(uri, 1, 2, "ScatterSeries");
211 qmlRegisterType<DeclarativeLineSeries, 2>(uri, 1, 2, "LineSeries");
211 qmlRegisterType<DeclarativeLineSeries, 2>(uri, 1, 2, "LineSeries");
212 qmlRegisterType<DeclarativeSplineSeries, 2>(uri, 1, 2, "SplineSeries");
212 qmlRegisterType<DeclarativeSplineSeries, 2>(uri, 1, 2, "SplineSeries");
213 qmlRegisterType<DeclarativeAreaSeries, 2>(uri, 1, 2, "AreaSeries");
213 qmlRegisterType<DeclarativeAreaSeries, 2>(uri, 1, 2, "AreaSeries");
214 qmlRegisterType<DeclarativeBarSeries, 2>(uri, 1, 2, "BarSeries");
214 qmlRegisterType<DeclarativeBarSeries, 2>(uri, 1, 2, "BarSeries");
215 qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 1, 2, "StackedBarSeries");
215 qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 1, 2, "StackedBarSeries");
216 qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 1, 2, "PercentBarSeries");
216 qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 1, 2, "PercentBarSeries");
217 qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 1, 2, "HorizontalBarSeries");
217 qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 1, 2, "HorizontalBarSeries");
218 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 1, 2, "HorizontalStackedBarSeries");
218 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 1, 2, "HorizontalStackedBarSeries");
219 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries");
219 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 1, 2, "HorizontalPercentBarSeries");
220
220
221 // QtCharts 1.3
221 // QtCharts 1.3
222 qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView");
222 qmlRegisterType<DeclarativeChart, 3>(uri, 1, 3, "ChartView");
223 qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView");
223 qmlRegisterType<DeclarativePolarChart, 1>(uri, 1, 3, "PolarChartView");
224 qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries");
224 qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 1, 3, "SplineSeries");
225 qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries");
225 qmlRegisterType<DeclarativeScatterSeries, 3>(uri, 1, 3, "ScatterSeries");
226 qmlRegisterType<DeclarativeLineSeries, 3>(uri, 1, 3, "LineSeries");
226 qmlRegisterType<DeclarativeLineSeries, 3>(uri, 1, 3, "LineSeries");
227 qmlRegisterType<DeclarativeAreaSeries, 3>(uri, 1, 3, "AreaSeries");
227 qmlRegisterType<DeclarativeAreaSeries, 3>(uri, 1, 3, "AreaSeries");
228 qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
228 qmlRegisterType<QLogValueAxis>(uri, 1, 3, "LogValueAxis");
229 qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
229 qmlRegisterType<DeclarativeBoxPlotSeries>(uri, 1, 3, "BoxPlotSeries");
230 qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet");
230 qmlRegisterType<DeclarativeBoxSet>(uri, 1, 3, "BoxSet");
231
231
232 // QtCharts 1.4
232 // QtCharts 1.4
233 qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries");
233 qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 1, 4, "AreaSeries");
234 qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet");
234 qmlRegisterType<DeclarativeBarSet, 2>(uri, 1, 4, "BarSet");
235 qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries");
235 qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 1, 4, "BoxPlotSeries");
236 qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet");
236 qmlRegisterType<DeclarativeBoxSet, 1>(uri, 1, 4, "BoxSet");
237 qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice");
237 qmlRegisterType<DeclarativePieSlice>(uri, 1, 4, "PieSlice");
238 qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries");
238 qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 1, 4, "ScatterSeries");
239
239
240 // QtCharts 2.0
240 // QtCharts 2.0
241 qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper");
241 qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper");
242 qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper",
242 qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper",
243 QLatin1String("Trying to create uncreatable: BoxPlotModelMapper."));
243 QLatin1String("Trying to create uncreatable: BoxPlotModelMapper."));
244 qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView");
244 qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView");
245 qmlRegisterType<DeclarativeXYPoint>(uri, 2, 0, "XYPoint");
245 qmlRegisterType<DeclarativeXYPoint>(uri, 2, 0, "XYPoint");
246 qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 2, 0, "ScatterSeries");
246 qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 2, 0, "ScatterSeries");
247 qmlRegisterType<DeclarativeLineSeries, 3>(uri, 2, 0, "LineSeries");
247 qmlRegisterType<DeclarativeLineSeries, 3>(uri, 2, 0, "LineSeries");
248 qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 2, 0, "SplineSeries");
248 qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 2, 0, "SplineSeries");
249 qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 2, 0, "AreaSeries");
249 qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 2, 0, "AreaSeries");
250 qmlRegisterType<DeclarativeBarSeries, 2>(uri, 2, 0, "BarSeries");
250 qmlRegisterType<DeclarativeBarSeries, 2>(uri, 2, 0, "BarSeries");
251 qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 2, 0, "StackedBarSeries");
251 qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 2, 0, "StackedBarSeries");
252 qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 2, 0, "PercentBarSeries");
252 qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 2, 0, "PercentBarSeries");
253 qmlRegisterType<DeclarativePieSeries>(uri, 2, 0, "PieSeries");
253 qmlRegisterType<DeclarativePieSeries>(uri, 2, 0, "PieSeries");
254 qmlRegisterType<QPieSlice>(uri, 2, 0, "PieSlice");
254 qmlRegisterType<QPieSlice>(uri, 2, 0, "PieSlice");
255 qmlRegisterType<DeclarativeBarSet, 2>(uri, 2, 0, "BarSet");
255 qmlRegisterType<DeclarativeBarSet, 2>(uri, 2, 0, "BarSet");
256 qmlRegisterType<QHXYModelMapper>(uri, 2, 0, "HXYModelMapper");
256 qmlRegisterType<QHXYModelMapper>(uri, 2, 0, "HXYModelMapper");
257 qmlRegisterType<QVXYModelMapper>(uri, 2, 0, "VXYModelMapper");
257 qmlRegisterType<QVXYModelMapper>(uri, 2, 0, "VXYModelMapper");
258 qmlRegisterType<QHPieModelMapper>(uri, 2, 0, "HPieModelMapper");
258 qmlRegisterType<QHPieModelMapper>(uri, 2, 0, "HPieModelMapper");
259 qmlRegisterType<QVPieModelMapper>(uri, 2, 0, "VPieModelMapper");
259 qmlRegisterType<QVPieModelMapper>(uri, 2, 0, "VPieModelMapper");
260 qmlRegisterType<QHBarModelMapper>(uri, 2, 0, "HBarModelMapper");
260 qmlRegisterType<QHBarModelMapper>(uri, 2, 0, "HBarModelMapper");
261 qmlRegisterType<QVBarModelMapper>(uri, 2, 0, "VBarModelMapper");
261 qmlRegisterType<QVBarModelMapper>(uri, 2, 0, "VBarModelMapper");
262 qmlRegisterType<QValueAxis>(uri, 2, 0, "ValueAxis");
262 qmlRegisterType<QValueAxis>(uri, 2, 0, "ValueAxis");
263 #ifndef QT_ON_ARM
263 #ifndef QT_ON_ARM
264 qmlRegisterType<QDateTimeAxis>(uri, 2, 0, "DateTimeAxis");
264 qmlRegisterType<QDateTimeAxis>(uri, 2, 0, "DateTimeAxis");
265 #endif
265 #endif
266 qmlRegisterType<DeclarativeCategoryAxis>(uri, 2, 0, "CategoryAxis");
266 qmlRegisterType<DeclarativeCategoryAxis>(uri, 2, 0, "CategoryAxis");
267 qmlRegisterType<DeclarativeCategoryRange>(uri, 2, 0, "CategoryRange");
267 qmlRegisterType<DeclarativeCategoryRange>(uri, 2, 0, "CategoryRange");
268 qmlRegisterType<QBarCategoryAxis>(uri, 2, 0, "BarCategoryAxis");
268 qmlRegisterType<QBarCategoryAxis>(uri, 2, 0, "BarCategoryAxis");
269 qmlRegisterType<DeclarativePolarChart, 1>(uri, 2, 0, "PolarChartView");
269 qmlRegisterType<DeclarativePolarChart, 1>(uri, 2, 0, "PolarChartView");
270 qmlRegisterType<QLogValueAxis, 1>(uri, 2, 0, "LogValueAxis");
270 qmlRegisterType<QLogValueAxis, 1>(uri, 2, 0, "LogValueAxis");
271 qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 2, 0, "BoxPlotSeries");
271 qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 2, 0, "BoxPlotSeries");
272 qmlRegisterType<DeclarativeBoxSet, 1>(uri, 2, 0, "BoxSet");
272 qmlRegisterType<DeclarativeBoxSet, 1>(uri, 2, 0, "BoxSet");
273 qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 2, 0, "HorizontalBarSeries");
273 qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 2, 0, "HorizontalBarSeries");
274 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 2, 0, "HorizontalStackedBarSeries");
274 qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 2, 0, "HorizontalStackedBarSeries");
275 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 2, 0, "HorizontalPercentBarSeries");
275 qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 2, 0, "HorizontalPercentBarSeries");
276 qmlRegisterType<DeclarativePieSlice>(uri, 2, 0, "PieSlice");
276 qmlRegisterType<DeclarativePieSlice>(uri, 2, 0, "PieSlice");
277 qmlRegisterUncreatableType<QLegend>(uri, 2, 0, "Legend",
277 qmlRegisterUncreatableType<QLegend>(uri, 2, 0, "Legend",
278 QLatin1String("Trying to create uncreatable: Legend."));
278 QLatin1String("Trying to create uncreatable: Legend."));
279 qmlRegisterUncreatableType<QXYSeries>(uri, 2, 0, "XYSeries",
279 qmlRegisterUncreatableType<QXYSeries>(uri, 2, 0, "XYSeries",
280 QLatin1String("Trying to create uncreatable: XYSeries."));
280 QLatin1String("Trying to create uncreatable: XYSeries."));
281 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 2, 0, "AbstractItemModel",
281 qmlRegisterUncreatableType<QAbstractItemModel>(uri, 2, 0, "AbstractItemModel",
282 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
282 QLatin1String("Trying to create uncreatable: AbstractItemModel."));
283 qmlRegisterUncreatableType<QXYModelMapper>(uri, 2, 0, "XYModelMapper",
283 qmlRegisterUncreatableType<QXYModelMapper>(uri, 2, 0, "XYModelMapper",
284 QLatin1String("Trying to create uncreatable: XYModelMapper."));
284 QLatin1String("Trying to create uncreatable: XYModelMapper."));
285 qmlRegisterUncreatableType<QPieModelMapper>(uri, 2, 0, "PieModelMapper",
285 qmlRegisterUncreatableType<QPieModelMapper>(uri, 2, 0, "PieModelMapper",
286 QLatin1String("Trying to create uncreatable: PieModelMapper."));
286 QLatin1String("Trying to create uncreatable: PieModelMapper."));
287 qmlRegisterUncreatableType<QBarModelMapper>(uri, 2, 0, "BarModelMapper",
287 qmlRegisterUncreatableType<QBarModelMapper>(uri, 2, 0, "BarModelMapper",
288 QLatin1String("Trying to create uncreatable: BarModelMapper."));
288 QLatin1String("Trying to create uncreatable: BarModelMapper."));
289 qmlRegisterUncreatableType<QAbstractSeries>(uri, 2, 0, "AbstractSeries",
289 qmlRegisterUncreatableType<QAbstractSeries>(uri, 2, 0, "AbstractSeries",
290 QLatin1String("Trying to create uncreatable: AbstractSeries."));
290 QLatin1String("Trying to create uncreatable: AbstractSeries."));
291 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 2, 0, "AbstractBarSeries",
291 qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 2, 0, "AbstractBarSeries",
292 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
292 QLatin1String("Trying to create uncreatable: AbstractBarSeries."));
293 qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 0, "AbstractAxis",
293 qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 0, "AbstractAxis",
294 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
294 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
295 qmlRegisterUncreatableType<QBarSet>(uri, 2, 0, "BarSetBase",
295 qmlRegisterUncreatableType<QBarSet>(uri, 2, 0, "BarSetBase",
296 QLatin1String("Trying to create uncreatable: BarsetBase."));
296 QLatin1String("Trying to create uncreatable: BarsetBase."));
297 qmlRegisterUncreatableType<QPieSeries>(uri, 2, 0, "QPieSeries",
297 qmlRegisterUncreatableType<QPieSeries>(uri, 2, 0, "QPieSeries",
298 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
298 QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead."));
299 qmlRegisterUncreatableType<DeclarativeAxes>(uri, 2, 0, "DeclarativeAxes",
299 qmlRegisterUncreatableType<DeclarativeAxes>(uri, 2, 0, "DeclarativeAxes",
300 QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
300 QLatin1String("Trying to create uncreatable: DeclarativeAxes."));
301 qmlRegisterUncreatableType<DeclarativeMargins>(uri, 2, 0, "Margins",
301 qmlRegisterUncreatableType<DeclarativeMargins>(uri, 2, 0, "Margins",
302 QLatin1String("Trying to create uncreatable: Margins."));
302 QLatin1String("Trying to create uncreatable: Margins."));
303
303
304 // QtCharts 2.1
304 // QtCharts 2.1
305 qmlRegisterType<DeclarativeCategoryAxis, 1>(uri, 2, 1, "CategoryAxis");
305 qmlRegisterType<DeclarativeCategoryAxis, 1>(uri, 2, 1, "CategoryAxis");
306 qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 1, "AbstractAxis",
307 QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead."));
306 }
308 }
307
309
308 };
310 };
309
311
310 QT_CHARTS_END_NAMESPACE
312 QT_CHARTS_END_NAMESPACE
311
313
312 #include "chartsqml2_plugin.moc"
314 #include "chartsqml2_plugin.moc"
313
315
314 QT_CHARTS_USE_NAMESPACE
316 QT_CHARTS_USE_NAMESPACE
@@ -1,2407 +1,2416
1 import QtQuick.tooling 1.1
1 import QtQuick.tooling 1.1
2
2
3 // This file describes the plugin-supplied types contained in the library.
3 // This file describes the plugin-supplied types contained in the library.
4 // It is used for QML tooling purposes only.
4 // It is used for QML tooling purposes only.
5 //
5 //
6 // This file was auto-generated by:
6 // This file was auto-generated by:
7 // 'qmlplugindump -nonrelocatable QtCharts 2.0'
7 // 'qmlplugindump -nonrelocatable QtCharts 2.0'
8
8
9 Module {
9 Module {
10 Component {
10 Component {
11 name: "QGraphicsObject"
11 name: "QGraphicsObject"
12 defaultProperty: "children"
12 defaultProperty: "children"
13 prototype: "QObject"
13 prototype: "QObject"
14 Property { name: "parent"; type: "QGraphicsObject"; isPointer: true }
14 Property { name: "parent"; type: "QGraphicsObject"; isPointer: true }
15 Property { name: "opacity"; type: "double" }
15 Property { name: "opacity"; type: "double" }
16 Property { name: "enabled"; type: "bool" }
16 Property { name: "enabled"; type: "bool" }
17 Property { name: "visible"; type: "bool" }
17 Property { name: "visible"; type: "bool" }
18 Property { name: "pos"; type: "QPointF" }
18 Property { name: "pos"; type: "QPointF" }
19 Property { name: "x"; type: "double" }
19 Property { name: "x"; type: "double" }
20 Property { name: "y"; type: "double" }
20 Property { name: "y"; type: "double" }
21 Property { name: "z"; type: "double" }
21 Property { name: "z"; type: "double" }
22 Property { name: "rotation"; type: "double" }
22 Property { name: "rotation"; type: "double" }
23 Property { name: "scale"; type: "double" }
23 Property { name: "scale"; type: "double" }
24 Property { name: "transformOriginPoint"; type: "QPointF" }
24 Property { name: "transformOriginPoint"; type: "QPointF" }
25 Property { name: "effect"; type: "QGraphicsEffect"; isPointer: true }
25 Property { name: "effect"; type: "QGraphicsEffect"; isPointer: true }
26 Property {
26 Property {
27 name: "children"
27 name: "children"
28 type: "QDeclarativeListProperty<QGraphicsObject>"
28 type: "QDeclarativeListProperty<QGraphicsObject>"
29 isReadonly: true
29 isReadonly: true
30 }
30 }
31 Property { name: "width"; type: "double" }
31 Property { name: "width"; type: "double" }
32 Property { name: "height"; type: "double" }
32 Property { name: "height"; type: "double" }
33 }
33 }
34 Component {
34 Component {
35 name: "QGraphicsWidget"
35 name: "QGraphicsWidget"
36 defaultProperty: "children"
36 defaultProperty: "children"
37 prototype: "QGraphicsObject"
37 prototype: "QGraphicsObject"
38 Property { name: "palette"; type: "QPalette" }
38 Property { name: "palette"; type: "QPalette" }
39 Property { name: "font"; type: "QFont" }
39 Property { name: "font"; type: "QFont" }
40 Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
40 Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
41 Property { name: "size"; type: "QSizeF" }
41 Property { name: "size"; type: "QSizeF" }
42 Property { name: "minimumSize"; type: "QSizeF" }
42 Property { name: "minimumSize"; type: "QSizeF" }
43 Property { name: "preferredSize"; type: "QSizeF" }
43 Property { name: "preferredSize"; type: "QSizeF" }
44 Property { name: "maximumSize"; type: "QSizeF" }
44 Property { name: "maximumSize"; type: "QSizeF" }
45 Property { name: "sizePolicy"; type: "QSizePolicy" }
45 Property { name: "sizePolicy"; type: "QSizePolicy" }
46 Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
46 Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
47 Property { name: "windowFlags"; type: "Qt::WindowFlags" }
47 Property { name: "windowFlags"; type: "Qt::WindowFlags" }
48 Property { name: "windowTitle"; type: "string" }
48 Property { name: "windowTitle"; type: "string" }
49 Property { name: "geometry"; type: "QRectF" }
49 Property { name: "geometry"; type: "QRectF" }
50 Property { name: "autoFillBackground"; type: "bool" }
50 Property { name: "autoFillBackground"; type: "bool" }
51 Property { name: "layout"; type: "QGraphicsLayout"; isPointer: true }
51 Property { name: "layout"; type: "QGraphicsLayout"; isPointer: true }
52 Method { name: "close"; type: "bool" }
52 Method { name: "close"; type: "bool" }
53 }
53 }
54 Component {
54 Component {
55 name: "QtCharts::DeclarativeAreaSeries"
55 name: "QtCharts::DeclarativeAreaSeries"
56 prototype: "QtCharts::QAreaSeries"
56 prototype: "QtCharts::QAreaSeries"
57 exports: [
57 exports: [
58 "QtCharts/AreaSeries 1.0",
58 "QtCharts/AreaSeries 1.0",
59 "QtCharts/AreaSeries 1.1",
59 "QtCharts/AreaSeries 1.1",
60 "QtCharts/AreaSeries 1.2",
60 "QtCharts/AreaSeries 1.2",
61 "QtCharts/AreaSeries 1.3",
61 "QtCharts/AreaSeries 1.3",
62 "QtCharts/AreaSeries 1.4",
62 "QtCharts/AreaSeries 1.4",
63 "QtCharts/AreaSeries 2.0"
63 "QtCharts/AreaSeries 2.0"
64 ]
64 ]
65 exportMetaObjectRevisions: [0, 1, 2, 3, 4, 4]
65 exportMetaObjectRevisions: [0, 1, 2, 3, 4, 4]
66 Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
66 Property { name: "upperSeries"; type: "DeclarativeLineSeries"; isPointer: true }
67 Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
67 Property { name: "lowerSeries"; type: "DeclarativeLineSeries"; isPointer: true }
68 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
68 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
69 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
69 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
70 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
70 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
71 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
71 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
72 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
72 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
73 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
73 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
74 Property { name: "borderWidth"; revision: 1; type: "double" }
74 Property { name: "borderWidth"; revision: 1; type: "double" }
75 Property { name: "brushFilename"; revision: 4; type: "string" }
75 Property { name: "brushFilename"; revision: 4; type: "string" }
76 Property { name: "brush"; revision: 4; type: "QBrush" }
76 Property { name: "brush"; revision: 4; type: "QBrush" }
77 Signal {
77 Signal {
78 name: "axisXChanged"
78 name: "axisXChanged"
79 revision: 1
79 revision: 1
80 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
80 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
81 }
81 }
82 Signal {
82 Signal {
83 name: "axisYChanged"
83 name: "axisYChanged"
84 revision: 1
84 revision: 1
85 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
85 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
86 }
86 }
87 Signal {
87 Signal {
88 name: "borderWidthChanged"
88 name: "borderWidthChanged"
89 revision: 1
89 revision: 1
90 Parameter { name: "width"; type: "double" }
90 Parameter { name: "width"; type: "double" }
91 }
91 }
92 Signal {
92 Signal {
93 name: "axisXTopChanged"
93 name: "axisXTopChanged"
94 revision: 2
94 revision: 2
95 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
95 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
96 }
96 }
97 Signal {
97 Signal {
98 name: "axisYRightChanged"
98 name: "axisYRightChanged"
99 revision: 2
99 revision: 2
100 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
100 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
101 }
101 }
102 Signal {
102 Signal {
103 name: "axisAngularChanged"
103 name: "axisAngularChanged"
104 revision: 3
104 revision: 3
105 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
105 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
106 }
106 }
107 Signal {
107 Signal {
108 name: "axisRadialChanged"
108 name: "axisRadialChanged"
109 revision: 3
109 revision: 3
110 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
110 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
111 }
111 }
112 Signal { name: "brushChanged"; revision: 4 }
112 Signal { name: "brushChanged"; revision: 4 }
113 Signal {
113 Signal {
114 name: "brushFilenameChanged"
114 name: "brushFilenameChanged"
115 revision: 4
115 revision: 4
116 Parameter { name: "brushFilename"; type: "string" }
116 Parameter { name: "brushFilename"; type: "string" }
117 }
117 }
118 }
118 }
119 Component {
119 Component {
120 name: "QtCharts::DeclarativeAxes"
120 name: "QtCharts::DeclarativeAxes"
121 prototype: "QObject"
121 prototype: "QObject"
122 exports: [
122 exports: [
123 "QtCharts/DeclarativeAxes 1.0",
123 "QtCharts/DeclarativeAxes 1.0",
124 "QtCharts/DeclarativeAxes 2.0"
124 "QtCharts/DeclarativeAxes 2.0"
125 ]
125 ]
126 isCreatable: false
126 isCreatable: false
127 exportMetaObjectRevisions: [0, 0]
127 exportMetaObjectRevisions: [0, 0]
128 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
128 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
129 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
129 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
130 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
130 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
131 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
131 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
132 Signal {
132 Signal {
133 name: "axisXChanged"
133 name: "axisXChanged"
134 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
134 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
135 }
135 }
136 Signal {
136 Signal {
137 name: "axisYChanged"
137 name: "axisYChanged"
138 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
138 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
139 }
139 }
140 Signal {
140 Signal {
141 name: "axisXTopChanged"
141 name: "axisXTopChanged"
142 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
142 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
143 }
143 }
144 Signal {
144 Signal {
145 name: "axisYRightChanged"
145 name: "axisYRightChanged"
146 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
146 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
147 }
147 }
148 }
148 }
149 Component {
149 Component {
150 name: "QtCharts::DeclarativeBarSeries"
150 name: "QtCharts::DeclarativeBarSeries"
151 defaultProperty: "seriesChildren"
151 defaultProperty: "seriesChildren"
152 prototype: "QtCharts::QBarSeries"
152 prototype: "QtCharts::QBarSeries"
153 exports: [
153 exports: [
154 "QtCharts/BarSeries 1.0",
154 "QtCharts/BarSeries 1.0",
155 "QtCharts/BarSeries 1.1",
155 "QtCharts/BarSeries 1.1",
156 "QtCharts/BarSeries 1.2",
156 "QtCharts/BarSeries 1.2",
157 "QtCharts/BarSeries 2.0"
157 "QtCharts/BarSeries 2.0"
158 ]
158 ]
159 exportMetaObjectRevisions: [0, 1, 2, 2]
159 exportMetaObjectRevisions: [0, 1, 2, 2]
160 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
160 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
161 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
161 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
162 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
162 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
163 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
163 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
164 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
164 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
165 Signal {
165 Signal {
166 name: "axisXChanged"
166 name: "axisXChanged"
167 revision: 1
167 revision: 1
168 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
168 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
169 }
169 }
170 Signal {
170 Signal {
171 name: "axisYChanged"
171 name: "axisYChanged"
172 revision: 1
172 revision: 1
173 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
173 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
174 }
174 }
175 Signal {
175 Signal {
176 name: "axisXTopChanged"
176 name: "axisXTopChanged"
177 revision: 2
177 revision: 2
178 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
178 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
179 }
179 }
180 Signal {
180 Signal {
181 name: "axisYRightChanged"
181 name: "axisYRightChanged"
182 revision: 2
182 revision: 2
183 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
183 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
184 }
184 }
185 Method {
185 Method {
186 name: "appendSeriesChildren"
186 name: "appendSeriesChildren"
187 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
187 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
188 Parameter { name: "element"; type: "QObject"; isPointer: true }
188 Parameter { name: "element"; type: "QObject"; isPointer: true }
189 }
189 }
190 Method {
190 Method {
191 name: "at"
191 name: "at"
192 type: "DeclarativeBarSet*"
192 type: "DeclarativeBarSet*"
193 Parameter { name: "index"; type: "int" }
193 Parameter { name: "index"; type: "int" }
194 }
194 }
195 Method {
195 Method {
196 name: "append"
196 name: "append"
197 type: "DeclarativeBarSet*"
197 type: "DeclarativeBarSet*"
198 Parameter { name: "label"; type: "string" }
198 Parameter { name: "label"; type: "string" }
199 Parameter { name: "values"; type: "QVariantList" }
199 Parameter { name: "values"; type: "QVariantList" }
200 }
200 }
201 Method {
201 Method {
202 name: "insert"
202 name: "insert"
203 type: "DeclarativeBarSet*"
203 type: "DeclarativeBarSet*"
204 Parameter { name: "index"; type: "int" }
204 Parameter { name: "index"; type: "int" }
205 Parameter { name: "label"; type: "string" }
205 Parameter { name: "label"; type: "string" }
206 Parameter { name: "values"; type: "QVariantList" }
206 Parameter { name: "values"; type: "QVariantList" }
207 }
207 }
208 Method {
208 Method {
209 name: "remove"
209 name: "remove"
210 type: "bool"
210 type: "bool"
211 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
211 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
212 }
212 }
213 Method { name: "clear" }
213 Method { name: "clear" }
214 }
214 }
215 Component {
215 Component {
216 name: "QtCharts::DeclarativeBarSet"
216 name: "QtCharts::DeclarativeBarSet"
217 prototype: "QtCharts::QBarSet"
217 prototype: "QtCharts::QBarSet"
218 exports: [
218 exports: [
219 "QtCharts/BarSet 1.0",
219 "QtCharts/BarSet 1.0",
220 "QtCharts/BarSet 1.1",
220 "QtCharts/BarSet 1.1",
221 "QtCharts/BarSet 1.4",
221 "QtCharts/BarSet 1.4",
222 "QtCharts/BarSet 2.0"
222 "QtCharts/BarSet 2.0"
223 ]
223 ]
224 exportMetaObjectRevisions: [0, 0, 2, 2]
224 exportMetaObjectRevisions: [0, 0, 2, 2]
225 Property { name: "values"; type: "QVariantList" }
225 Property { name: "values"; type: "QVariantList" }
226 Property { name: "borderWidth"; revision: 1; type: "double" }
226 Property { name: "borderWidth"; revision: 1; type: "double" }
227 Property { name: "count"; type: "int"; isReadonly: true }
227 Property { name: "count"; type: "int"; isReadonly: true }
228 Property { name: "brushFilename"; revision: 2; type: "string" }
228 Property { name: "brushFilename"; revision: 2; type: "string" }
229 Signal {
229 Signal {
230 name: "countChanged"
230 name: "countChanged"
231 Parameter { name: "count"; type: "int" }
231 Parameter { name: "count"; type: "int" }
232 }
232 }
233 Signal {
233 Signal {
234 name: "borderWidthChanged"
234 name: "borderWidthChanged"
235 revision: 1
235 revision: 1
236 Parameter { name: "width"; type: "double" }
236 Parameter { name: "width"; type: "double" }
237 }
237 }
238 Signal {
238 Signal {
239 name: "brushFilenameChanged"
239 name: "brushFilenameChanged"
240 revision: 2
240 revision: 2
241 Parameter { name: "brushFilename"; type: "string" }
241 Parameter { name: "brushFilename"; type: "string" }
242 }
242 }
243 Method {
243 Method {
244 name: "append"
244 name: "append"
245 Parameter { name: "value"; type: "double" }
245 Parameter { name: "value"; type: "double" }
246 }
246 }
247 Method {
247 Method {
248 name: "remove"
248 name: "remove"
249 Parameter { name: "index"; type: "int" }
249 Parameter { name: "index"; type: "int" }
250 Parameter { name: "count"; type: "int" }
250 Parameter { name: "count"; type: "int" }
251 }
251 }
252 Method {
252 Method {
253 name: "remove"
253 name: "remove"
254 Parameter { name: "index"; type: "int" }
254 Parameter { name: "index"; type: "int" }
255 }
255 }
256 Method {
256 Method {
257 name: "replace"
257 name: "replace"
258 Parameter { name: "index"; type: "int" }
258 Parameter { name: "index"; type: "int" }
259 Parameter { name: "value"; type: "double" }
259 Parameter { name: "value"; type: "double" }
260 }
260 }
261 Method {
261 Method {
262 name: "at"
262 name: "at"
263 type: "double"
263 type: "double"
264 Parameter { name: "index"; type: "int" }
264 Parameter { name: "index"; type: "int" }
265 }
265 }
266 }
266 }
267 Component {
267 Component {
268 name: "QtCharts::DeclarativeBoxPlotSeries"
268 name: "QtCharts::DeclarativeBoxPlotSeries"
269 defaultProperty: "seriesChildren"
269 defaultProperty: "seriesChildren"
270 prototype: "QtCharts::QBoxPlotSeries"
270 prototype: "QtCharts::QBoxPlotSeries"
271 exports: [
271 exports: [
272 "QtCharts/BoxPlotSeries 1.3",
272 "QtCharts/BoxPlotSeries 1.3",
273 "QtCharts/BoxPlotSeries 1.4",
273 "QtCharts/BoxPlotSeries 1.4",
274 "QtCharts/BoxPlotSeries 2.0"
274 "QtCharts/BoxPlotSeries 2.0"
275 ]
275 ]
276 exportMetaObjectRevisions: [0, 1, 1]
276 exportMetaObjectRevisions: [0, 1, 1]
277 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
277 Property { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
278 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
278 Property { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
279 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
279 Property { name: "axisXTop"; type: "QAbstractAxis"; isPointer: true }
280 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
280 Property { name: "axisYRight"; type: "QAbstractAxis"; isPointer: true }
281 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
281 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
282 Property { name: "brushFilename"; revision: 1; type: "string" }
282 Property { name: "brushFilename"; revision: 1; type: "string" }
283 Signal {
283 Signal {
284 name: "axisXChanged"
284 name: "axisXChanged"
285 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
285 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
286 }
286 }
287 Signal {
287 Signal {
288 name: "axisYChanged"
288 name: "axisYChanged"
289 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
289 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
290 }
290 }
291 Signal {
291 Signal {
292 name: "axisXTopChanged"
292 name: "axisXTopChanged"
293 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
293 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
294 }
294 }
295 Signal {
295 Signal {
296 name: "axisYRightChanged"
296 name: "axisYRightChanged"
297 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
297 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
298 }
298 }
299 Signal {
299 Signal {
300 name: "clicked"
300 name: "clicked"
301 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
301 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
302 }
302 }
303 Signal {
303 Signal {
304 name: "hovered"
304 name: "hovered"
305 Parameter { name: "status"; type: "bool" }
305 Parameter { name: "status"; type: "bool" }
306 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
306 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
307 }
307 }
308 Signal {
308 Signal {
309 name: "pressed"
309 name: "pressed"
310 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
310 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
311 }
311 }
312 Signal {
312 Signal {
313 name: "released"
313 name: "released"
314 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
314 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
315 }
315 }
316 Signal {
316 Signal {
317 name: "doubleClicked"
317 name: "doubleClicked"
318 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
318 Parameter { name: "boxset"; type: "DeclarativeBoxSet"; isPointer: true }
319 }
319 }
320 Signal {
320 Signal {
321 name: "brushFilenameChanged"
321 name: "brushFilenameChanged"
322 revision: 1
322 revision: 1
323 Parameter { name: "brushFilename"; type: "string" }
323 Parameter { name: "brushFilename"; type: "string" }
324 }
324 }
325 Method {
325 Method {
326 name: "appendSeriesChildren"
326 name: "appendSeriesChildren"
327 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
327 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
328 Parameter { name: "element"; type: "QObject"; isPointer: true }
328 Parameter { name: "element"; type: "QObject"; isPointer: true }
329 }
329 }
330 Method {
330 Method {
331 name: "onHovered"
331 name: "onHovered"
332 Parameter { name: "status"; type: "bool" }
332 Parameter { name: "status"; type: "bool" }
333 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
333 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
334 }
334 }
335 Method {
335 Method {
336 name: "onClicked"
336 name: "onClicked"
337 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
337 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
338 }
338 }
339 Method {
339 Method {
340 name: "onPressed"
340 name: "onPressed"
341 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
341 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
342 }
342 }
343 Method {
343 Method {
344 name: "onReleased"
344 name: "onReleased"
345 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
345 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
346 }
346 }
347 Method {
347 Method {
348 name: "onDoubleClicked"
348 name: "onDoubleClicked"
349 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
349 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
350 }
350 }
351 Method {
351 Method {
352 name: "at"
352 name: "at"
353 type: "DeclarativeBoxSet*"
353 type: "DeclarativeBoxSet*"
354 Parameter { name: "index"; type: "int" }
354 Parameter { name: "index"; type: "int" }
355 }
355 }
356 Method {
356 Method {
357 name: "append"
357 name: "append"
358 type: "DeclarativeBoxSet*"
358 type: "DeclarativeBoxSet*"
359 Parameter { name: "label"; type: "string" }
359 Parameter { name: "label"; type: "string" }
360 Parameter { name: "values"; type: "QVariantList" }
360 Parameter { name: "values"; type: "QVariantList" }
361 }
361 }
362 Method {
362 Method {
363 name: "append"
363 name: "append"
364 Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
364 Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
365 }
365 }
366 Method {
366 Method {
367 name: "insert"
367 name: "insert"
368 type: "DeclarativeBoxSet*"
368 type: "DeclarativeBoxSet*"
369 Parameter { name: "index"; type: "int" }
369 Parameter { name: "index"; type: "int" }
370 Parameter { name: "label"; type: "string" }
370 Parameter { name: "label"; type: "string" }
371 Parameter { name: "values"; type: "QVariantList" }
371 Parameter { name: "values"; type: "QVariantList" }
372 }
372 }
373 Method {
373 Method {
374 name: "remove"
374 name: "remove"
375 type: "bool"
375 type: "bool"
376 Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
376 Parameter { name: "box"; type: "DeclarativeBoxSet"; isPointer: true }
377 }
377 }
378 Method { name: "clear" }
378 Method { name: "clear" }
379 }
379 }
380 Component {
380 Component {
381 name: "QtCharts::DeclarativeBoxSet"
381 name: "QtCharts::DeclarativeBoxSet"
382 prototype: "QtCharts::QBoxSet"
382 prototype: "QtCharts::QBoxSet"
383 exports: [
383 exports: [
384 "QtCharts/BoxSet 1.3",
384 "QtCharts/BoxSet 1.3",
385 "QtCharts/BoxSet 1.4",
385 "QtCharts/BoxSet 1.4",
386 "QtCharts/BoxSet 2.0"
386 "QtCharts/BoxSet 2.0"
387 ]
387 ]
388 exportMetaObjectRevisions: [0, 1, 1]
388 exportMetaObjectRevisions: [0, 1, 1]
389 Enum {
389 Enum {
390 name: "ValuePositions"
390 name: "ValuePositions"
391 values: {
391 values: {
392 "LowerExtreme": 0,
392 "LowerExtreme": 0,
393 "LowerQuartile": 1,
393 "LowerQuartile": 1,
394 "Median": 2,
394 "Median": 2,
395 "UpperQuartile": 3,
395 "UpperQuartile": 3,
396 "UpperExtreme": 4
396 "UpperExtreme": 4
397 }
397 }
398 }
398 }
399 Property { name: "values"; type: "QVariantList" }
399 Property { name: "values"; type: "QVariantList" }
400 Property { name: "label"; type: "string" }
400 Property { name: "label"; type: "string" }
401 Property { name: "count"; type: "int"; isReadonly: true }
401 Property { name: "count"; type: "int"; isReadonly: true }
402 Property { name: "brushFilename"; revision: 1; type: "string" }
402 Property { name: "brushFilename"; revision: 1; type: "string" }
403 Signal { name: "changedValues" }
403 Signal { name: "changedValues" }
404 Signal {
404 Signal {
405 name: "changedValue"
405 name: "changedValue"
406 Parameter { name: "index"; type: "int" }
406 Parameter { name: "index"; type: "int" }
407 }
407 }
408 Signal {
408 Signal {
409 name: "brushFilenameChanged"
409 name: "brushFilenameChanged"
410 revision: 1
410 revision: 1
411 Parameter { name: "brushFilename"; type: "string" }
411 Parameter { name: "brushFilename"; type: "string" }
412 }
412 }
413 Method {
413 Method {
414 name: "append"
414 name: "append"
415 Parameter { name: "value"; type: "double" }
415 Parameter { name: "value"; type: "double" }
416 }
416 }
417 Method { name: "clear" }
417 Method { name: "clear" }
418 Method {
418 Method {
419 name: "at"
419 name: "at"
420 type: "double"
420 type: "double"
421 Parameter { name: "index"; type: "int" }
421 Parameter { name: "index"; type: "int" }
422 }
422 }
423 Method {
423 Method {
424 name: "setValue"
424 name: "setValue"
425 Parameter { name: "index"; type: "int" }
425 Parameter { name: "index"; type: "int" }
426 Parameter { name: "value"; type: "double" }
426 Parameter { name: "value"; type: "double" }
427 }
427 }
428 }
428 }
429 Component {
429 Component {
430 name: "QtCharts::DeclarativeCategoryAxis"
430 name: "QtCharts::DeclarativeCategoryAxis"
431 defaultProperty: "axisChildren"
431 defaultProperty: "axisChildren"
432 prototype: "QtCharts::QCategoryAxis"
432 prototype: "QtCharts::QCategoryAxis"
433 exports: [
433 exports: [
434 "QtCharts/CategoryAxis 1.1",
434 "QtCharts/CategoryAxis 1.1",
435 "QtCharts/CategoryAxis 2.0",
435 "QtCharts/CategoryAxis 2.0",
436 "QtCharts/CategoryAxis 2.1"
436 "QtCharts/CategoryAxis 2.1"
437 ]
437 ]
438 exportMetaObjectRevisions: [0, 0, 1]
438 exportMetaObjectRevisions: [0, 0, 1]
439 Enum {
439 Enum {
440 name: "AxisLabelsPosition"
440 name: "AxisLabelsPosition"
441 values: {
441 values: {
442 "AxisLabelsPositionCenter": 0,
442 "AxisLabelsPositionCenter": 0,
443 "AxisLabelsPositionOnValue": 1
443 "AxisLabelsPositionOnValue": 1
444 }
444 }
445 }
445 }
446 Property { name: "axisChildren"; type: "QObject"; isList: true; isReadonly: true }
446 Property { name: "axisChildren"; type: "QObject"; isList: true; isReadonly: true }
447 Property { name: "labelsPosition"; revision: 1; type: "AxisLabelsPosition" }
447 Property { name: "labelsPosition"; revision: 1; type: "AxisLabelsPosition" }
448 Signal {
448 Signal {
449 name: "labelsPositionChanged"
449 name: "labelsPositionChanged"
450 revision: 1
450 revision: 1
451 Parameter { name: "position"; type: "AxisLabelsPosition" }
451 Parameter { name: "position"; type: "AxisLabelsPosition" }
452 }
452 }
453 Method {
453 Method {
454 name: "append"
454 name: "append"
455 Parameter { name: "label"; type: "string" }
455 Parameter { name: "label"; type: "string" }
456 Parameter { name: "categoryEndValue"; type: "double" }
456 Parameter { name: "categoryEndValue"; type: "double" }
457 }
457 }
458 Method {
458 Method {
459 name: "remove"
459 name: "remove"
460 Parameter { name: "label"; type: "string" }
460 Parameter { name: "label"; type: "string" }
461 }
461 }
462 Method {
462 Method {
463 name: "replace"
463 name: "replace"
464 Parameter { name: "oldLabel"; type: "string" }
464 Parameter { name: "oldLabel"; type: "string" }
465 Parameter { name: "newLabel"; type: "string" }
465 Parameter { name: "newLabel"; type: "string" }
466 }
466 }
467 Method {
467 Method {
468 name: "appendAxisChildren"
468 name: "appendAxisChildren"
469 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
469 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
470 Parameter { name: "element"; type: "QObject"; isPointer: true }
470 Parameter { name: "element"; type: "QObject"; isPointer: true }
471 }
471 }
472 }
472 }
473 Component {
473 Component {
474 name: "QtCharts::DeclarativeCategoryRange"
474 name: "QtCharts::DeclarativeCategoryRange"
475 prototype: "QObject"
475 prototype: "QObject"
476 exports: ["QtCharts/CategoryRange 1.1", "QtCharts/CategoryRange 2.0"]
476 exports: ["QtCharts/CategoryRange 1.1", "QtCharts/CategoryRange 2.0"]
477 exportMetaObjectRevisions: [0, 0]
477 exportMetaObjectRevisions: [0, 0]
478 Property { name: "endValue"; type: "double" }
478 Property { name: "endValue"; type: "double" }
479 Property { name: "label"; type: "string" }
479 Property { name: "label"; type: "string" }
480 }
480 }
481 Component {
481 Component {
482 name: "QtCharts::DeclarativeChart"
482 name: "QtCharts::DeclarativeChart"
483 defaultProperty: "data"
483 defaultProperty: "data"
484 prototype: "QQuickPaintedItem"
484 prototype: "QQuickPaintedItem"
485 exports: [
485 exports: [
486 "QtCharts/ChartView 1.0",
486 "QtCharts/ChartView 1.0",
487 "QtCharts/ChartView 1.1",
487 "QtCharts/ChartView 1.1",
488 "QtCharts/ChartView 1.2",
488 "QtCharts/ChartView 1.2",
489 "QtCharts/ChartView 1.3",
489 "QtCharts/ChartView 1.3",
490 "QtCharts/ChartView 2.0"
490 "QtCharts/ChartView 2.0"
491 ]
491 ]
492 exportMetaObjectRevisions: [0, 1, 2, 3, 4]
492 exportMetaObjectRevisions: [0, 1, 2, 3, 4]
493 Enum {
493 Enum {
494 name: "Theme"
494 name: "Theme"
495 values: {
495 values: {
496 "ChartThemeLight": 0,
496 "ChartThemeLight": 0,
497 "ChartThemeBlueCerulean": 1,
497 "ChartThemeBlueCerulean": 1,
498 "ChartThemeDark": 2,
498 "ChartThemeDark": 2,
499 "ChartThemeBrownSand": 3,
499 "ChartThemeBrownSand": 3,
500 "ChartThemeBlueNcs": 4,
500 "ChartThemeBlueNcs": 4,
501 "ChartThemeHighContrast": 5,
501 "ChartThemeHighContrast": 5,
502 "ChartThemeBlueIcy": 6,
502 "ChartThemeBlueIcy": 6,
503 "ChartThemeQt": 7
503 "ChartThemeQt": 7
504 }
504 }
505 }
505 }
506 Enum {
506 Enum {
507 name: "Animation"
507 name: "Animation"
508 values: {
508 values: {
509 "NoAnimation": 0,
509 "NoAnimation": 0,
510 "GridAxisAnimations": 1,
510 "GridAxisAnimations": 1,
511 "SeriesAnimations": 2,
511 "SeriesAnimations": 2,
512 "AllAnimations": 3
512 "AllAnimations": 3
513 }
513 }
514 }
514 }
515 Enum {
515 Enum {
516 name: "SeriesType"
516 name: "SeriesType"
517 values: {
517 values: {
518 "SeriesTypeLine": 0,
518 "SeriesTypeLine": 0,
519 "SeriesTypeArea": 1,
519 "SeriesTypeArea": 1,
520 "SeriesTypeBar": 2,
520 "SeriesTypeBar": 2,
521 "SeriesTypeStackedBar": 3,
521 "SeriesTypeStackedBar": 3,
522 "SeriesTypePercentBar": 4,
522 "SeriesTypePercentBar": 4,
523 "SeriesTypeBoxPlot": 5,
523 "SeriesTypeBoxPlot": 5,
524 "SeriesTypePie": 6,
524 "SeriesTypePie": 6,
525 "SeriesTypeScatter": 7,
525 "SeriesTypeScatter": 7,
526 "SeriesTypeSpline": 8,
526 "SeriesTypeSpline": 8,
527 "SeriesTypeHorizontalBar": 9,
527 "SeriesTypeHorizontalBar": 9,
528 "SeriesTypeHorizontalStackedBar": 10,
528 "SeriesTypeHorizontalStackedBar": 10,
529 "SeriesTypeHorizontalPercentBar": 11
529 "SeriesTypeHorizontalPercentBar": 11
530 }
530 }
531 }
531 }
532 Property { name: "theme"; type: "Theme" }
532 Property { name: "theme"; type: "Theme" }
533 Property { name: "animationOptions"; type: "Animation" }
533 Property { name: "animationOptions"; type: "Animation" }
534 Property { name: "title"; type: "string" }
534 Property { name: "title"; type: "string" }
535 Property { name: "titleFont"; type: "QFont" }
535 Property { name: "titleFont"; type: "QFont" }
536 Property { name: "titleColor"; type: "QColor" }
536 Property { name: "titleColor"; type: "QColor" }
537 Property { name: "legend"; type: "QLegend"; isReadonly: true; isPointer: true }
537 Property { name: "legend"; type: "QLegend"; isReadonly: true; isPointer: true }
538 Property { name: "count"; type: "int"; isReadonly: true }
538 Property { name: "count"; type: "int"; isReadonly: true }
539 Property { name: "backgroundColor"; type: "QColor" }
539 Property { name: "backgroundColor"; type: "QColor" }
540 Property { name: "dropShadowEnabled"; type: "bool" }
540 Property { name: "dropShadowEnabled"; type: "bool" }
541 Property { name: "backgroundRoundness"; revision: 3; type: "double" }
541 Property { name: "backgroundRoundness"; revision: 3; type: "double" }
542 Property {
542 Property {
543 name: "margins"
543 name: "margins"
544 revision: 2
544 revision: 2
545 type: "DeclarativeMargins"
545 type: "DeclarativeMargins"
546 isReadonly: true
546 isReadonly: true
547 isPointer: true
547 isPointer: true
548 }
548 }
549 Property { name: "plotArea"; revision: 1; type: "QRectF"; isReadonly: true }
549 Property { name: "plotArea"; revision: 1; type: "QRectF"; isReadonly: true }
550 Property { name: "plotAreaColor"; revision: 3; type: "QColor" }
550 Property { name: "plotAreaColor"; revision: 3; type: "QColor" }
551 Property { name: "axes"; revision: 2; type: "QAbstractAxis"; isList: true; isReadonly: true }
551 Property { name: "axes"; revision: 2; type: "QAbstractAxis"; isList: true; isReadonly: true }
552 Property { name: "localizeNumbers"; revision: 4; type: "bool" }
552 Property { name: "localizeNumbers"; revision: 4; type: "bool" }
553 Property { name: "locale"; revision: 4; type: "QLocale" }
553 Property { name: "locale"; revision: 4; type: "QLocale" }
554 Signal { name: "axisLabelsChanged" }
554 Signal { name: "axisLabelsChanged" }
555 Signal {
555 Signal {
556 name: "titleColorChanged"
556 name: "titleColorChanged"
557 Parameter { name: "color"; type: "QColor" }
557 Parameter { name: "color"; type: "QColor" }
558 }
558 }
559 Signal {
559 Signal {
560 name: "dropShadowEnabledChanged"
560 name: "dropShadowEnabledChanged"
561 Parameter { name: "enabled"; type: "bool" }
561 Parameter { name: "enabled"; type: "bool" }
562 }
562 }
563 Signal { name: "marginsChanged"; revision: 2 }
563 Signal { name: "marginsChanged"; revision: 2 }
564 Signal {
564 Signal {
565 name: "plotAreaChanged"
565 name: "plotAreaChanged"
566 Parameter { name: "plotArea"; type: "QRectF" }
566 Parameter { name: "plotArea"; type: "QRectF" }
567 }
567 }
568 Signal {
568 Signal {
569 name: "seriesAdded"
569 name: "seriesAdded"
570 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
570 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
571 }
571 }
572 Signal {
572 Signal {
573 name: "seriesRemoved"
573 name: "seriesRemoved"
574 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
574 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
575 }
575 }
576 Signal { name: "plotAreaColorChanged"; revision: 3 }
576 Signal { name: "plotAreaColorChanged"; revision: 3 }
577 Signal {
577 Signal {
578 name: "backgroundRoundnessChanged"
578 name: "backgroundRoundnessChanged"
579 revision: 3
579 revision: 3
580 Parameter { name: "diameter"; type: "double" }
580 Parameter { name: "diameter"; type: "double" }
581 }
581 }
582 Signal { name: "localizeNumbersChanged"; revision: 4 }
582 Signal { name: "localizeNumbersChanged"; revision: 4 }
583 Signal { name: "localeChanged"; revision: 4 }
583 Signal { name: "localeChanged"; revision: 4 }
584 Method {
584 Method {
585 name: "series"
585 name: "series"
586 type: "QAbstractSeries*"
586 type: "QAbstractSeries*"
587 Parameter { name: "index"; type: "int" }
587 Parameter { name: "index"; type: "int" }
588 }
588 }
589 Method {
589 Method {
590 name: "series"
590 name: "series"
591 type: "QAbstractSeries*"
591 type: "QAbstractSeries*"
592 Parameter { name: "seriesName"; type: "string" }
592 Parameter { name: "seriesName"; type: "string" }
593 }
593 }
594 Method {
594 Method {
595 name: "createSeries"
595 name: "createSeries"
596 type: "QAbstractSeries*"
596 type: "QAbstractSeries*"
597 Parameter { name: "type"; type: "int" }
597 Parameter { name: "type"; type: "int" }
598 Parameter { name: "name"; type: "string" }
598 Parameter { name: "name"; type: "string" }
599 Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
599 Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
600 Parameter { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
600 Parameter { name: "axisY"; type: "QAbstractAxis"; isPointer: true }
601 }
601 }
602 Method {
602 Method {
603 name: "createSeries"
603 name: "createSeries"
604 type: "QAbstractSeries*"
604 type: "QAbstractSeries*"
605 Parameter { name: "type"; type: "int" }
605 Parameter { name: "type"; type: "int" }
606 Parameter { name: "name"; type: "string" }
606 Parameter { name: "name"; type: "string" }
607 Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
607 Parameter { name: "axisX"; type: "QAbstractAxis"; isPointer: true }
608 }
608 }
609 Method {
609 Method {
610 name: "createSeries"
610 name: "createSeries"
611 type: "QAbstractSeries*"
611 type: "QAbstractSeries*"
612 Parameter { name: "type"; type: "int" }
612 Parameter { name: "type"; type: "int" }
613 Parameter { name: "name"; type: "string" }
613 Parameter { name: "name"; type: "string" }
614 }
614 }
615 Method {
615 Method {
616 name: "createSeries"
616 name: "createSeries"
617 type: "QAbstractSeries*"
617 type: "QAbstractSeries*"
618 Parameter { name: "type"; type: "int" }
618 Parameter { name: "type"; type: "int" }
619 }
619 }
620 Method {
620 Method {
621 name: "removeSeries"
621 name: "removeSeries"
622 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
622 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
623 }
623 }
624 Method { name: "removeAllSeries" }
624 Method { name: "removeAllSeries" }
625 Method {
625 Method {
626 name: "setAxisX"
626 name: "setAxisX"
627 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
627 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
628 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
628 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
629 }
629 }
630 Method {
630 Method {
631 name: "setAxisX"
631 name: "setAxisX"
632 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
632 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
633 }
633 }
634 Method {
634 Method {
635 name: "setAxisY"
635 name: "setAxisY"
636 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
636 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
637 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
637 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
638 }
638 }
639 Method {
639 Method {
640 name: "setAxisY"
640 name: "setAxisY"
641 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
641 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
642 }
642 }
643 Method {
643 Method {
644 name: "axisX"
644 name: "axisX"
645 type: "QAbstractAxis*"
645 type: "QAbstractAxis*"
646 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
646 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
647 }
647 }
648 Method { name: "axisX"; type: "QAbstractAxis*" }
648 Method { name: "axisX"; type: "QAbstractAxis*" }
649 Method {
649 Method {
650 name: "axisY"
650 name: "axisY"
651 type: "QAbstractAxis*"
651 type: "QAbstractAxis*"
652 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
652 Parameter { name: "series"; type: "QAbstractSeries"; isPointer: true }
653 }
653 }
654 Method { name: "axisY"; type: "QAbstractAxis*" }
654 Method { name: "axisY"; type: "QAbstractAxis*" }
655 Method {
655 Method {
656 name: "zoom"
656 name: "zoom"
657 Parameter { name: "factor"; type: "double" }
657 Parameter { name: "factor"; type: "double" }
658 }
658 }
659 Method {
659 Method {
660 name: "scrollLeft"
660 name: "scrollLeft"
661 Parameter { name: "pixels"; type: "double" }
661 Parameter { name: "pixels"; type: "double" }
662 }
662 }
663 Method {
663 Method {
664 name: "scrollRight"
664 name: "scrollRight"
665 Parameter { name: "pixels"; type: "double" }
665 Parameter { name: "pixels"; type: "double" }
666 }
666 }
667 Method {
667 Method {
668 name: "scrollUp"
668 name: "scrollUp"
669 Parameter { name: "pixels"; type: "double" }
669 Parameter { name: "pixels"; type: "double" }
670 }
670 }
671 Method {
671 Method {
672 name: "scrollDown"
672 name: "scrollDown"
673 Parameter { name: "pixels"; type: "double" }
673 Parameter { name: "pixels"; type: "double" }
674 }
674 }
675 }
675 }
676 Component {
676 Component {
677 name: "QtCharts::DeclarativeHorizontalBarSeries"
677 name: "QtCharts::DeclarativeHorizontalBarSeries"
678 defaultProperty: "seriesChildren"
678 defaultProperty: "seriesChildren"
679 prototype: "QtCharts::QHorizontalBarSeries"
679 prototype: "QtCharts::QHorizontalBarSeries"
680 exports: [
680 exports: [
681 "QtCharts/HorizontalBarSeries 1.1",
681 "QtCharts/HorizontalBarSeries 1.1",
682 "QtCharts/HorizontalBarSeries 1.2",
682 "QtCharts/HorizontalBarSeries 1.2",
683 "QtCharts/HorizontalBarSeries 2.0"
683 "QtCharts/HorizontalBarSeries 2.0"
684 ]
684 ]
685 exportMetaObjectRevisions: [1, 2, 2]
685 exportMetaObjectRevisions: [1, 2, 2]
686 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
686 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
687 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
687 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
688 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
688 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
689 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
689 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
690 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
690 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
691 Signal {
691 Signal {
692 name: "axisXChanged"
692 name: "axisXChanged"
693 revision: 1
693 revision: 1
694 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
694 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
695 }
695 }
696 Signal {
696 Signal {
697 name: "axisYChanged"
697 name: "axisYChanged"
698 revision: 1
698 revision: 1
699 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
699 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
700 }
700 }
701 Signal {
701 Signal {
702 name: "axisXTopChanged"
702 name: "axisXTopChanged"
703 revision: 2
703 revision: 2
704 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
704 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
705 }
705 }
706 Signal {
706 Signal {
707 name: "axisYRightChanged"
707 name: "axisYRightChanged"
708 revision: 2
708 revision: 2
709 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
709 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
710 }
710 }
711 Method {
711 Method {
712 name: "appendSeriesChildren"
712 name: "appendSeriesChildren"
713 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
713 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
714 Parameter { name: "element"; type: "QObject"; isPointer: true }
714 Parameter { name: "element"; type: "QObject"; isPointer: true }
715 }
715 }
716 Method {
716 Method {
717 name: "at"
717 name: "at"
718 type: "DeclarativeBarSet*"
718 type: "DeclarativeBarSet*"
719 Parameter { name: "index"; type: "int" }
719 Parameter { name: "index"; type: "int" }
720 }
720 }
721 Method {
721 Method {
722 name: "append"
722 name: "append"
723 type: "DeclarativeBarSet*"
723 type: "DeclarativeBarSet*"
724 Parameter { name: "label"; type: "string" }
724 Parameter { name: "label"; type: "string" }
725 Parameter { name: "values"; type: "QVariantList" }
725 Parameter { name: "values"; type: "QVariantList" }
726 }
726 }
727 Method {
727 Method {
728 name: "insert"
728 name: "insert"
729 type: "DeclarativeBarSet*"
729 type: "DeclarativeBarSet*"
730 Parameter { name: "index"; type: "int" }
730 Parameter { name: "index"; type: "int" }
731 Parameter { name: "label"; type: "string" }
731 Parameter { name: "label"; type: "string" }
732 Parameter { name: "values"; type: "QVariantList" }
732 Parameter { name: "values"; type: "QVariantList" }
733 }
733 }
734 Method {
734 Method {
735 name: "remove"
735 name: "remove"
736 type: "bool"
736 type: "bool"
737 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
737 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
738 }
738 }
739 Method { name: "clear" }
739 Method { name: "clear" }
740 }
740 }
741 Component {
741 Component {
742 name: "QtCharts::DeclarativeHorizontalPercentBarSeries"
742 name: "QtCharts::DeclarativeHorizontalPercentBarSeries"
743 defaultProperty: "seriesChildren"
743 defaultProperty: "seriesChildren"
744 prototype: "QtCharts::QHorizontalPercentBarSeries"
744 prototype: "QtCharts::QHorizontalPercentBarSeries"
745 exports: [
745 exports: [
746 "QtCharts/HorizontalPercentBarSeries 1.1",
746 "QtCharts/HorizontalPercentBarSeries 1.1",
747 "QtCharts/HorizontalPercentBarSeries 1.2",
747 "QtCharts/HorizontalPercentBarSeries 1.2",
748 "QtCharts/HorizontalPercentBarSeries 2.0"
748 "QtCharts/HorizontalPercentBarSeries 2.0"
749 ]
749 ]
750 exportMetaObjectRevisions: [1, 2, 2]
750 exportMetaObjectRevisions: [1, 2, 2]
751 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
751 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
752 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
752 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
753 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
753 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
754 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
754 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
755 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
755 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
756 Signal {
756 Signal {
757 name: "axisXChanged"
757 name: "axisXChanged"
758 revision: 1
758 revision: 1
759 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
759 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
760 }
760 }
761 Signal {
761 Signal {
762 name: "axisYChanged"
762 name: "axisYChanged"
763 revision: 1
763 revision: 1
764 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
764 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
765 }
765 }
766 Signal {
766 Signal {
767 name: "axisXTopChanged"
767 name: "axisXTopChanged"
768 revision: 2
768 revision: 2
769 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
769 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
770 }
770 }
771 Signal {
771 Signal {
772 name: "axisYRightChanged"
772 name: "axisYRightChanged"
773 revision: 2
773 revision: 2
774 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
774 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
775 }
775 }
776 Method {
776 Method {
777 name: "appendSeriesChildren"
777 name: "appendSeriesChildren"
778 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
778 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
779 Parameter { name: "element"; type: "QObject"; isPointer: true }
779 Parameter { name: "element"; type: "QObject"; isPointer: true }
780 }
780 }
781 Method {
781 Method {
782 name: "at"
782 name: "at"
783 type: "DeclarativeBarSet*"
783 type: "DeclarativeBarSet*"
784 Parameter { name: "index"; type: "int" }
784 Parameter { name: "index"; type: "int" }
785 }
785 }
786 Method {
786 Method {
787 name: "append"
787 name: "append"
788 type: "DeclarativeBarSet*"
788 type: "DeclarativeBarSet*"
789 Parameter { name: "label"; type: "string" }
789 Parameter { name: "label"; type: "string" }
790 Parameter { name: "values"; type: "QVariantList" }
790 Parameter { name: "values"; type: "QVariantList" }
791 }
791 }
792 Method {
792 Method {
793 name: "insert"
793 name: "insert"
794 type: "DeclarativeBarSet*"
794 type: "DeclarativeBarSet*"
795 Parameter { name: "index"; type: "int" }
795 Parameter { name: "index"; type: "int" }
796 Parameter { name: "label"; type: "string" }
796 Parameter { name: "label"; type: "string" }
797 Parameter { name: "values"; type: "QVariantList" }
797 Parameter { name: "values"; type: "QVariantList" }
798 }
798 }
799 Method {
799 Method {
800 name: "remove"
800 name: "remove"
801 type: "bool"
801 type: "bool"
802 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
802 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
803 }
803 }
804 Method { name: "clear" }
804 Method { name: "clear" }
805 }
805 }
806 Component {
806 Component {
807 name: "QtCharts::DeclarativeHorizontalStackedBarSeries"
807 name: "QtCharts::DeclarativeHorizontalStackedBarSeries"
808 defaultProperty: "seriesChildren"
808 defaultProperty: "seriesChildren"
809 prototype: "QtCharts::QHorizontalStackedBarSeries"
809 prototype: "QtCharts::QHorizontalStackedBarSeries"
810 exports: [
810 exports: [
811 "QtCharts/HorizontalStackedBarSeries 1.1",
811 "QtCharts/HorizontalStackedBarSeries 1.1",
812 "QtCharts/HorizontalStackedBarSeries 1.2",
812 "QtCharts/HorizontalStackedBarSeries 1.2",
813 "QtCharts/HorizontalStackedBarSeries 2.0"
813 "QtCharts/HorizontalStackedBarSeries 2.0"
814 ]
814 ]
815 exportMetaObjectRevisions: [1, 2, 2]
815 exportMetaObjectRevisions: [1, 2, 2]
816 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
816 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
817 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
817 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
818 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
818 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
819 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
819 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
820 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
820 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
821 Signal {
821 Signal {
822 name: "axisXChanged"
822 name: "axisXChanged"
823 revision: 1
823 revision: 1
824 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
824 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
825 }
825 }
826 Signal {
826 Signal {
827 name: "axisYChanged"
827 name: "axisYChanged"
828 revision: 1
828 revision: 1
829 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
829 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
830 }
830 }
831 Signal {
831 Signal {
832 name: "axisXTopChanged"
832 name: "axisXTopChanged"
833 revision: 2
833 revision: 2
834 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
834 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
835 }
835 }
836 Signal {
836 Signal {
837 name: "axisYRightChanged"
837 name: "axisYRightChanged"
838 revision: 2
838 revision: 2
839 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
839 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
840 }
840 }
841 Method {
841 Method {
842 name: "appendSeriesChildren"
842 name: "appendSeriesChildren"
843 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
843 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
844 Parameter { name: "element"; type: "QObject"; isPointer: true }
844 Parameter { name: "element"; type: "QObject"; isPointer: true }
845 }
845 }
846 Method {
846 Method {
847 name: "at"
847 name: "at"
848 type: "DeclarativeBarSet*"
848 type: "DeclarativeBarSet*"
849 Parameter { name: "index"; type: "int" }
849 Parameter { name: "index"; type: "int" }
850 }
850 }
851 Method {
851 Method {
852 name: "append"
852 name: "append"
853 type: "DeclarativeBarSet*"
853 type: "DeclarativeBarSet*"
854 Parameter { name: "label"; type: "string" }
854 Parameter { name: "label"; type: "string" }
855 Parameter { name: "values"; type: "QVariantList" }
855 Parameter { name: "values"; type: "QVariantList" }
856 }
856 }
857 Method {
857 Method {
858 name: "insert"
858 name: "insert"
859 type: "DeclarativeBarSet*"
859 type: "DeclarativeBarSet*"
860 Parameter { name: "index"; type: "int" }
860 Parameter { name: "index"; type: "int" }
861 Parameter { name: "label"; type: "string" }
861 Parameter { name: "label"; type: "string" }
862 Parameter { name: "values"; type: "QVariantList" }
862 Parameter { name: "values"; type: "QVariantList" }
863 }
863 }
864 Method {
864 Method {
865 name: "remove"
865 name: "remove"
866 type: "bool"
866 type: "bool"
867 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
867 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
868 }
868 }
869 Method { name: "clear" }
869 Method { name: "clear" }
870 }
870 }
871 Component {
871 Component {
872 name: "QtCharts::DeclarativeLineSeries"
872 name: "QtCharts::DeclarativeLineSeries"
873 defaultProperty: "declarativeChildren"
873 defaultProperty: "declarativeChildren"
874 prototype: "QtCharts::QLineSeries"
874 prototype: "QtCharts::QLineSeries"
875 exports: [
875 exports: [
876 "QtCharts/LineSeries 1.0",
876 "QtCharts/LineSeries 1.0",
877 "QtCharts/LineSeries 1.1",
877 "QtCharts/LineSeries 1.1",
878 "QtCharts/LineSeries 1.2",
878 "QtCharts/LineSeries 1.2",
879 "QtCharts/LineSeries 1.3",
879 "QtCharts/LineSeries 1.3",
880 "QtCharts/LineSeries 2.0"
880 "QtCharts/LineSeries 2.0"
881 ]
881 ]
882 exportMetaObjectRevisions: [0, 1, 2, 3, 3]
882 exportMetaObjectRevisions: [0, 1, 2, 3, 3]
883 Property { name: "count"; type: "int"; isReadonly: true }
883 Property { name: "count"; type: "int"; isReadonly: true }
884 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
884 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
885 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
885 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
886 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
886 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
887 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
887 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
888 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
888 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
889 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
889 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
890 Property { name: "width"; revision: 1; type: "double" }
890 Property { name: "width"; revision: 1; type: "double" }
891 Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
891 Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
892 Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
892 Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
893 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
893 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
894 Signal {
894 Signal {
895 name: "countChanged"
895 name: "countChanged"
896 Parameter { name: "count"; type: "int" }
896 Parameter { name: "count"; type: "int" }
897 }
897 }
898 Signal {
898 Signal {
899 name: "axisXChanged"
899 name: "axisXChanged"
900 revision: 1
900 revision: 1
901 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
901 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
902 }
902 }
903 Signal {
903 Signal {
904 name: "axisYChanged"
904 name: "axisYChanged"
905 revision: 1
905 revision: 1
906 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
906 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
907 }
907 }
908 Signal {
908 Signal {
909 name: "axisXTopChanged"
909 name: "axisXTopChanged"
910 revision: 2
910 revision: 2
911 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
911 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
912 }
912 }
913 Signal {
913 Signal {
914 name: "axisYRightChanged"
914 name: "axisYRightChanged"
915 revision: 2
915 revision: 2
916 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
916 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
917 }
917 }
918 Signal {
918 Signal {
919 name: "axisAngularChanged"
919 name: "axisAngularChanged"
920 revision: 3
920 revision: 3
921 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
921 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
922 }
922 }
923 Signal {
923 Signal {
924 name: "axisRadialChanged"
924 name: "axisRadialChanged"
925 revision: 3
925 revision: 3
926 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
926 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
927 }
927 }
928 Signal {
928 Signal {
929 name: "widthChanged"
929 name: "widthChanged"
930 revision: 1
930 revision: 1
931 Parameter { name: "width"; type: "double" }
931 Parameter { name: "width"; type: "double" }
932 }
932 }
933 Signal {
933 Signal {
934 name: "styleChanged"
934 name: "styleChanged"
935 revision: 1
935 revision: 1
936 Parameter { name: "style"; type: "Qt::PenStyle" }
936 Parameter { name: "style"; type: "Qt::PenStyle" }
937 }
937 }
938 Signal {
938 Signal {
939 name: "capStyleChanged"
939 name: "capStyleChanged"
940 revision: 1
940 revision: 1
941 Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
941 Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
942 }
942 }
943 Method {
943 Method {
944 name: "appendDeclarativeChildren"
944 name: "appendDeclarativeChildren"
945 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
945 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
946 Parameter { name: "element"; type: "QObject"; isPointer: true }
946 Parameter { name: "element"; type: "QObject"; isPointer: true }
947 }
947 }
948 Method {
948 Method {
949 name: "handleCountChanged"
949 name: "handleCountChanged"
950 Parameter { name: "index"; type: "int" }
950 Parameter { name: "index"; type: "int" }
951 }
951 }
952 Method {
952 Method {
953 name: "append"
953 name: "append"
954 Parameter { name: "x"; type: "double" }
954 Parameter { name: "x"; type: "double" }
955 Parameter { name: "y"; type: "double" }
955 Parameter { name: "y"; type: "double" }
956 }
956 }
957 Method {
957 Method {
958 name: "replace"
958 name: "replace"
959 Parameter { name: "oldX"; type: "double" }
959 Parameter { name: "oldX"; type: "double" }
960 Parameter { name: "oldY"; type: "double" }
960 Parameter { name: "oldY"; type: "double" }
961 Parameter { name: "newX"; type: "double" }
961 Parameter { name: "newX"; type: "double" }
962 Parameter { name: "newY"; type: "double" }
962 Parameter { name: "newY"; type: "double" }
963 }
963 }
964 Method {
964 Method {
965 name: "replace"
965 name: "replace"
966 revision: 3
966 revision: 3
967 Parameter { name: "index"; type: "int" }
967 Parameter { name: "index"; type: "int" }
968 Parameter { name: "newX"; type: "double" }
968 Parameter { name: "newX"; type: "double" }
969 Parameter { name: "newY"; type: "double" }
969 Parameter { name: "newY"; type: "double" }
970 }
970 }
971 Method {
971 Method {
972 name: "remove"
972 name: "remove"
973 Parameter { name: "x"; type: "double" }
973 Parameter { name: "x"; type: "double" }
974 Parameter { name: "y"; type: "double" }
974 Parameter { name: "y"; type: "double" }
975 }
975 }
976 Method {
976 Method {
977 name: "remove"
977 name: "remove"
978 revision: 3
978 revision: 3
979 Parameter { name: "index"; type: "int" }
979 Parameter { name: "index"; type: "int" }
980 }
980 }
981 Method {
981 Method {
982 name: "insert"
982 name: "insert"
983 Parameter { name: "index"; type: "int" }
983 Parameter { name: "index"; type: "int" }
984 Parameter { name: "x"; type: "double" }
984 Parameter { name: "x"; type: "double" }
985 Parameter { name: "y"; type: "double" }
985 Parameter { name: "y"; type: "double" }
986 }
986 }
987 Method { name: "clear" }
987 Method { name: "clear" }
988 Method {
988 Method {
989 name: "at"
989 name: "at"
990 type: "QPointF"
990 type: "QPointF"
991 Parameter { name: "index"; type: "int" }
991 Parameter { name: "index"; type: "int" }
992 }
992 }
993 }
993 }
994 Component {
994 Component {
995 name: "QtCharts::DeclarativeMargins"
995 name: "QtCharts::DeclarativeMargins"
996 prototype: "QObject"
996 prototype: "QObject"
997 exports: ["QtCharts/Margins 1.1", "QtCharts/Margins 2.0"]
997 exports: ["QtCharts/Margins 1.1", "QtCharts/Margins 2.0"]
998 isCreatable: false
998 isCreatable: false
999 exportMetaObjectRevisions: [0, 0]
999 exportMetaObjectRevisions: [0, 0]
1000 Property { name: "top"; type: "int" }
1000 Property { name: "top"; type: "int" }
1001 Property { name: "bottom"; type: "int" }
1001 Property { name: "bottom"; type: "int" }
1002 Property { name: "left"; type: "int" }
1002 Property { name: "left"; type: "int" }
1003 Property { name: "right"; type: "int" }
1003 Property { name: "right"; type: "int" }
1004 Signal {
1004 Signal {
1005 name: "topChanged"
1005 name: "topChanged"
1006 Parameter { name: "top"; type: "int" }
1006 Parameter { name: "top"; type: "int" }
1007 Parameter { name: "bottom"; type: "int" }
1007 Parameter { name: "bottom"; type: "int" }
1008 Parameter { name: "left"; type: "int" }
1008 Parameter { name: "left"; type: "int" }
1009 Parameter { name: "right"; type: "int" }
1009 Parameter { name: "right"; type: "int" }
1010 }
1010 }
1011 Signal {
1011 Signal {
1012 name: "bottomChanged"
1012 name: "bottomChanged"
1013 Parameter { name: "top"; type: "int" }
1013 Parameter { name: "top"; type: "int" }
1014 Parameter { name: "bottom"; type: "int" }
1014 Parameter { name: "bottom"; type: "int" }
1015 Parameter { name: "left"; type: "int" }
1015 Parameter { name: "left"; type: "int" }
1016 Parameter { name: "right"; type: "int" }
1016 Parameter { name: "right"; type: "int" }
1017 }
1017 }
1018 Signal {
1018 Signal {
1019 name: "leftChanged"
1019 name: "leftChanged"
1020 Parameter { name: "top"; type: "int" }
1020 Parameter { name: "top"; type: "int" }
1021 Parameter { name: "bottom"; type: "int" }
1021 Parameter { name: "bottom"; type: "int" }
1022 Parameter { name: "left"; type: "int" }
1022 Parameter { name: "left"; type: "int" }
1023 Parameter { name: "right"; type: "int" }
1023 Parameter { name: "right"; type: "int" }
1024 }
1024 }
1025 Signal {
1025 Signal {
1026 name: "rightChanged"
1026 name: "rightChanged"
1027 Parameter { name: "top"; type: "int" }
1027 Parameter { name: "top"; type: "int" }
1028 Parameter { name: "bottom"; type: "int" }
1028 Parameter { name: "bottom"; type: "int" }
1029 Parameter { name: "left"; type: "int" }
1029 Parameter { name: "left"; type: "int" }
1030 Parameter { name: "right"; type: "int" }
1030 Parameter { name: "right"; type: "int" }
1031 }
1031 }
1032 }
1032 }
1033 Component {
1033 Component {
1034 name: "QtCharts::DeclarativePercentBarSeries"
1034 name: "QtCharts::DeclarativePercentBarSeries"
1035 defaultProperty: "seriesChildren"
1035 defaultProperty: "seriesChildren"
1036 prototype: "QtCharts::QPercentBarSeries"
1036 prototype: "QtCharts::QPercentBarSeries"
1037 exports: [
1037 exports: [
1038 "QtCharts/PercentBarSeries 1.0",
1038 "QtCharts/PercentBarSeries 1.0",
1039 "QtCharts/PercentBarSeries 1.1",
1039 "QtCharts/PercentBarSeries 1.1",
1040 "QtCharts/PercentBarSeries 1.2",
1040 "QtCharts/PercentBarSeries 1.2",
1041 "QtCharts/PercentBarSeries 2.0"
1041 "QtCharts/PercentBarSeries 2.0"
1042 ]
1042 ]
1043 exportMetaObjectRevisions: [0, 1, 2, 2]
1043 exportMetaObjectRevisions: [0, 1, 2, 2]
1044 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1044 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1045 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1045 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1046 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1046 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1047 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1047 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1048 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1048 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1049 Signal {
1049 Signal {
1050 name: "axisXChanged"
1050 name: "axisXChanged"
1051 revision: 1
1051 revision: 1
1052 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1052 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1053 }
1053 }
1054 Signal {
1054 Signal {
1055 name: "axisYChanged"
1055 name: "axisYChanged"
1056 revision: 1
1056 revision: 1
1057 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1057 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1058 }
1058 }
1059 Signal {
1059 Signal {
1060 name: "axisXTopChanged"
1060 name: "axisXTopChanged"
1061 revision: 2
1061 revision: 2
1062 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1062 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1063 }
1063 }
1064 Signal {
1064 Signal {
1065 name: "axisYRightChanged"
1065 name: "axisYRightChanged"
1066 revision: 2
1066 revision: 2
1067 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1067 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1068 }
1068 }
1069 Method {
1069 Method {
1070 name: "appendSeriesChildren"
1070 name: "appendSeriesChildren"
1071 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1071 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1072 Parameter { name: "element"; type: "QObject"; isPointer: true }
1072 Parameter { name: "element"; type: "QObject"; isPointer: true }
1073 }
1073 }
1074 Method {
1074 Method {
1075 name: "at"
1075 name: "at"
1076 type: "DeclarativeBarSet*"
1076 type: "DeclarativeBarSet*"
1077 Parameter { name: "index"; type: "int" }
1077 Parameter { name: "index"; type: "int" }
1078 }
1078 }
1079 Method {
1079 Method {
1080 name: "append"
1080 name: "append"
1081 type: "DeclarativeBarSet*"
1081 type: "DeclarativeBarSet*"
1082 Parameter { name: "label"; type: "string" }
1082 Parameter { name: "label"; type: "string" }
1083 Parameter { name: "values"; type: "QVariantList" }
1083 Parameter { name: "values"; type: "QVariantList" }
1084 }
1084 }
1085 Method {
1085 Method {
1086 name: "insert"
1086 name: "insert"
1087 type: "DeclarativeBarSet*"
1087 type: "DeclarativeBarSet*"
1088 Parameter { name: "index"; type: "int" }
1088 Parameter { name: "index"; type: "int" }
1089 Parameter { name: "label"; type: "string" }
1089 Parameter { name: "label"; type: "string" }
1090 Parameter { name: "values"; type: "QVariantList" }
1090 Parameter { name: "values"; type: "QVariantList" }
1091 }
1091 }
1092 Method {
1092 Method {
1093 name: "remove"
1093 name: "remove"
1094 type: "bool"
1094 type: "bool"
1095 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1095 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1096 }
1096 }
1097 Method { name: "clear" }
1097 Method { name: "clear" }
1098 }
1098 }
1099 Component {
1099 Component {
1100 name: "QtCharts::DeclarativePieSeries"
1100 name: "QtCharts::DeclarativePieSeries"
1101 defaultProperty: "seriesChildren"
1101 defaultProperty: "seriesChildren"
1102 prototype: "QtCharts::QPieSeries"
1102 prototype: "QtCharts::QPieSeries"
1103 exports: [
1103 exports: [
1104 "QtCharts/PieSeries 1.0",
1104 "QtCharts/PieSeries 1.0",
1105 "QtCharts/PieSeries 1.1",
1105 "QtCharts/PieSeries 1.1",
1106 "QtCharts/PieSeries 2.0"
1106 "QtCharts/PieSeries 2.0"
1107 ]
1107 ]
1108 exportMetaObjectRevisions: [0, 0, 0]
1108 exportMetaObjectRevisions: [0, 0, 0]
1109 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1109 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1110 Signal {
1110 Signal {
1111 name: "sliceAdded"
1111 name: "sliceAdded"
1112 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1112 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1113 }
1113 }
1114 Signal {
1114 Signal {
1115 name: "sliceRemoved"
1115 name: "sliceRemoved"
1116 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1116 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1117 }
1117 }
1118 Method {
1118 Method {
1119 name: "appendSeriesChildren"
1119 name: "appendSeriesChildren"
1120 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1120 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1121 Parameter { name: "element"; type: "QObject"; isPointer: true }
1121 Parameter { name: "element"; type: "QObject"; isPointer: true }
1122 }
1122 }
1123 Method {
1123 Method {
1124 name: "handleAdded"
1124 name: "handleAdded"
1125 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1125 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1126 }
1126 }
1127 Method {
1127 Method {
1128 name: "handleRemoved"
1128 name: "handleRemoved"
1129 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1129 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
1130 }
1130 }
1131 Method {
1131 Method {
1132 name: "at"
1132 name: "at"
1133 type: "QPieSlice*"
1133 type: "QPieSlice*"
1134 Parameter { name: "index"; type: "int" }
1134 Parameter { name: "index"; type: "int" }
1135 }
1135 }
1136 Method {
1136 Method {
1137 name: "find"
1137 name: "find"
1138 type: "QPieSlice*"
1138 type: "QPieSlice*"
1139 Parameter { name: "label"; type: "string" }
1139 Parameter { name: "label"; type: "string" }
1140 }
1140 }
1141 Method {
1141 Method {
1142 name: "append"
1142 name: "append"
1143 type: "DeclarativePieSlice*"
1143 type: "DeclarativePieSlice*"
1144 Parameter { name: "label"; type: "string" }
1144 Parameter { name: "label"; type: "string" }
1145 Parameter { name: "value"; type: "double" }
1145 Parameter { name: "value"; type: "double" }
1146 }
1146 }
1147 Method {
1147 Method {
1148 name: "remove"
1148 name: "remove"
1149 type: "bool"
1149 type: "bool"
1150 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1150 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
1151 }
1151 }
1152 Method { name: "clear" }
1152 Method { name: "clear" }
1153 }
1153 }
1154 Component {
1154 Component {
1155 name: "QtCharts::DeclarativePieSlice"
1155 name: "QtCharts::DeclarativePieSlice"
1156 prototype: "QtCharts::QPieSlice"
1156 prototype: "QtCharts::QPieSlice"
1157 exports: ["QtCharts/PieSlice 1.4", "QtCharts/PieSlice 2.0"]
1157 exports: ["QtCharts/PieSlice 1.4", "QtCharts/PieSlice 2.0"]
1158 exportMetaObjectRevisions: [0, 0]
1158 exportMetaObjectRevisions: [0, 0]
1159 Property { name: "brushFilename"; type: "string" }
1159 Property { name: "brushFilename"; type: "string" }
1160 Signal {
1160 Signal {
1161 name: "brushFilenameChanged"
1161 name: "brushFilenameChanged"
1162 Parameter { name: "brushFilename"; type: "string" }
1162 Parameter { name: "brushFilename"; type: "string" }
1163 }
1163 }
1164 }
1164 }
1165 Component {
1165 Component {
1166 name: "QtCharts::DeclarativePolarChart"
1166 name: "QtCharts::DeclarativePolarChart"
1167 defaultProperty: "data"
1167 defaultProperty: "data"
1168 prototype: "QtCharts::DeclarativeChart"
1168 prototype: "QtCharts::DeclarativeChart"
1169 exports: [
1169 exports: [
1170 "QtCharts/PolarChartView 1.3",
1170 "QtCharts/PolarChartView 1.3",
1171 "QtCharts/PolarChartView 2.0"
1171 "QtCharts/PolarChartView 2.0"
1172 ]
1172 ]
1173 exportMetaObjectRevisions: [1, 1]
1173 exportMetaObjectRevisions: [1, 1]
1174 }
1174 }
1175 Component {
1175 Component {
1176 name: "QtCharts::DeclarativeScatterSeries"
1176 name: "QtCharts::DeclarativeScatterSeries"
1177 defaultProperty: "declarativeChildren"
1177 defaultProperty: "declarativeChildren"
1178 prototype: "QtCharts::QScatterSeries"
1178 prototype: "QtCharts::QScatterSeries"
1179 exports: [
1179 exports: [
1180 "QtCharts/ScatterSeries 1.0",
1180 "QtCharts/ScatterSeries 1.0",
1181 "QtCharts/ScatterSeries 1.1",
1181 "QtCharts/ScatterSeries 1.1",
1182 "QtCharts/ScatterSeries 1.2",
1182 "QtCharts/ScatterSeries 1.2",
1183 "QtCharts/ScatterSeries 1.3",
1183 "QtCharts/ScatterSeries 1.3",
1184 "QtCharts/ScatterSeries 1.4",
1184 "QtCharts/ScatterSeries 1.4",
1185 "QtCharts/ScatterSeries 2.0"
1185 "QtCharts/ScatterSeries 2.0"
1186 ]
1186 ]
1187 exportMetaObjectRevisions: [0, 1, 2, 3, 4, 4]
1187 exportMetaObjectRevisions: [0, 1, 2, 3, 4, 4]
1188 Property { name: "count"; type: "int"; isReadonly: true }
1188 Property { name: "count"; type: "int"; isReadonly: true }
1189 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1189 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1190 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1190 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1191 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1191 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1192 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1192 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1193 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1193 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1194 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1194 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1195 Property { name: "borderWidth"; revision: 1; type: "double" }
1195 Property { name: "borderWidth"; revision: 1; type: "double" }
1196 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
1196 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
1197 Property { name: "brushFilename"; revision: 4; type: "string" }
1197 Property { name: "brushFilename"; revision: 4; type: "string" }
1198 Property { name: "brush"; revision: 4; type: "QBrush" }
1198 Property { name: "brush"; revision: 4; type: "QBrush" }
1199 Signal {
1199 Signal {
1200 name: "countChanged"
1200 name: "countChanged"
1201 Parameter { name: "count"; type: "int" }
1201 Parameter { name: "count"; type: "int" }
1202 }
1202 }
1203 Signal {
1203 Signal {
1204 name: "axisXChanged"
1204 name: "axisXChanged"
1205 revision: 1
1205 revision: 1
1206 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1206 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1207 }
1207 }
1208 Signal {
1208 Signal {
1209 name: "axisYChanged"
1209 name: "axisYChanged"
1210 revision: 1
1210 revision: 1
1211 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1211 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1212 }
1212 }
1213 Signal {
1213 Signal {
1214 name: "borderWidthChanged"
1214 name: "borderWidthChanged"
1215 revision: 1
1215 revision: 1
1216 Parameter { name: "width"; type: "double" }
1216 Parameter { name: "width"; type: "double" }
1217 }
1217 }
1218 Signal {
1218 Signal {
1219 name: "axisXTopChanged"
1219 name: "axisXTopChanged"
1220 revision: 2
1220 revision: 2
1221 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1221 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1222 }
1222 }
1223 Signal {
1223 Signal {
1224 name: "axisYRightChanged"
1224 name: "axisYRightChanged"
1225 revision: 2
1225 revision: 2
1226 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1226 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1227 }
1227 }
1228 Signal {
1228 Signal {
1229 name: "axisAngularChanged"
1229 name: "axisAngularChanged"
1230 revision: 3
1230 revision: 3
1231 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1231 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1232 }
1232 }
1233 Signal {
1233 Signal {
1234 name: "axisRadialChanged"
1234 name: "axisRadialChanged"
1235 revision: 3
1235 revision: 3
1236 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1236 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1237 }
1237 }
1238 Signal {
1238 Signal {
1239 name: "brushFilenameChanged"
1239 name: "brushFilenameChanged"
1240 revision: 4
1240 revision: 4
1241 Parameter { name: "brushFilename"; type: "string" }
1241 Parameter { name: "brushFilename"; type: "string" }
1242 }
1242 }
1243 Signal { name: "brushChanged"; revision: 4 }
1243 Signal { name: "brushChanged"; revision: 4 }
1244 Method {
1244 Method {
1245 name: "appendDeclarativeChildren"
1245 name: "appendDeclarativeChildren"
1246 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1246 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1247 Parameter { name: "element"; type: "QObject"; isPointer: true }
1247 Parameter { name: "element"; type: "QObject"; isPointer: true }
1248 }
1248 }
1249 Method {
1249 Method {
1250 name: "handleCountChanged"
1250 name: "handleCountChanged"
1251 Parameter { name: "index"; type: "int" }
1251 Parameter { name: "index"; type: "int" }
1252 }
1252 }
1253 Method {
1253 Method {
1254 name: "append"
1254 name: "append"
1255 Parameter { name: "x"; type: "double" }
1255 Parameter { name: "x"; type: "double" }
1256 Parameter { name: "y"; type: "double" }
1256 Parameter { name: "y"; type: "double" }
1257 }
1257 }
1258 Method {
1258 Method {
1259 name: "replace"
1259 name: "replace"
1260 Parameter { name: "oldX"; type: "double" }
1260 Parameter { name: "oldX"; type: "double" }
1261 Parameter { name: "oldY"; type: "double" }
1261 Parameter { name: "oldY"; type: "double" }
1262 Parameter { name: "newX"; type: "double" }
1262 Parameter { name: "newX"; type: "double" }
1263 Parameter { name: "newY"; type: "double" }
1263 Parameter { name: "newY"; type: "double" }
1264 }
1264 }
1265 Method {
1265 Method {
1266 name: "replace"
1266 name: "replace"
1267 revision: 3
1267 revision: 3
1268 Parameter { name: "index"; type: "int" }
1268 Parameter { name: "index"; type: "int" }
1269 Parameter { name: "newX"; type: "double" }
1269 Parameter { name: "newX"; type: "double" }
1270 Parameter { name: "newY"; type: "double" }
1270 Parameter { name: "newY"; type: "double" }
1271 }
1271 }
1272 Method {
1272 Method {
1273 name: "remove"
1273 name: "remove"
1274 Parameter { name: "x"; type: "double" }
1274 Parameter { name: "x"; type: "double" }
1275 Parameter { name: "y"; type: "double" }
1275 Parameter { name: "y"; type: "double" }
1276 }
1276 }
1277 Method {
1277 Method {
1278 name: "remove"
1278 name: "remove"
1279 revision: 3
1279 revision: 3
1280 Parameter { name: "index"; type: "int" }
1280 Parameter { name: "index"; type: "int" }
1281 }
1281 }
1282 Method {
1282 Method {
1283 name: "insert"
1283 name: "insert"
1284 Parameter { name: "index"; type: "int" }
1284 Parameter { name: "index"; type: "int" }
1285 Parameter { name: "x"; type: "double" }
1285 Parameter { name: "x"; type: "double" }
1286 Parameter { name: "y"; type: "double" }
1286 Parameter { name: "y"; type: "double" }
1287 }
1287 }
1288 Method { name: "clear" }
1288 Method { name: "clear" }
1289 Method {
1289 Method {
1290 name: "at"
1290 name: "at"
1291 type: "QPointF"
1291 type: "QPointF"
1292 Parameter { name: "index"; type: "int" }
1292 Parameter { name: "index"; type: "int" }
1293 }
1293 }
1294 }
1294 }
1295 Component {
1295 Component {
1296 name: "QtCharts::DeclarativeSplineSeries"
1296 name: "QtCharts::DeclarativeSplineSeries"
1297 defaultProperty: "declarativeChildren"
1297 defaultProperty: "declarativeChildren"
1298 prototype: "QtCharts::QSplineSeries"
1298 prototype: "QtCharts::QSplineSeries"
1299 exports: [
1299 exports: [
1300 "QtCharts/SplineSeries 1.0",
1300 "QtCharts/SplineSeries 1.0",
1301 "QtCharts/SplineSeries 1.1",
1301 "QtCharts/SplineSeries 1.1",
1302 "QtCharts/SplineSeries 1.2",
1302 "QtCharts/SplineSeries 1.2",
1303 "QtCharts/SplineSeries 1.3",
1303 "QtCharts/SplineSeries 1.3",
1304 "QtCharts/SplineSeries 2.0"
1304 "QtCharts/SplineSeries 2.0"
1305 ]
1305 ]
1306 exportMetaObjectRevisions: [0, 1, 2, 3, 3]
1306 exportMetaObjectRevisions: [0, 1, 2, 3, 3]
1307 Property { name: "count"; type: "int"; isReadonly: true }
1307 Property { name: "count"; type: "int"; isReadonly: true }
1308 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1308 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1309 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1309 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1310 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1310 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1311 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1311 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1312 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1312 Property { name: "axisAngular"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1313 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1313 Property { name: "axisRadial"; revision: 3; type: "QAbstractAxis"; isPointer: true }
1314 Property { name: "width"; revision: 1; type: "double" }
1314 Property { name: "width"; revision: 1; type: "double" }
1315 Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
1315 Property { name: "style"; revision: 1; type: "Qt::PenStyle" }
1316 Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
1316 Property { name: "capStyle"; revision: 1; type: "Qt::PenCapStyle" }
1317 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
1317 Property { name: "declarativeChildren"; type: "QObject"; isList: true; isReadonly: true }
1318 Signal {
1318 Signal {
1319 name: "countChanged"
1319 name: "countChanged"
1320 Parameter { name: "count"; type: "int" }
1320 Parameter { name: "count"; type: "int" }
1321 }
1321 }
1322 Signal {
1322 Signal {
1323 name: "axisXChanged"
1323 name: "axisXChanged"
1324 revision: 1
1324 revision: 1
1325 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1325 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1326 }
1326 }
1327 Signal {
1327 Signal {
1328 name: "axisYChanged"
1328 name: "axisYChanged"
1329 revision: 1
1329 revision: 1
1330 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1330 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1331 }
1331 }
1332 Signal {
1332 Signal {
1333 name: "axisXTopChanged"
1333 name: "axisXTopChanged"
1334 revision: 2
1334 revision: 2
1335 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1335 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1336 }
1336 }
1337 Signal {
1337 Signal {
1338 name: "axisYRightChanged"
1338 name: "axisYRightChanged"
1339 revision: 2
1339 revision: 2
1340 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1340 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1341 }
1341 }
1342 Signal {
1342 Signal {
1343 name: "axisAngularChanged"
1343 name: "axisAngularChanged"
1344 revision: 3
1344 revision: 3
1345 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1345 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1346 }
1346 }
1347 Signal {
1347 Signal {
1348 name: "axisRadialChanged"
1348 name: "axisRadialChanged"
1349 revision: 3
1349 revision: 3
1350 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1350 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1351 }
1351 }
1352 Signal {
1352 Signal {
1353 name: "widthChanged"
1353 name: "widthChanged"
1354 revision: 1
1354 revision: 1
1355 Parameter { name: "width"; type: "double" }
1355 Parameter { name: "width"; type: "double" }
1356 }
1356 }
1357 Signal {
1357 Signal {
1358 name: "styleChanged"
1358 name: "styleChanged"
1359 revision: 1
1359 revision: 1
1360 Parameter { name: "style"; type: "Qt::PenStyle" }
1360 Parameter { name: "style"; type: "Qt::PenStyle" }
1361 }
1361 }
1362 Signal {
1362 Signal {
1363 name: "capStyleChanged"
1363 name: "capStyleChanged"
1364 revision: 1
1364 revision: 1
1365 Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
1365 Parameter { name: "capStyle"; type: "Qt::PenCapStyle" }
1366 }
1366 }
1367 Method {
1367 Method {
1368 name: "appendDeclarativeChildren"
1368 name: "appendDeclarativeChildren"
1369 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1369 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1370 Parameter { name: "element"; type: "QObject"; isPointer: true }
1370 Parameter { name: "element"; type: "QObject"; isPointer: true }
1371 }
1371 }
1372 Method {
1372 Method {
1373 name: "handleCountChanged"
1373 name: "handleCountChanged"
1374 Parameter { name: "index"; type: "int" }
1374 Parameter { name: "index"; type: "int" }
1375 }
1375 }
1376 Method {
1376 Method {
1377 name: "append"
1377 name: "append"
1378 Parameter { name: "x"; type: "double" }
1378 Parameter { name: "x"; type: "double" }
1379 Parameter { name: "y"; type: "double" }
1379 Parameter { name: "y"; type: "double" }
1380 }
1380 }
1381 Method {
1381 Method {
1382 name: "replace"
1382 name: "replace"
1383 Parameter { name: "oldX"; type: "double" }
1383 Parameter { name: "oldX"; type: "double" }
1384 Parameter { name: "oldY"; type: "double" }
1384 Parameter { name: "oldY"; type: "double" }
1385 Parameter { name: "newX"; type: "double" }
1385 Parameter { name: "newX"; type: "double" }
1386 Parameter { name: "newY"; type: "double" }
1386 Parameter { name: "newY"; type: "double" }
1387 }
1387 }
1388 Method {
1388 Method {
1389 name: "replace"
1389 name: "replace"
1390 revision: 3
1390 revision: 3
1391 Parameter { name: "index"; type: "int" }
1391 Parameter { name: "index"; type: "int" }
1392 Parameter { name: "newX"; type: "double" }
1392 Parameter { name: "newX"; type: "double" }
1393 Parameter { name: "newY"; type: "double" }
1393 Parameter { name: "newY"; type: "double" }
1394 }
1394 }
1395 Method {
1395 Method {
1396 name: "remove"
1396 name: "remove"
1397 Parameter { name: "x"; type: "double" }
1397 Parameter { name: "x"; type: "double" }
1398 Parameter { name: "y"; type: "double" }
1398 Parameter { name: "y"; type: "double" }
1399 }
1399 }
1400 Method {
1400 Method {
1401 name: "remove"
1401 name: "remove"
1402 revision: 3
1402 revision: 3
1403 Parameter { name: "index"; type: "int" }
1403 Parameter { name: "index"; type: "int" }
1404 }
1404 }
1405 Method {
1405 Method {
1406 name: "insert"
1406 name: "insert"
1407 Parameter { name: "index"; type: "int" }
1407 Parameter { name: "index"; type: "int" }
1408 Parameter { name: "x"; type: "double" }
1408 Parameter { name: "x"; type: "double" }
1409 Parameter { name: "y"; type: "double" }
1409 Parameter { name: "y"; type: "double" }
1410 }
1410 }
1411 Method { name: "clear" }
1411 Method { name: "clear" }
1412 Method {
1412 Method {
1413 name: "at"
1413 name: "at"
1414 type: "QPointF"
1414 type: "QPointF"
1415 Parameter { name: "index"; type: "int" }
1415 Parameter { name: "index"; type: "int" }
1416 }
1416 }
1417 }
1417 }
1418 Component {
1418 Component {
1419 name: "QtCharts::DeclarativeStackedBarSeries"
1419 name: "QtCharts::DeclarativeStackedBarSeries"
1420 defaultProperty: "seriesChildren"
1420 defaultProperty: "seriesChildren"
1421 prototype: "QtCharts::QStackedBarSeries"
1421 prototype: "QtCharts::QStackedBarSeries"
1422 exports: [
1422 exports: [
1423 "QtCharts/StackedBarSeries 1.0",
1423 "QtCharts/StackedBarSeries 1.0",
1424 "QtCharts/StackedBarSeries 1.1",
1424 "QtCharts/StackedBarSeries 1.1",
1425 "QtCharts/StackedBarSeries 1.2",
1425 "QtCharts/StackedBarSeries 1.2",
1426 "QtCharts/StackedBarSeries 2.0"
1426 "QtCharts/StackedBarSeries 2.0"
1427 ]
1427 ]
1428 exportMetaObjectRevisions: [0, 1, 2, 2]
1428 exportMetaObjectRevisions: [0, 1, 2, 2]
1429 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1429 Property { name: "axisX"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1430 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1430 Property { name: "axisY"; revision: 1; type: "QAbstractAxis"; isPointer: true }
1431 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1431 Property { name: "axisXTop"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1432 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1432 Property { name: "axisYRight"; revision: 2; type: "QAbstractAxis"; isPointer: true }
1433 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1433 Property { name: "seriesChildren"; type: "QObject"; isList: true; isReadonly: true }
1434 Signal {
1434 Signal {
1435 name: "axisXChanged"
1435 name: "axisXChanged"
1436 revision: 1
1436 revision: 1
1437 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1437 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1438 }
1438 }
1439 Signal {
1439 Signal {
1440 name: "axisYChanged"
1440 name: "axisYChanged"
1441 revision: 1
1441 revision: 1
1442 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1442 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1443 }
1443 }
1444 Signal {
1444 Signal {
1445 name: "axisXTopChanged"
1445 name: "axisXTopChanged"
1446 revision: 2
1446 revision: 2
1447 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1447 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1448 }
1448 }
1449 Signal {
1449 Signal {
1450 name: "axisYRightChanged"
1450 name: "axisYRightChanged"
1451 revision: 2
1451 revision: 2
1452 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1452 Parameter { name: "axis"; type: "QAbstractAxis"; isPointer: true }
1453 }
1453 }
1454 Method {
1454 Method {
1455 name: "appendSeriesChildren"
1455 name: "appendSeriesChildren"
1456 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1456 Parameter { name: "list"; type: "QObject"; isList: true; isPointer: true }
1457 Parameter { name: "element"; type: "QObject"; isPointer: true }
1457 Parameter { name: "element"; type: "QObject"; isPointer: true }
1458 }
1458 }
1459 Method {
1459 Method {
1460 name: "at"
1460 name: "at"
1461 type: "DeclarativeBarSet*"
1461 type: "DeclarativeBarSet*"
1462 Parameter { name: "index"; type: "int" }
1462 Parameter { name: "index"; type: "int" }
1463 }
1463 }
1464 Method {
1464 Method {
1465 name: "append"
1465 name: "append"
1466 type: "DeclarativeBarSet*"
1466 type: "DeclarativeBarSet*"
1467 Parameter { name: "label"; type: "string" }
1467 Parameter { name: "label"; type: "string" }
1468 Parameter { name: "values"; type: "QVariantList" }
1468 Parameter { name: "values"; type: "QVariantList" }
1469 }
1469 }
1470 Method {
1470 Method {
1471 name: "insert"
1471 name: "insert"
1472 type: "DeclarativeBarSet*"
1472 type: "DeclarativeBarSet*"
1473 Parameter { name: "index"; type: "int" }
1473 Parameter { name: "index"; type: "int" }
1474 Parameter { name: "label"; type: "string" }
1474 Parameter { name: "label"; type: "string" }
1475 Parameter { name: "values"; type: "QVariantList" }
1475 Parameter { name: "values"; type: "QVariantList" }
1476 }
1476 }
1477 Method {
1477 Method {
1478 name: "remove"
1478 name: "remove"
1479 type: "bool"
1479 type: "bool"
1480 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1480 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1481 }
1481 }
1482 Method { name: "clear" }
1482 Method { name: "clear" }
1483 }
1483 }
1484 Component {
1484 Component {
1485 name: "QtCharts::DeclarativeXYPoint"
1485 name: "QtCharts::DeclarativeXYPoint"
1486 prototype: "QObject"
1486 prototype: "QObject"
1487 exports: ["QtCharts/XYPoint 1.0", "QtCharts/XYPoint 2.0"]
1487 exports: ["QtCharts/XYPoint 1.0", "QtCharts/XYPoint 2.0"]
1488 exportMetaObjectRevisions: [0, 0]
1488 exportMetaObjectRevisions: [0, 0]
1489 Property { name: "x"; type: "double" }
1489 Property { name: "x"; type: "double" }
1490 Property { name: "y"; type: "double" }
1490 Property { name: "y"; type: "double" }
1491 }
1491 }
1492 Component {
1492 Component {
1493 name: "QtCharts::LegendScroller"
1493 name: "QtCharts::LegendScroller"
1494 defaultProperty: "children"
1494 defaultProperty: "children"
1495 prototype: "QtCharts::QLegend"
1495 prototype: "QtCharts::QLegend"
1496 }
1496 }
1497 Component {
1497 Component {
1498 name: "QtCharts::QAbstractAxis"
1498 name: "QtCharts::QAbstractAxis"
1499 prototype: "QObject"
1499 prototype: "QObject"
1500 exports: ["QtCharts/AbstractAxis 1.0", "QtCharts/AbstractAxis 2.0"]
1500 exports: [
1501 "QtCharts/AbstractAxis 1.0",
1502 "QtCharts/AbstractAxis 2.0",
1503 "QtCharts/AbstractAxis 2.1"
1504 ]
1501 isCreatable: false
1505 isCreatable: false
1502 exportMetaObjectRevisions: [0, 0]
1506 exportMetaObjectRevisions: [0, 0, 0]
1503 Property { name: "visible"; type: "bool" }
1507 Property { name: "visible"; type: "bool" }
1504 Property { name: "lineVisible"; type: "bool" }
1508 Property { name: "lineVisible"; type: "bool" }
1505 Property { name: "linePen"; type: "QPen" }
1509 Property { name: "linePen"; type: "QPen" }
1506 Property { name: "color"; type: "QColor" }
1510 Property { name: "color"; type: "QColor" }
1507 Property { name: "labelsVisible"; type: "bool" }
1511 Property { name: "labelsVisible"; type: "bool" }
1508 Property { name: "labelsBrush"; type: "QBrush" }
1512 Property { name: "labelsBrush"; type: "QBrush" }
1509 Property { name: "labelsAngle"; type: "int" }
1513 Property { name: "labelsAngle"; type: "int" }
1510 Property { name: "labelsFont"; type: "QFont" }
1514 Property { name: "labelsFont"; type: "QFont" }
1511 Property { name: "labelsColor"; type: "QColor" }
1515 Property { name: "labelsColor"; type: "QColor" }
1512 Property { name: "gridVisible"; type: "bool" }
1516 Property { name: "gridVisible"; type: "bool" }
1513 Property { name: "gridLinePen"; type: "QPen" }
1517 Property { name: "gridLinePen"; type: "QPen" }
1514 Property { name: "shadesVisible"; type: "bool" }
1518 Property { name: "shadesVisible"; type: "bool" }
1515 Property { name: "shadesColor"; type: "QColor" }
1519 Property { name: "shadesColor"; type: "QColor" }
1516 Property { name: "shadesBorderColor"; type: "QColor" }
1520 Property { name: "shadesBorderColor"; type: "QColor" }
1517 Property { name: "shadesPen"; type: "QPen" }
1521 Property { name: "shadesPen"; type: "QPen" }
1518 Property { name: "shadesBrush"; type: "QBrush" }
1522 Property { name: "shadesBrush"; type: "QBrush" }
1519 Property { name: "titleText"; type: "string" }
1523 Property { name: "titleText"; type: "string" }
1520 Property { name: "titleBrush"; type: "QBrush" }
1524 Property { name: "titleBrush"; type: "QBrush" }
1521 Property { name: "titleVisible"; type: "bool" }
1525 Property { name: "titleVisible"; type: "bool" }
1522 Property { name: "titleFont"; type: "QFont" }
1526 Property { name: "titleFont"; type: "QFont" }
1523 Property { name: "orientation"; type: "Qt::Orientation"; isReadonly: true }
1527 Property { name: "orientation"; type: "Qt::Orientation"; isReadonly: true }
1524 Property { name: "alignment"; type: "Qt::Alignment"; isReadonly: true }
1528 Property { name: "alignment"; type: "Qt::Alignment"; isReadonly: true }
1529 Property { name: "reverse"; type: "bool" }
1525 Signal {
1530 Signal {
1526 name: "visibleChanged"
1531 name: "visibleChanged"
1527 Parameter { name: "visible"; type: "bool" }
1532 Parameter { name: "visible"; type: "bool" }
1528 }
1533 }
1529 Signal {
1534 Signal {
1530 name: "linePenChanged"
1535 name: "linePenChanged"
1531 Parameter { name: "pen"; type: "QPen" }
1536 Parameter { name: "pen"; type: "QPen" }
1532 }
1537 }
1533 Signal {
1538 Signal {
1534 name: "lineVisibleChanged"
1539 name: "lineVisibleChanged"
1535 Parameter { name: "visible"; type: "bool" }
1540 Parameter { name: "visible"; type: "bool" }
1536 }
1541 }
1537 Signal {
1542 Signal {
1538 name: "labelsVisibleChanged"
1543 name: "labelsVisibleChanged"
1539 Parameter { name: "visible"; type: "bool" }
1544 Parameter { name: "visible"; type: "bool" }
1540 }
1545 }
1541 Signal {
1546 Signal {
1542 name: "labelsBrushChanged"
1547 name: "labelsBrushChanged"
1543 Parameter { name: "brush"; type: "QBrush" }
1548 Parameter { name: "brush"; type: "QBrush" }
1544 }
1549 }
1545 Signal {
1550 Signal {
1546 name: "labelsFontChanged"
1551 name: "labelsFontChanged"
1547 Parameter { name: "pen"; type: "QFont" }
1552 Parameter { name: "pen"; type: "QFont" }
1548 }
1553 }
1549 Signal {
1554 Signal {
1550 name: "labelsAngleChanged"
1555 name: "labelsAngleChanged"
1551 Parameter { name: "angle"; type: "int" }
1556 Parameter { name: "angle"; type: "int" }
1552 }
1557 }
1553 Signal {
1558 Signal {
1554 name: "gridLinePenChanged"
1559 name: "gridLinePenChanged"
1555 Parameter { name: "pen"; type: "QPen" }
1560 Parameter { name: "pen"; type: "QPen" }
1556 }
1561 }
1557 Signal {
1562 Signal {
1558 name: "gridVisibleChanged"
1563 name: "gridVisibleChanged"
1559 Parameter { name: "visible"; type: "bool" }
1564 Parameter { name: "visible"; type: "bool" }
1560 }
1565 }
1561 Signal {
1566 Signal {
1562 name: "colorChanged"
1567 name: "colorChanged"
1563 Parameter { name: "color"; type: "QColor" }
1568 Parameter { name: "color"; type: "QColor" }
1564 }
1569 }
1565 Signal {
1570 Signal {
1566 name: "labelsColorChanged"
1571 name: "labelsColorChanged"
1567 Parameter { name: "color"; type: "QColor" }
1572 Parameter { name: "color"; type: "QColor" }
1568 }
1573 }
1569 Signal {
1574 Signal {
1570 name: "titleTextChanged"
1575 name: "titleTextChanged"
1571 Parameter { name: "title"; type: "string" }
1576 Parameter { name: "title"; type: "string" }
1572 }
1577 }
1573 Signal {
1578 Signal {
1574 name: "titleBrushChanged"
1579 name: "titleBrushChanged"
1575 Parameter { name: "brush"; type: "QBrush" }
1580 Parameter { name: "brush"; type: "QBrush" }
1576 }
1581 }
1577 Signal {
1582 Signal {
1578 name: "titleVisibleChanged"
1583 name: "titleVisibleChanged"
1579 Parameter { name: "visible"; type: "bool" }
1584 Parameter { name: "visible"; type: "bool" }
1580 }
1585 }
1581 Signal {
1586 Signal {
1582 name: "titleFontChanged"
1587 name: "titleFontChanged"
1583 Parameter { name: "font"; type: "QFont" }
1588 Parameter { name: "font"; type: "QFont" }
1584 }
1589 }
1585 Signal {
1590 Signal {
1586 name: "shadesVisibleChanged"
1591 name: "shadesVisibleChanged"
1587 Parameter { name: "visible"; type: "bool" }
1592 Parameter { name: "visible"; type: "bool" }
1588 }
1593 }
1589 Signal {
1594 Signal {
1590 name: "shadesColorChanged"
1595 name: "shadesColorChanged"
1591 Parameter { name: "color"; type: "QColor" }
1596 Parameter { name: "color"; type: "QColor" }
1592 }
1597 }
1593 Signal {
1598 Signal {
1594 name: "shadesBorderColorChanged"
1599 name: "shadesBorderColorChanged"
1595 Parameter { name: "color"; type: "QColor" }
1600 Parameter { name: "color"; type: "QColor" }
1596 }
1601 }
1597 Signal {
1602 Signal {
1598 name: "shadesPenChanged"
1603 name: "shadesPenChanged"
1599 Parameter { name: "pen"; type: "QPen" }
1604 Parameter { name: "pen"; type: "QPen" }
1600 }
1605 }
1601 Signal {
1606 Signal {
1602 name: "shadesBrushChanged"
1607 name: "shadesBrushChanged"
1603 Parameter { name: "brush"; type: "QBrush" }
1608 Parameter { name: "brush"; type: "QBrush" }
1604 }
1609 }
1610 Signal {
1611 name: "reverseChanged"
1612 Parameter { name: "reverse"; type: "bool" }
1613 }
1605 }
1614 }
1606 Component {
1615 Component {
1607 name: "QtCharts::QAbstractBarSeries"
1616 name: "QtCharts::QAbstractBarSeries"
1608 prototype: "QtCharts::QAbstractSeries"
1617 prototype: "QtCharts::QAbstractSeries"
1609 exports: [
1618 exports: [
1610 "QtCharts/AbstractBarSeries 1.0",
1619 "QtCharts/AbstractBarSeries 1.0",
1611 "QtCharts/AbstractBarSeries 2.0"
1620 "QtCharts/AbstractBarSeries 2.0"
1612 ]
1621 ]
1613 isCreatable: false
1622 isCreatable: false
1614 exportMetaObjectRevisions: [0, 0]
1623 exportMetaObjectRevisions: [0, 0]
1615 Enum {
1624 Enum {
1616 name: "LabelsPosition"
1625 name: "LabelsPosition"
1617 values: {
1626 values: {
1618 "LabelsCenter": 0,
1627 "LabelsCenter": 0,
1619 "LabelsInsideEnd": 1,
1628 "LabelsInsideEnd": 1,
1620 "LabelsInsideBase": 2,
1629 "LabelsInsideBase": 2,
1621 "LabelsOutsideEnd": 3
1630 "LabelsOutsideEnd": 3
1622 }
1631 }
1623 }
1632 }
1624 Property { name: "barWidth"; type: "double" }
1633 Property { name: "barWidth"; type: "double" }
1625 Property { name: "count"; type: "int"; isReadonly: true }
1634 Property { name: "count"; type: "int"; isReadonly: true }
1626 Property { name: "labelsVisible"; type: "bool" }
1635 Property { name: "labelsVisible"; type: "bool" }
1627 Property { name: "labelsFormat"; type: "string" }
1636 Property { name: "labelsFormat"; type: "string" }
1628 Property { name: "labelsPosition"; type: "LabelsPosition" }
1637 Property { name: "labelsPosition"; type: "LabelsPosition" }
1629 Signal {
1638 Signal {
1630 name: "clicked"
1639 name: "clicked"
1631 Parameter { name: "index"; type: "int" }
1640 Parameter { name: "index"; type: "int" }
1632 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1641 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1633 }
1642 }
1634 Signal {
1643 Signal {
1635 name: "hovered"
1644 name: "hovered"
1636 Parameter { name: "status"; type: "bool" }
1645 Parameter { name: "status"; type: "bool" }
1637 Parameter { name: "index"; type: "int" }
1646 Parameter { name: "index"; type: "int" }
1638 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1647 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1639 }
1648 }
1640 Signal {
1649 Signal {
1641 name: "pressed"
1650 name: "pressed"
1642 Parameter { name: "index"; type: "int" }
1651 Parameter { name: "index"; type: "int" }
1643 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1652 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1644 }
1653 }
1645 Signal {
1654 Signal {
1646 name: "released"
1655 name: "released"
1647 Parameter { name: "index"; type: "int" }
1656 Parameter { name: "index"; type: "int" }
1648 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1657 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1649 }
1658 }
1650 Signal {
1659 Signal {
1651 name: "doubleClicked"
1660 name: "doubleClicked"
1652 Parameter { name: "index"; type: "int" }
1661 Parameter { name: "index"; type: "int" }
1653 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1662 Parameter { name: "barset"; type: "QBarSet"; isPointer: true }
1654 }
1663 }
1655 Signal {
1664 Signal {
1656 name: "labelsFormatChanged"
1665 name: "labelsFormatChanged"
1657 Parameter { name: "format"; type: "string" }
1666 Parameter { name: "format"; type: "string" }
1658 }
1667 }
1659 Signal {
1668 Signal {
1660 name: "labelsPositionChanged"
1669 name: "labelsPositionChanged"
1661 Parameter { name: "position"; type: "QAbstractBarSeries::LabelsPosition" }
1670 Parameter { name: "position"; type: "QAbstractBarSeries::LabelsPosition" }
1662 }
1671 }
1663 Signal {
1672 Signal {
1664 name: "barsetsAdded"
1673 name: "barsetsAdded"
1665 Parameter { name: "sets"; type: "QList<QBarSet*>" }
1674 Parameter { name: "sets"; type: "QList<QBarSet*>" }
1666 }
1675 }
1667 Signal {
1676 Signal {
1668 name: "barsetsRemoved"
1677 name: "barsetsRemoved"
1669 Parameter { name: "sets"; type: "QList<QBarSet*>" }
1678 Parameter { name: "sets"; type: "QList<QBarSet*>" }
1670 }
1679 }
1671 }
1680 }
1672 Component {
1681 Component {
1673 name: "QtCharts::QAbstractSeries"
1682 name: "QtCharts::QAbstractSeries"
1674 prototype: "QObject"
1683 prototype: "QObject"
1675 exports: [
1684 exports: [
1676 "QtCharts/AbstractSeries 1.0",
1685 "QtCharts/AbstractSeries 1.0",
1677 "QtCharts/AbstractSeries 2.0"
1686 "QtCharts/AbstractSeries 2.0"
1678 ]
1687 ]
1679 isCreatable: false
1688 isCreatable: false
1680 exportMetaObjectRevisions: [0, 0]
1689 exportMetaObjectRevisions: [0, 0]
1681 Enum {
1690 Enum {
1682 name: "SeriesType"
1691 name: "SeriesType"
1683 values: {
1692 values: {
1684 "SeriesTypeLine": 0,
1693 "SeriesTypeLine": 0,
1685 "SeriesTypeArea": 1,
1694 "SeriesTypeArea": 1,
1686 "SeriesTypeBar": 2,
1695 "SeriesTypeBar": 2,
1687 "SeriesTypeStackedBar": 3,
1696 "SeriesTypeStackedBar": 3,
1688 "SeriesTypePercentBar": 4,
1697 "SeriesTypePercentBar": 4,
1689 "SeriesTypePie": 5,
1698 "SeriesTypePie": 5,
1690 "SeriesTypeScatter": 6,
1699 "SeriesTypeScatter": 6,
1691 "SeriesTypeSpline": 7,
1700 "SeriesTypeSpline": 7,
1692 "SeriesTypeHorizontalBar": 8,
1701 "SeriesTypeHorizontalBar": 8,
1693 "SeriesTypeHorizontalStackedBar": 9,
1702 "SeriesTypeHorizontalStackedBar": 9,
1694 "SeriesTypeHorizontalPercentBar": 10,
1703 "SeriesTypeHorizontalPercentBar": 10,
1695 "SeriesTypeBoxPlot": 11
1704 "SeriesTypeBoxPlot": 11
1696 }
1705 }
1697 }
1706 }
1698 Property { name: "name"; type: "string" }
1707 Property { name: "name"; type: "string" }
1699 Property { name: "visible"; type: "bool" }
1708 Property { name: "visible"; type: "bool" }
1700 Property { name: "opacity"; type: "double" }
1709 Property { name: "opacity"; type: "double" }
1701 Property { name: "type"; type: "SeriesType"; isReadonly: true }
1710 Property { name: "type"; type: "SeriesType"; isReadonly: true }
1702 }
1711 }
1703 Component {
1712 Component {
1704 name: "QtCharts::QAreaSeries"
1713 name: "QtCharts::QAreaSeries"
1705 prototype: "QtCharts::QAbstractSeries"
1714 prototype: "QtCharts::QAbstractSeries"
1706 Property { name: "upperSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
1715 Property { name: "upperSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
1707 Property { name: "lowerSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
1716 Property { name: "lowerSeries"; type: "QLineSeries"; isReadonly: true; isPointer: true }
1708 Property { name: "color"; type: "QColor" }
1717 Property { name: "color"; type: "QColor" }
1709 Property { name: "borderColor"; type: "QColor" }
1718 Property { name: "borderColor"; type: "QColor" }
1710 Property { name: "pointLabelsFormat"; type: "string" }
1719 Property { name: "pointLabelsFormat"; type: "string" }
1711 Property { name: "pointLabelsVisible"; type: "bool" }
1720 Property { name: "pointLabelsVisible"; type: "bool" }
1712 Property { name: "pointLabelsFont"; type: "QFont" }
1721 Property { name: "pointLabelsFont"; type: "QFont" }
1713 Property { name: "pointLabelsColor"; type: "QColor" }
1722 Property { name: "pointLabelsColor"; type: "QColor" }
1714 Signal {
1723 Signal {
1715 name: "clicked"
1724 name: "clicked"
1716 Parameter { name: "point"; type: "QPointF" }
1725 Parameter { name: "point"; type: "QPointF" }
1717 }
1726 }
1718 Signal {
1727 Signal {
1719 name: "hovered"
1728 name: "hovered"
1720 Parameter { name: "point"; type: "QPointF" }
1729 Parameter { name: "point"; type: "QPointF" }
1721 Parameter { name: "state"; type: "bool" }
1730 Parameter { name: "state"; type: "bool" }
1722 }
1731 }
1723 Signal {
1732 Signal {
1724 name: "pressed"
1733 name: "pressed"
1725 Parameter { name: "point"; type: "QPointF" }
1734 Parameter { name: "point"; type: "QPointF" }
1726 }
1735 }
1727 Signal {
1736 Signal {
1728 name: "released"
1737 name: "released"
1729 Parameter { name: "point"; type: "QPointF" }
1738 Parameter { name: "point"; type: "QPointF" }
1730 }
1739 }
1731 Signal {
1740 Signal {
1732 name: "doubleClicked"
1741 name: "doubleClicked"
1733 Parameter { name: "point"; type: "QPointF" }
1742 Parameter { name: "point"; type: "QPointF" }
1734 }
1743 }
1735 Signal { name: "selected" }
1744 Signal { name: "selected" }
1736 Signal {
1745 Signal {
1737 name: "colorChanged"
1746 name: "colorChanged"
1738 Parameter { name: "color"; type: "QColor" }
1747 Parameter { name: "color"; type: "QColor" }
1739 }
1748 }
1740 Signal {
1749 Signal {
1741 name: "borderColorChanged"
1750 name: "borderColorChanged"
1742 Parameter { name: "color"; type: "QColor" }
1751 Parameter { name: "color"; type: "QColor" }
1743 }
1752 }
1744 Signal {
1753 Signal {
1745 name: "pointLabelsFormatChanged"
1754 name: "pointLabelsFormatChanged"
1746 Parameter { name: "format"; type: "string" }
1755 Parameter { name: "format"; type: "string" }
1747 }
1756 }
1748 Signal {
1757 Signal {
1749 name: "pointLabelsVisibilityChanged"
1758 name: "pointLabelsVisibilityChanged"
1750 Parameter { name: "visible"; type: "bool" }
1759 Parameter { name: "visible"; type: "bool" }
1751 }
1760 }
1752 Signal {
1761 Signal {
1753 name: "pointLabelsFontChanged"
1762 name: "pointLabelsFontChanged"
1754 Parameter { name: "font"; type: "QFont" }
1763 Parameter { name: "font"; type: "QFont" }
1755 }
1764 }
1756 Signal {
1765 Signal {
1757 name: "pointLabelsColorChanged"
1766 name: "pointLabelsColorChanged"
1758 Parameter { name: "color"; type: "QColor" }
1767 Parameter { name: "color"; type: "QColor" }
1759 }
1768 }
1760 }
1769 }
1761 Component {
1770 Component {
1762 name: "QtCharts::QBarCategoryAxis"
1771 name: "QtCharts::QBarCategoryAxis"
1763 prototype: "QtCharts::QAbstractAxis"
1772 prototype: "QtCharts::QAbstractAxis"
1764 exports: [
1773 exports: [
1765 "QtCharts/BarCategoriesAxis 1.0",
1774 "QtCharts/BarCategoriesAxis 1.0",
1766 "QtCharts/BarCategoryAxis 1.1",
1775 "QtCharts/BarCategoryAxis 1.1",
1767 "QtCharts/BarCategoryAxis 2.0"
1776 "QtCharts/BarCategoryAxis 2.0"
1768 ]
1777 ]
1769 exportMetaObjectRevisions: [0, 0, 0]
1778 exportMetaObjectRevisions: [0, 0, 0]
1770 Property { name: "categories"; type: "QStringList" }
1779 Property { name: "categories"; type: "QStringList" }
1771 Property { name: "min"; type: "string" }
1780 Property { name: "min"; type: "string" }
1772 Property { name: "max"; type: "string" }
1781 Property { name: "max"; type: "string" }
1773 Property { name: "count"; type: "int"; isReadonly: true }
1782 Property { name: "count"; type: "int"; isReadonly: true }
1774 Signal {
1783 Signal {
1775 name: "minChanged"
1784 name: "minChanged"
1776 Parameter { name: "min"; type: "string" }
1785 Parameter { name: "min"; type: "string" }
1777 }
1786 }
1778 Signal {
1787 Signal {
1779 name: "maxChanged"
1788 name: "maxChanged"
1780 Parameter { name: "max"; type: "string" }
1789 Parameter { name: "max"; type: "string" }
1781 }
1790 }
1782 Signal {
1791 Signal {
1783 name: "rangeChanged"
1792 name: "rangeChanged"
1784 Parameter { name: "min"; type: "string" }
1793 Parameter { name: "min"; type: "string" }
1785 Parameter { name: "max"; type: "string" }
1794 Parameter { name: "max"; type: "string" }
1786 }
1795 }
1787 Method { name: "clear" }
1796 Method { name: "clear" }
1788 }
1797 }
1789 Component {
1798 Component {
1790 name: "QtCharts::QBarModelMapper"
1799 name: "QtCharts::QBarModelMapper"
1791 prototype: "QObject"
1800 prototype: "QObject"
1792 exports: [
1801 exports: [
1793 "QtCharts/BarModelMapper 1.0",
1802 "QtCharts/BarModelMapper 1.0",
1794 "QtCharts/BarModelMapper 2.0"
1803 "QtCharts/BarModelMapper 2.0"
1795 ]
1804 ]
1796 isCreatable: false
1805 isCreatable: false
1797 exportMetaObjectRevisions: [0, 0]
1806 exportMetaObjectRevisions: [0, 0]
1798 }
1807 }
1799 Component { name: "QtCharts::QBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
1808 Component { name: "QtCharts::QBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
1800 Component {
1809 Component {
1801 name: "QtCharts::QBarSet"
1810 name: "QtCharts::QBarSet"
1802 prototype: "QObject"
1811 prototype: "QObject"
1803 exports: ["QtCharts/BarSetBase 1.0", "QtCharts/BarSetBase 2.0"]
1812 exports: ["QtCharts/BarSetBase 1.0", "QtCharts/BarSetBase 2.0"]
1804 isCreatable: false
1813 isCreatable: false
1805 exportMetaObjectRevisions: [0, 0]
1814 exportMetaObjectRevisions: [0, 0]
1806 Property { name: "label"; type: "string" }
1815 Property { name: "label"; type: "string" }
1807 Property { name: "pen"; type: "QPen" }
1816 Property { name: "pen"; type: "QPen" }
1808 Property { name: "brush"; type: "QBrush" }
1817 Property { name: "brush"; type: "QBrush" }
1809 Property { name: "labelBrush"; type: "QBrush" }
1818 Property { name: "labelBrush"; type: "QBrush" }
1810 Property { name: "labelFont"; type: "QFont" }
1819 Property { name: "labelFont"; type: "QFont" }
1811 Property { name: "color"; type: "QColor" }
1820 Property { name: "color"; type: "QColor" }
1812 Property { name: "borderColor"; type: "QColor" }
1821 Property { name: "borderColor"; type: "QColor" }
1813 Property { name: "labelColor"; type: "QColor" }
1822 Property { name: "labelColor"; type: "QColor" }
1814 Signal {
1823 Signal {
1815 name: "clicked"
1824 name: "clicked"
1816 Parameter { name: "index"; type: "int" }
1825 Parameter { name: "index"; type: "int" }
1817 }
1826 }
1818 Signal {
1827 Signal {
1819 name: "hovered"
1828 name: "hovered"
1820 Parameter { name: "status"; type: "bool" }
1829 Parameter { name: "status"; type: "bool" }
1821 Parameter { name: "index"; type: "int" }
1830 Parameter { name: "index"; type: "int" }
1822 }
1831 }
1823 Signal {
1832 Signal {
1824 name: "pressed"
1833 name: "pressed"
1825 Parameter { name: "index"; type: "int" }
1834 Parameter { name: "index"; type: "int" }
1826 }
1835 }
1827 Signal {
1836 Signal {
1828 name: "released"
1837 name: "released"
1829 Parameter { name: "index"; type: "int" }
1838 Parameter { name: "index"; type: "int" }
1830 }
1839 }
1831 Signal {
1840 Signal {
1832 name: "doubleClicked"
1841 name: "doubleClicked"
1833 Parameter { name: "index"; type: "int" }
1842 Parameter { name: "index"; type: "int" }
1834 }
1843 }
1835 Signal {
1844 Signal {
1836 name: "colorChanged"
1845 name: "colorChanged"
1837 Parameter { name: "color"; type: "QColor" }
1846 Parameter { name: "color"; type: "QColor" }
1838 }
1847 }
1839 Signal {
1848 Signal {
1840 name: "borderColorChanged"
1849 name: "borderColorChanged"
1841 Parameter { name: "color"; type: "QColor" }
1850 Parameter { name: "color"; type: "QColor" }
1842 }
1851 }
1843 Signal {
1852 Signal {
1844 name: "labelColorChanged"
1853 name: "labelColorChanged"
1845 Parameter { name: "color"; type: "QColor" }
1854 Parameter { name: "color"; type: "QColor" }
1846 }
1855 }
1847 Signal {
1856 Signal {
1848 name: "valuesAdded"
1857 name: "valuesAdded"
1849 Parameter { name: "index"; type: "int" }
1858 Parameter { name: "index"; type: "int" }
1850 Parameter { name: "count"; type: "int" }
1859 Parameter { name: "count"; type: "int" }
1851 }
1860 }
1852 Signal {
1861 Signal {
1853 name: "valuesRemoved"
1862 name: "valuesRemoved"
1854 Parameter { name: "index"; type: "int" }
1863 Parameter { name: "index"; type: "int" }
1855 Parameter { name: "count"; type: "int" }
1864 Parameter { name: "count"; type: "int" }
1856 }
1865 }
1857 Signal {
1866 Signal {
1858 name: "valueChanged"
1867 name: "valueChanged"
1859 Parameter { name: "index"; type: "int" }
1868 Parameter { name: "index"; type: "int" }
1860 }
1869 }
1861 }
1870 }
1862 Component {
1871 Component {
1863 name: "QtCharts::QBoxPlotModelMapper"
1872 name: "QtCharts::QBoxPlotModelMapper"
1864 prototype: "QObject"
1873 prototype: "QObject"
1865 exports: ["QtCharts/BoxPlotModelMapper 2.0"]
1874 exports: ["QtCharts/BoxPlotModelMapper 2.0"]
1866 isCreatable: false
1875 isCreatable: false
1867 exportMetaObjectRevisions: [0]
1876 exportMetaObjectRevisions: [0]
1868 }
1877 }
1869 Component {
1878 Component {
1870 name: "QtCharts::QBoxPlotSeries"
1879 name: "QtCharts::QBoxPlotSeries"
1871 prototype: "QtCharts::QAbstractSeries"
1880 prototype: "QtCharts::QAbstractSeries"
1872 Property { name: "boxOutlineVisible"; type: "bool" }
1881 Property { name: "boxOutlineVisible"; type: "bool" }
1873 Property { name: "boxWidth"; type: "double" }
1882 Property { name: "boxWidth"; type: "double" }
1874 Property { name: "pen"; type: "QPen" }
1883 Property { name: "pen"; type: "QPen" }
1875 Property { name: "brush"; type: "QBrush" }
1884 Property { name: "brush"; type: "QBrush" }
1876 Property { name: "count"; revision: 1; type: "int"; isReadonly: true }
1885 Property { name: "count"; revision: 1; type: "int"; isReadonly: true }
1877 Signal {
1886 Signal {
1878 name: "clicked"
1887 name: "clicked"
1879 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1888 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1880 }
1889 }
1881 Signal {
1890 Signal {
1882 name: "hovered"
1891 name: "hovered"
1883 Parameter { name: "status"; type: "bool" }
1892 Parameter { name: "status"; type: "bool" }
1884 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1893 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1885 }
1894 }
1886 Signal {
1895 Signal {
1887 name: "pressed"
1896 name: "pressed"
1888 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1897 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1889 }
1898 }
1890 Signal {
1899 Signal {
1891 name: "released"
1900 name: "released"
1892 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1901 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1893 }
1902 }
1894 Signal {
1903 Signal {
1895 name: "doubleClicked"
1904 name: "doubleClicked"
1896 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1905 Parameter { name: "boxset"; type: "QBoxSet"; isPointer: true }
1897 }
1906 }
1898 Signal { name: "boxOutlineVisibilityChanged" }
1907 Signal { name: "boxOutlineVisibilityChanged" }
1899 Signal {
1908 Signal {
1900 name: "boxsetsAdded"
1909 name: "boxsetsAdded"
1901 Parameter { name: "sets"; type: "QList<QBoxSet*>" }
1910 Parameter { name: "sets"; type: "QList<QBoxSet*>" }
1902 }
1911 }
1903 Signal {
1912 Signal {
1904 name: "boxsetsRemoved"
1913 name: "boxsetsRemoved"
1905 Parameter { name: "sets"; type: "QList<QBoxSet*>" }
1914 Parameter { name: "sets"; type: "QList<QBoxSet*>" }
1906 }
1915 }
1907 }
1916 }
1908 Component {
1917 Component {
1909 name: "QtCharts::QBoxSet"
1918 name: "QtCharts::QBoxSet"
1910 prototype: "QObject"
1919 prototype: "QObject"
1911 Property { name: "pen"; type: "QPen" }
1920 Property { name: "pen"; type: "QPen" }
1912 Property { name: "brush"; type: "QBrush" }
1921 Property { name: "brush"; type: "QBrush" }
1913 Signal { name: "clicked" }
1922 Signal { name: "clicked" }
1914 Signal {
1923 Signal {
1915 name: "hovered"
1924 name: "hovered"
1916 Parameter { name: "status"; type: "bool" }
1925 Parameter { name: "status"; type: "bool" }
1917 }
1926 }
1918 Signal { name: "pressed" }
1927 Signal { name: "pressed" }
1919 Signal { name: "released" }
1928 Signal { name: "released" }
1920 Signal { name: "doubleClicked" }
1929 Signal { name: "doubleClicked" }
1921 Signal { name: "valuesChanged" }
1930 Signal { name: "valuesChanged" }
1922 Signal {
1931 Signal {
1923 name: "valueChanged"
1932 name: "valueChanged"
1924 Parameter { name: "index"; type: "int" }
1933 Parameter { name: "index"; type: "int" }
1925 }
1934 }
1926 Signal { name: "cleared" }
1935 Signal { name: "cleared" }
1927 }
1936 }
1928 Component {
1937 Component {
1929 name: "QtCharts::QCategoryAxis"
1938 name: "QtCharts::QCategoryAxis"
1930 prototype: "QtCharts::QValueAxis"
1939 prototype: "QtCharts::QValueAxis"
1931 Enum {
1940 Enum {
1932 name: "AxisLabelsPosition"
1941 name: "AxisLabelsPosition"
1933 values: {
1942 values: {
1934 "AxisLabelsPositionCenter": 0,
1943 "AxisLabelsPositionCenter": 0,
1935 "AxisLabelsPositionOnValue": 1
1944 "AxisLabelsPositionOnValue": 1
1936 }
1945 }
1937 }
1946 }
1938 Property { name: "startValue"; type: "double" }
1947 Property { name: "startValue"; type: "double" }
1939 Property { name: "count"; type: "int"; isReadonly: true }
1948 Property { name: "count"; type: "int"; isReadonly: true }
1940 Property { name: "categoriesLabels"; type: "QStringList"; isReadonly: true }
1949 Property { name: "categoriesLabels"; type: "QStringList"; isReadonly: true }
1941 Property { name: "labelsPosition"; type: "AxisLabelsPosition" }
1950 Property { name: "labelsPosition"; type: "AxisLabelsPosition" }
1942 Signal { name: "categoriesChanged" }
1951 Signal { name: "categoriesChanged" }
1943 Signal {
1952 Signal {
1944 name: "labelsPositionChanged"
1953 name: "labelsPositionChanged"
1945 Parameter { name: "position"; type: "QCategoryAxis::AxisLabelsPosition" }
1954 Parameter { name: "position"; type: "QCategoryAxis::AxisLabelsPosition" }
1946 }
1955 }
1947 }
1956 }
1948 Component {
1957 Component {
1949 name: "QtCharts::QDateTimeAxis"
1958 name: "QtCharts::QDateTimeAxis"
1950 prototype: "QtCharts::QAbstractAxis"
1959 prototype: "QtCharts::QAbstractAxis"
1951 exports: ["QtCharts/DateTimeAxis 1.1", "QtCharts/DateTimeAxis 2.0"]
1960 exports: ["QtCharts/DateTimeAxis 1.1", "QtCharts/DateTimeAxis 2.0"]
1952 exportMetaObjectRevisions: [0, 0]
1961 exportMetaObjectRevisions: [0, 0]
1953 Property { name: "tickCount"; type: "int" }
1962 Property { name: "tickCount"; type: "int" }
1954 Property { name: "min"; type: "QDateTime" }
1963 Property { name: "min"; type: "QDateTime" }
1955 Property { name: "max"; type: "QDateTime" }
1964 Property { name: "max"; type: "QDateTime" }
1956 Property { name: "format"; type: "string" }
1965 Property { name: "format"; type: "string" }
1957 Signal {
1966 Signal {
1958 name: "minChanged"
1967 name: "minChanged"
1959 Parameter { name: "min"; type: "QDateTime" }
1968 Parameter { name: "min"; type: "QDateTime" }
1960 }
1969 }
1961 Signal {
1970 Signal {
1962 name: "maxChanged"
1971 name: "maxChanged"
1963 Parameter { name: "max"; type: "QDateTime" }
1972 Parameter { name: "max"; type: "QDateTime" }
1964 }
1973 }
1965 Signal {
1974 Signal {
1966 name: "rangeChanged"
1975 name: "rangeChanged"
1967 Parameter { name: "min"; type: "QDateTime" }
1976 Parameter { name: "min"; type: "QDateTime" }
1968 Parameter { name: "max"; type: "QDateTime" }
1977 Parameter { name: "max"; type: "QDateTime" }
1969 }
1978 }
1970 Signal {
1979 Signal {
1971 name: "formatChanged"
1980 name: "formatChanged"
1972 Parameter { name: "format"; type: "string" }
1981 Parameter { name: "format"; type: "string" }
1973 }
1982 }
1974 Signal {
1983 Signal {
1975 name: "tickCountChanged"
1984 name: "tickCountChanged"
1976 Parameter { name: "tick"; type: "int" }
1985 Parameter { name: "tick"; type: "int" }
1977 }
1986 }
1978 }
1987 }
1979 Component {
1988 Component {
1980 name: "QtCharts::QHBarModelMapper"
1989 name: "QtCharts::QHBarModelMapper"
1981 prototype: "QtCharts::QBarModelMapper"
1990 prototype: "QtCharts::QBarModelMapper"
1982 exports: [
1991 exports: [
1983 "QtCharts/HBarModelMapper 1.0",
1992 "QtCharts/HBarModelMapper 1.0",
1984 "QtCharts/HBarModelMapper 2.0"
1993 "QtCharts/HBarModelMapper 2.0"
1985 ]
1994 ]
1986 exportMetaObjectRevisions: [0, 0]
1995 exportMetaObjectRevisions: [0, 0]
1987 Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
1996 Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
1988 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
1997 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
1989 Property { name: "firstBarSetRow"; type: "int" }
1998 Property { name: "firstBarSetRow"; type: "int" }
1990 Property { name: "lastBarSetRow"; type: "int" }
1999 Property { name: "lastBarSetRow"; type: "int" }
1991 Property { name: "firstColumn"; type: "int" }
2000 Property { name: "firstColumn"; type: "int" }
1992 Property { name: "columnCount"; type: "int" }
2001 Property { name: "columnCount"; type: "int" }
1993 Signal { name: "seriesReplaced" }
2002 Signal { name: "seriesReplaced" }
1994 Signal { name: "modelReplaced" }
2003 Signal { name: "modelReplaced" }
1995 }
2004 }
1996 Component {
2005 Component {
1997 name: "QtCharts::QHPieModelMapper"
2006 name: "QtCharts::QHPieModelMapper"
1998 prototype: "QtCharts::QPieModelMapper"
2007 prototype: "QtCharts::QPieModelMapper"
1999 exports: [
2008 exports: [
2000 "QtCharts/HPieModelMapper 1.0",
2009 "QtCharts/HPieModelMapper 1.0",
2001 "QtCharts/HPieModelMapper 2.0"
2010 "QtCharts/HPieModelMapper 2.0"
2002 ]
2011 ]
2003 exportMetaObjectRevisions: [0, 0]
2012 exportMetaObjectRevisions: [0, 0]
2004 Property { name: "series"; type: "QPieSeries"; isPointer: true }
2013 Property { name: "series"; type: "QPieSeries"; isPointer: true }
2005 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2014 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2006 Property { name: "valuesRow"; type: "int" }
2015 Property { name: "valuesRow"; type: "int" }
2007 Property { name: "labelsRow"; type: "int" }
2016 Property { name: "labelsRow"; type: "int" }
2008 Property { name: "firstColumn"; type: "int" }
2017 Property { name: "firstColumn"; type: "int" }
2009 Property { name: "columnCount"; type: "int" }
2018 Property { name: "columnCount"; type: "int" }
2010 Signal { name: "seriesReplaced" }
2019 Signal { name: "seriesReplaced" }
2011 Signal { name: "modelReplaced" }
2020 Signal { name: "modelReplaced" }
2012 }
2021 }
2013 Component {
2022 Component {
2014 name: "QtCharts::QHXYModelMapper"
2023 name: "QtCharts::QHXYModelMapper"
2015 prototype: "QtCharts::QXYModelMapper"
2024 prototype: "QtCharts::QXYModelMapper"
2016 exports: [
2025 exports: [
2017 "QtCharts/HXYModelMapper 1.0",
2026 "QtCharts/HXYModelMapper 1.0",
2018 "QtCharts/HXYModelMapper 2.0"
2027 "QtCharts/HXYModelMapper 2.0"
2019 ]
2028 ]
2020 exportMetaObjectRevisions: [0, 0]
2029 exportMetaObjectRevisions: [0, 0]
2021 Property { name: "series"; type: "QXYSeries"; isPointer: true }
2030 Property { name: "series"; type: "QXYSeries"; isPointer: true }
2022 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2031 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2023 Property { name: "xRow"; type: "int" }
2032 Property { name: "xRow"; type: "int" }
2024 Property { name: "yRow"; type: "int" }
2033 Property { name: "yRow"; type: "int" }
2025 Property { name: "firstColumn"; type: "int" }
2034 Property { name: "firstColumn"; type: "int" }
2026 Property { name: "columnCount"; type: "int" }
2035 Property { name: "columnCount"; type: "int" }
2027 Signal { name: "seriesReplaced" }
2036 Signal { name: "seriesReplaced" }
2028 Signal { name: "modelReplaced" }
2037 Signal { name: "modelReplaced" }
2029 }
2038 }
2030 Component { name: "QtCharts::QHorizontalBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
2039 Component { name: "QtCharts::QHorizontalBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
2031 Component {
2040 Component {
2032 name: "QtCharts::QHorizontalPercentBarSeries"
2041 name: "QtCharts::QHorizontalPercentBarSeries"
2033 prototype: "QtCharts::QAbstractBarSeries"
2042 prototype: "QtCharts::QAbstractBarSeries"
2034 }
2043 }
2035 Component {
2044 Component {
2036 name: "QtCharts::QHorizontalStackedBarSeries"
2045 name: "QtCharts::QHorizontalStackedBarSeries"
2037 prototype: "QtCharts::QAbstractBarSeries"
2046 prototype: "QtCharts::QAbstractBarSeries"
2038 }
2047 }
2039 Component {
2048 Component {
2040 name: "QtCharts::QLegend"
2049 name: "QtCharts::QLegend"
2041 defaultProperty: "children"
2050 defaultProperty: "children"
2042 prototype: "QGraphicsWidget"
2051 prototype: "QGraphicsWidget"
2043 exports: ["QtCharts/Legend 1.0", "QtCharts/Legend 2.0"]
2052 exports: ["QtCharts/Legend 1.0", "QtCharts/Legend 2.0"]
2044 isCreatable: false
2053 isCreatable: false
2045 exportMetaObjectRevisions: [0, 0]
2054 exportMetaObjectRevisions: [0, 0]
2046 Property { name: "alignment"; type: "Qt::Alignment" }
2055 Property { name: "alignment"; type: "Qt::Alignment" }
2047 Property { name: "backgroundVisible"; type: "bool" }
2056 Property { name: "backgroundVisible"; type: "bool" }
2048 Property { name: "color"; type: "QColor" }
2057 Property { name: "color"; type: "QColor" }
2049 Property { name: "borderColor"; type: "QColor" }
2058 Property { name: "borderColor"; type: "QColor" }
2050 Property { name: "font"; type: "QFont" }
2059 Property { name: "font"; type: "QFont" }
2051 Property { name: "labelColor"; type: "QColor" }
2060 Property { name: "labelColor"; type: "QColor" }
2052 Property { name: "reverseMarkers"; type: "bool" }
2061 Property { name: "reverseMarkers"; type: "bool" }
2053 Signal {
2062 Signal {
2054 name: "backgroundVisibleChanged"
2063 name: "backgroundVisibleChanged"
2055 Parameter { name: "visible"; type: "bool" }
2064 Parameter { name: "visible"; type: "bool" }
2056 }
2065 }
2057 Signal {
2066 Signal {
2058 name: "colorChanged"
2067 name: "colorChanged"
2059 Parameter { name: "color"; type: "QColor" }
2068 Parameter { name: "color"; type: "QColor" }
2060 }
2069 }
2061 Signal {
2070 Signal {
2062 name: "borderColorChanged"
2071 name: "borderColorChanged"
2063 Parameter { name: "color"; type: "QColor" }
2072 Parameter { name: "color"; type: "QColor" }
2064 }
2073 }
2065 Signal {
2074 Signal {
2066 name: "fontChanged"
2075 name: "fontChanged"
2067 Parameter { name: "font"; type: "QFont" }
2076 Parameter { name: "font"; type: "QFont" }
2068 }
2077 }
2069 Signal {
2078 Signal {
2070 name: "labelColorChanged"
2079 name: "labelColorChanged"
2071 Parameter { name: "color"; type: "QColor" }
2080 Parameter { name: "color"; type: "QColor" }
2072 }
2081 }
2073 Signal {
2082 Signal {
2074 name: "reverseMarkersChanged"
2083 name: "reverseMarkersChanged"
2075 Parameter { name: "reverseMarkers"; type: "bool" }
2084 Parameter { name: "reverseMarkers"; type: "bool" }
2076 }
2085 }
2077 }
2086 }
2078 Component { name: "QtCharts::QLineSeries"; prototype: "QtCharts::QXYSeries" }
2087 Component { name: "QtCharts::QLineSeries"; prototype: "QtCharts::QXYSeries" }
2079 Component {
2088 Component {
2080 name: "QtCharts::QLogValueAxis"
2089 name: "QtCharts::QLogValueAxis"
2081 prototype: "QtCharts::QAbstractAxis"
2090 prototype: "QtCharts::QAbstractAxis"
2082 exports: ["QtCharts/LogValueAxis 1.3", "QtCharts/LogValueAxis 2.0"]
2091 exports: ["QtCharts/LogValueAxis 1.3", "QtCharts/LogValueAxis 2.0"]
2083 exportMetaObjectRevisions: [0, 1]
2092 exportMetaObjectRevisions: [0, 1]
2084 Property { name: "min"; type: "double" }
2093 Property { name: "min"; type: "double" }
2085 Property { name: "max"; type: "double" }
2094 Property { name: "max"; type: "double" }
2086 Property { name: "labelFormat"; type: "string" }
2095 Property { name: "labelFormat"; type: "string" }
2087 Property { name: "base"; type: "double" }
2096 Property { name: "base"; type: "double" }
2088 Signal {
2097 Signal {
2089 name: "minChanged"
2098 name: "minChanged"
2090 Parameter { name: "min"; type: "double" }
2099 Parameter { name: "min"; type: "double" }
2091 }
2100 }
2092 Signal {
2101 Signal {
2093 name: "maxChanged"
2102 name: "maxChanged"
2094 Parameter { name: "max"; type: "double" }
2103 Parameter { name: "max"; type: "double" }
2095 }
2104 }
2096 Signal {
2105 Signal {
2097 name: "rangeChanged"
2106 name: "rangeChanged"
2098 Parameter { name: "min"; type: "double" }
2107 Parameter { name: "min"; type: "double" }
2099 Parameter { name: "max"; type: "double" }
2108 Parameter { name: "max"; type: "double" }
2100 }
2109 }
2101 Signal {
2110 Signal {
2102 name: "labelFormatChanged"
2111 name: "labelFormatChanged"
2103 Parameter { name: "format"; type: "string" }
2112 Parameter { name: "format"; type: "string" }
2104 }
2113 }
2105 Signal {
2114 Signal {
2106 name: "baseChanged"
2115 name: "baseChanged"
2107 Parameter { name: "base"; type: "double" }
2116 Parameter { name: "base"; type: "double" }
2108 }
2117 }
2109 }
2118 }
2110 Component { name: "QtCharts::QPercentBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
2119 Component { name: "QtCharts::QPercentBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
2111 Component {
2120 Component {
2112 name: "QtCharts::QPieModelMapper"
2121 name: "QtCharts::QPieModelMapper"
2113 prototype: "QObject"
2122 prototype: "QObject"
2114 exports: [
2123 exports: [
2115 "QtCharts/PieModelMapper 1.0",
2124 "QtCharts/PieModelMapper 1.0",
2116 "QtCharts/PieModelMapper 2.0"
2125 "QtCharts/PieModelMapper 2.0"
2117 ]
2126 ]
2118 isCreatable: false
2127 isCreatable: false
2119 exportMetaObjectRevisions: [0, 0]
2128 exportMetaObjectRevisions: [0, 0]
2120 }
2129 }
2121 Component {
2130 Component {
2122 name: "QtCharts::QPieSeries"
2131 name: "QtCharts::QPieSeries"
2123 prototype: "QtCharts::QAbstractSeries"
2132 prototype: "QtCharts::QAbstractSeries"
2124 exports: ["QtCharts/QPieSeries 1.0", "QtCharts/QPieSeries 2.0"]
2133 exports: ["QtCharts/QPieSeries 1.0", "QtCharts/QPieSeries 2.0"]
2125 isCreatable: false
2134 isCreatable: false
2126 exportMetaObjectRevisions: [0, 0]
2135 exportMetaObjectRevisions: [0, 0]
2127 Property { name: "horizontalPosition"; type: "double" }
2136 Property { name: "horizontalPosition"; type: "double" }
2128 Property { name: "verticalPosition"; type: "double" }
2137 Property { name: "verticalPosition"; type: "double" }
2129 Property { name: "size"; type: "double" }
2138 Property { name: "size"; type: "double" }
2130 Property { name: "startAngle"; type: "double" }
2139 Property { name: "startAngle"; type: "double" }
2131 Property { name: "endAngle"; type: "double" }
2140 Property { name: "endAngle"; type: "double" }
2132 Property { name: "count"; type: "int"; isReadonly: true }
2141 Property { name: "count"; type: "int"; isReadonly: true }
2133 Property { name: "sum"; type: "double"; isReadonly: true }
2142 Property { name: "sum"; type: "double"; isReadonly: true }
2134 Property { name: "holeSize"; type: "double" }
2143 Property { name: "holeSize"; type: "double" }
2135 Signal {
2144 Signal {
2136 name: "added"
2145 name: "added"
2137 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
2146 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
2138 }
2147 }
2139 Signal {
2148 Signal {
2140 name: "removed"
2149 name: "removed"
2141 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
2150 Parameter { name: "slices"; type: "QList<QPieSlice*>" }
2142 }
2151 }
2143 Signal {
2152 Signal {
2144 name: "clicked"
2153 name: "clicked"
2145 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2154 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2146 }
2155 }
2147 Signal {
2156 Signal {
2148 name: "hovered"
2157 name: "hovered"
2149 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2158 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2150 Parameter { name: "state"; type: "bool" }
2159 Parameter { name: "state"; type: "bool" }
2151 }
2160 }
2152 Signal {
2161 Signal {
2153 name: "pressed"
2162 name: "pressed"
2154 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2163 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2155 }
2164 }
2156 Signal {
2165 Signal {
2157 name: "released"
2166 name: "released"
2158 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2167 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2159 }
2168 }
2160 Signal {
2169 Signal {
2161 name: "doubleClicked"
2170 name: "doubleClicked"
2162 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2171 Parameter { name: "slice"; type: "QPieSlice"; isPointer: true }
2163 }
2172 }
2164 }
2173 }
2165 Component {
2174 Component {
2166 name: "QtCharts::QPieSlice"
2175 name: "QtCharts::QPieSlice"
2167 prototype: "QObject"
2176 prototype: "QObject"
2168 exports: ["QtCharts/PieSlice 1.0", "QtCharts/PieSlice 2.0"]
2177 exports: ["QtCharts/PieSlice 1.0", "QtCharts/PieSlice 2.0"]
2169 exportMetaObjectRevisions: [0, 0]
2178 exportMetaObjectRevisions: [0, 0]
2170 Enum {
2179 Enum {
2171 name: "LabelPosition"
2180 name: "LabelPosition"
2172 values: {
2181 values: {
2173 "LabelOutside": 0,
2182 "LabelOutside": 0,
2174 "LabelInsideHorizontal": 1,
2183 "LabelInsideHorizontal": 1,
2175 "LabelInsideTangential": 2,
2184 "LabelInsideTangential": 2,
2176 "LabelInsideNormal": 3
2185 "LabelInsideNormal": 3
2177 }
2186 }
2178 }
2187 }
2179 Property { name: "label"; type: "string" }
2188 Property { name: "label"; type: "string" }
2180 Property { name: "value"; type: "double" }
2189 Property { name: "value"; type: "double" }
2181 Property { name: "labelVisible"; type: "bool" }
2190 Property { name: "labelVisible"; type: "bool" }
2182 Property { name: "labelPosition"; type: "LabelPosition" }
2191 Property { name: "labelPosition"; type: "LabelPosition" }
2183 Property { name: "exploded"; type: "bool" }
2192 Property { name: "exploded"; type: "bool" }
2184 Property { name: "pen"; type: "QPen" }
2193 Property { name: "pen"; type: "QPen" }
2185 Property { name: "borderColor"; type: "QColor" }
2194 Property { name: "borderColor"; type: "QColor" }
2186 Property { name: "borderWidth"; type: "int" }
2195 Property { name: "borderWidth"; type: "int" }
2187 Property { name: "brush"; type: "QBrush" }
2196 Property { name: "brush"; type: "QBrush" }
2188 Property { name: "color"; type: "QColor" }
2197 Property { name: "color"; type: "QColor" }
2189 Property { name: "labelBrush"; type: "QBrush" }
2198 Property { name: "labelBrush"; type: "QBrush" }
2190 Property { name: "labelColor"; type: "QColor" }
2199 Property { name: "labelColor"; type: "QColor" }
2191 Property { name: "labelFont"; type: "QFont" }
2200 Property { name: "labelFont"; type: "QFont" }
2192 Property { name: "labelArmLengthFactor"; type: "double" }
2201 Property { name: "labelArmLengthFactor"; type: "double" }
2193 Property { name: "explodeDistanceFactor"; type: "double" }
2202 Property { name: "explodeDistanceFactor"; type: "double" }
2194 Property { name: "percentage"; type: "double"; isReadonly: true }
2203 Property { name: "percentage"; type: "double"; isReadonly: true }
2195 Property { name: "startAngle"; type: "double"; isReadonly: true }
2204 Property { name: "startAngle"; type: "double"; isReadonly: true }
2196 Property { name: "angleSpan"; type: "double"; isReadonly: true }
2205 Property { name: "angleSpan"; type: "double"; isReadonly: true }
2197 Signal { name: "clicked" }
2206 Signal { name: "clicked" }
2198 Signal {
2207 Signal {
2199 name: "hovered"
2208 name: "hovered"
2200 Parameter { name: "state"; type: "bool" }
2209 Parameter { name: "state"; type: "bool" }
2201 }
2210 }
2202 Signal { name: "pressed" }
2211 Signal { name: "pressed" }
2203 Signal { name: "released" }
2212 Signal { name: "released" }
2204 Signal { name: "doubleClicked" }
2213 Signal { name: "doubleClicked" }
2205 }
2214 }
2206 Component {
2215 Component {
2207 name: "QtCharts::QScatterSeries"
2216 name: "QtCharts::QScatterSeries"
2208 prototype: "QtCharts::QXYSeries"
2217 prototype: "QtCharts::QXYSeries"
2209 Enum {
2218 Enum {
2210 name: "MarkerShape"
2219 name: "MarkerShape"
2211 values: {
2220 values: {
2212 "MarkerShapeCircle": 0,
2221 "MarkerShapeCircle": 0,
2213 "MarkerShapeRectangle": 1
2222 "MarkerShapeRectangle": 1
2214 }
2223 }
2215 }
2224 }
2216 Property { name: "color"; type: "QColor" }
2225 Property { name: "color"; type: "QColor" }
2217 Property { name: "borderColor"; type: "QColor" }
2226 Property { name: "borderColor"; type: "QColor" }
2218 Property { name: "markerShape"; type: "MarkerShape" }
2227 Property { name: "markerShape"; type: "MarkerShape" }
2219 Property { name: "markerSize"; type: "double" }
2228 Property { name: "markerSize"; type: "double" }
2220 Property { name: "brush"; type: "QBrush" }
2229 Property { name: "brush"; type: "QBrush" }
2221 Signal {
2230 Signal {
2222 name: "colorChanged"
2231 name: "colorChanged"
2223 Parameter { name: "color"; type: "QColor" }
2232 Parameter { name: "color"; type: "QColor" }
2224 }
2233 }
2225 Signal {
2234 Signal {
2226 name: "borderColorChanged"
2235 name: "borderColorChanged"
2227 Parameter { name: "color"; type: "QColor" }
2236 Parameter { name: "color"; type: "QColor" }
2228 }
2237 }
2229 }
2238 }
2230 Component { name: "QtCharts::QSplineSeries"; prototype: "QtCharts::QLineSeries" }
2239 Component { name: "QtCharts::QSplineSeries"; prototype: "QtCharts::QLineSeries" }
2231 Component { name: "QtCharts::QStackedBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
2240 Component { name: "QtCharts::QStackedBarSeries"; prototype: "QtCharts::QAbstractBarSeries" }
2232 Component {
2241 Component {
2233 name: "QtCharts::QVBarModelMapper"
2242 name: "QtCharts::QVBarModelMapper"
2234 prototype: "QtCharts::QBarModelMapper"
2243 prototype: "QtCharts::QBarModelMapper"
2235 exports: [
2244 exports: [
2236 "QtCharts/VBarModelMapper 1.0",
2245 "QtCharts/VBarModelMapper 1.0",
2237 "QtCharts/VBarModelMapper 2.0"
2246 "QtCharts/VBarModelMapper 2.0"
2238 ]
2247 ]
2239 exportMetaObjectRevisions: [0, 0]
2248 exportMetaObjectRevisions: [0, 0]
2240 Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
2249 Property { name: "series"; type: "QAbstractBarSeries"; isPointer: true }
2241 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2250 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2242 Property { name: "firstBarSetColumn"; type: "int" }
2251 Property { name: "firstBarSetColumn"; type: "int" }
2243 Property { name: "lastBarSetColumn"; type: "int" }
2252 Property { name: "lastBarSetColumn"; type: "int" }
2244 Property { name: "firstRow"; type: "int" }
2253 Property { name: "firstRow"; type: "int" }
2245 Property { name: "rowCount"; type: "int" }
2254 Property { name: "rowCount"; type: "int" }
2246 Signal { name: "seriesReplaced" }
2255 Signal { name: "seriesReplaced" }
2247 Signal { name: "modelReplaced" }
2256 Signal { name: "modelReplaced" }
2248 }
2257 }
2249 Component {
2258 Component {
2250 name: "QtCharts::QVBoxPlotModelMapper"
2259 name: "QtCharts::QVBoxPlotModelMapper"
2251 prototype: "QtCharts::QBoxPlotModelMapper"
2260 prototype: "QtCharts::QBoxPlotModelMapper"
2252 exports: ["QtCharts/VBoxPlotModelMapper 2.0"]
2261 exports: ["QtCharts/VBoxPlotModelMapper 2.0"]
2253 exportMetaObjectRevisions: [0]
2262 exportMetaObjectRevisions: [0]
2254 Property { name: "series"; type: "QBoxPlotSeries"; isPointer: true }
2263 Property { name: "series"; type: "QBoxPlotSeries"; isPointer: true }
2255 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2264 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2256 Property { name: "firstBoxSetColumn"; type: "int" }
2265 Property { name: "firstBoxSetColumn"; type: "int" }
2257 Property { name: "lastBoxSetColumn"; type: "int" }
2266 Property { name: "lastBoxSetColumn"; type: "int" }
2258 Property { name: "firstRow"; type: "int" }
2267 Property { name: "firstRow"; type: "int" }
2259 Property { name: "rowCount"; type: "int" }
2268 Property { name: "rowCount"; type: "int" }
2260 Signal { name: "seriesReplaced" }
2269 Signal { name: "seriesReplaced" }
2261 Signal { name: "modelReplaced" }
2270 Signal { name: "modelReplaced" }
2262 }
2271 }
2263 Component {
2272 Component {
2264 name: "QtCharts::QVPieModelMapper"
2273 name: "QtCharts::QVPieModelMapper"
2265 prototype: "QtCharts::QPieModelMapper"
2274 prototype: "QtCharts::QPieModelMapper"
2266 exports: [
2275 exports: [
2267 "QtCharts/VPieModelMapper 1.0",
2276 "QtCharts/VPieModelMapper 1.0",
2268 "QtCharts/VPieModelMapper 2.0"
2277 "QtCharts/VPieModelMapper 2.0"
2269 ]
2278 ]
2270 exportMetaObjectRevisions: [0, 0]
2279 exportMetaObjectRevisions: [0, 0]
2271 Property { name: "series"; type: "QPieSeries"; isPointer: true }
2280 Property { name: "series"; type: "QPieSeries"; isPointer: true }
2272 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2281 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2273 Property { name: "valuesColumn"; type: "int" }
2282 Property { name: "valuesColumn"; type: "int" }
2274 Property { name: "labelsColumn"; type: "int" }
2283 Property { name: "labelsColumn"; type: "int" }
2275 Property { name: "firstRow"; type: "int" }
2284 Property { name: "firstRow"; type: "int" }
2276 Property { name: "rowCount"; type: "int" }
2285 Property { name: "rowCount"; type: "int" }
2277 Signal { name: "seriesReplaced" }
2286 Signal { name: "seriesReplaced" }
2278 Signal { name: "modelReplaced" }
2287 Signal { name: "modelReplaced" }
2279 }
2288 }
2280 Component {
2289 Component {
2281 name: "QtCharts::QVXYModelMapper"
2290 name: "QtCharts::QVXYModelMapper"
2282 prototype: "QtCharts::QXYModelMapper"
2291 prototype: "QtCharts::QXYModelMapper"
2283 exports: [
2292 exports: [
2284 "QtCharts/VXYModelMapper 1.0",
2293 "QtCharts/VXYModelMapper 1.0",
2285 "QtCharts/VXYModelMapper 2.0"
2294 "QtCharts/VXYModelMapper 2.0"
2286 ]
2295 ]
2287 exportMetaObjectRevisions: [0, 0]
2296 exportMetaObjectRevisions: [0, 0]
2288 Property { name: "series"; type: "QXYSeries"; isPointer: true }
2297 Property { name: "series"; type: "QXYSeries"; isPointer: true }
2289 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2298 Property { name: "model"; type: "QAbstractItemModel"; isPointer: true }
2290 Property { name: "xColumn"; type: "int" }
2299 Property { name: "xColumn"; type: "int" }
2291 Property { name: "yColumn"; type: "int" }
2300 Property { name: "yColumn"; type: "int" }
2292 Property { name: "firstRow"; type: "int" }
2301 Property { name: "firstRow"; type: "int" }
2293 Property { name: "rowCount"; type: "int" }
2302 Property { name: "rowCount"; type: "int" }
2294 Signal { name: "seriesReplaced" }
2303 Signal { name: "seriesReplaced" }
2295 Signal { name: "modelReplaced" }
2304 Signal { name: "modelReplaced" }
2296 }
2305 }
2297 Component {
2306 Component {
2298 name: "QtCharts::QValueAxis"
2307 name: "QtCharts::QValueAxis"
2299 prototype: "QtCharts::QAbstractAxis"
2308 prototype: "QtCharts::QAbstractAxis"
2300 exports: [
2309 exports: [
2301 "QtCharts/ValueAxis 1.1",
2310 "QtCharts/ValueAxis 1.1",
2302 "QtCharts/ValueAxis 2.0",
2311 "QtCharts/ValueAxis 2.0",
2303 "QtCharts/ValuesAxis 1.0"
2312 "QtCharts/ValuesAxis 1.0"
2304 ]
2313 ]
2305 exportMetaObjectRevisions: [0, 0, 0]
2314 exportMetaObjectRevisions: [0, 0, 0]
2306 Property { name: "tickCount"; type: "int" }
2315 Property { name: "tickCount"; type: "int" }
2307 Property { name: "min"; type: "double" }
2316 Property { name: "min"; type: "double" }
2308 Property { name: "max"; type: "double" }
2317 Property { name: "max"; type: "double" }
2309 Property { name: "labelFormat"; type: "string" }
2318 Property { name: "labelFormat"; type: "string" }
2310 Signal {
2319 Signal {
2311 name: "minChanged"
2320 name: "minChanged"
2312 Parameter { name: "min"; type: "double" }
2321 Parameter { name: "min"; type: "double" }
2313 }
2322 }
2314 Signal {
2323 Signal {
2315 name: "maxChanged"
2324 name: "maxChanged"
2316 Parameter { name: "max"; type: "double" }
2325 Parameter { name: "max"; type: "double" }
2317 }
2326 }
2318 Signal {
2327 Signal {
2319 name: "rangeChanged"
2328 name: "rangeChanged"
2320 Parameter { name: "min"; type: "double" }
2329 Parameter { name: "min"; type: "double" }
2321 Parameter { name: "max"; type: "double" }
2330 Parameter { name: "max"; type: "double" }
2322 }
2331 }
2323 Signal {
2332 Signal {
2324 name: "tickCountChanged"
2333 name: "tickCountChanged"
2325 Parameter { name: "tickCount"; type: "int" }
2334 Parameter { name: "tickCount"; type: "int" }
2326 }
2335 }
2327 Signal {
2336 Signal {
2328 name: "labelFormatChanged"
2337 name: "labelFormatChanged"
2329 Parameter { name: "format"; type: "string" }
2338 Parameter { name: "format"; type: "string" }
2330 }
2339 }
2331 Method { name: "applyNiceNumbers" }
2340 Method { name: "applyNiceNumbers" }
2332 }
2341 }
2333 Component {
2342 Component {
2334 name: "QtCharts::QXYModelMapper"
2343 name: "QtCharts::QXYModelMapper"
2335 prototype: "QObject"
2344 prototype: "QObject"
2336 exports: ["QtCharts/XYModelMapper 1.0", "QtCharts/XYModelMapper 2.0"]
2345 exports: ["QtCharts/XYModelMapper 1.0", "QtCharts/XYModelMapper 2.0"]
2337 isCreatable: false
2346 isCreatable: false
2338 exportMetaObjectRevisions: [0, 0]
2347 exportMetaObjectRevisions: [0, 0]
2339 }
2348 }
2340 Component {
2349 Component {
2341 name: "QtCharts::QXYSeries"
2350 name: "QtCharts::QXYSeries"
2342 prototype: "QtCharts::QAbstractSeries"
2351 prototype: "QtCharts::QAbstractSeries"
2343 exports: ["QtCharts/XYSeries 1.0", "QtCharts/XYSeries 2.0"]
2352 exports: ["QtCharts/XYSeries 1.0", "QtCharts/XYSeries 2.0"]
2344 isCreatable: false
2353 isCreatable: false
2345 exportMetaObjectRevisions: [0, 0]
2354 exportMetaObjectRevisions: [0, 0]
2346 Property { name: "pointsVisible"; type: "bool" }
2355 Property { name: "pointsVisible"; type: "bool" }
2347 Property { name: "color"; type: "QColor" }
2356 Property { name: "color"; type: "QColor" }
2348 Property { name: "pointLabelsFormat"; type: "string" }
2357 Property { name: "pointLabelsFormat"; type: "string" }
2349 Property { name: "pointLabelsVisible"; type: "bool" }
2358 Property { name: "pointLabelsVisible"; type: "bool" }
2350 Property { name: "pointLabelsFont"; type: "QFont" }
2359 Property { name: "pointLabelsFont"; type: "QFont" }
2351 Property { name: "pointLabelsColor"; type: "QColor" }
2360 Property { name: "pointLabelsColor"; type: "QColor" }
2352 Signal {
2361 Signal {
2353 name: "clicked"
2362 name: "clicked"
2354 Parameter { name: "point"; type: "QPointF" }
2363 Parameter { name: "point"; type: "QPointF" }
2355 }
2364 }
2356 Signal {
2365 Signal {
2357 name: "hovered"
2366 name: "hovered"
2358 Parameter { name: "point"; type: "QPointF" }
2367 Parameter { name: "point"; type: "QPointF" }
2359 Parameter { name: "state"; type: "bool" }
2368 Parameter { name: "state"; type: "bool" }
2360 }
2369 }
2361 Signal {
2370 Signal {
2362 name: "pressed"
2371 name: "pressed"
2363 Parameter { name: "point"; type: "QPointF" }
2372 Parameter { name: "point"; type: "QPointF" }
2364 }
2373 }
2365 Signal {
2374 Signal {
2366 name: "released"
2375 name: "released"
2367 Parameter { name: "point"; type: "QPointF" }
2376 Parameter { name: "point"; type: "QPointF" }
2368 }
2377 }
2369 Signal {
2378 Signal {
2370 name: "doubleClicked"
2379 name: "doubleClicked"
2371 Parameter { name: "point"; type: "QPointF" }
2380 Parameter { name: "point"; type: "QPointF" }
2372 }
2381 }
2373 Signal {
2382 Signal {
2374 name: "pointReplaced"
2383 name: "pointReplaced"
2375 Parameter { name: "index"; type: "int" }
2384 Parameter { name: "index"; type: "int" }
2376 }
2385 }
2377 Signal {
2386 Signal {
2378 name: "pointRemoved"
2387 name: "pointRemoved"
2379 Parameter { name: "index"; type: "int" }
2388 Parameter { name: "index"; type: "int" }
2380 }
2389 }
2381 Signal {
2390 Signal {
2382 name: "pointAdded"
2391 name: "pointAdded"
2383 Parameter { name: "index"; type: "int" }
2392 Parameter { name: "index"; type: "int" }
2384 }
2393 }
2385 Signal {
2394 Signal {
2386 name: "colorChanged"
2395 name: "colorChanged"
2387 Parameter { name: "color"; type: "QColor" }
2396 Parameter { name: "color"; type: "QColor" }
2388 }
2397 }
2389 Signal { name: "pointsReplaced" }
2398 Signal { name: "pointsReplaced" }
2390 Signal {
2399 Signal {
2391 name: "pointLabelsFormatChanged"
2400 name: "pointLabelsFormatChanged"
2392 Parameter { name: "format"; type: "string" }
2401 Parameter { name: "format"; type: "string" }
2393 }
2402 }
2394 Signal {
2403 Signal {
2395 name: "pointLabelsVisibilityChanged"
2404 name: "pointLabelsVisibilityChanged"
2396 Parameter { name: "visible"; type: "bool" }
2405 Parameter { name: "visible"; type: "bool" }
2397 }
2406 }
2398 Signal {
2407 Signal {
2399 name: "pointLabelsFontChanged"
2408 name: "pointLabelsFontChanged"
2400 Parameter { name: "font"; type: "QFont" }
2409 Parameter { name: "font"; type: "QFont" }
2401 }
2410 }
2402 Signal {
2411 Signal {
2403 name: "pointLabelsColorChanged"
2412 name: "pointLabelsColorChanged"
2404 Parameter { name: "color"; type: "QColor" }
2413 Parameter { name: "color"; type: "QColor" }
2405 }
2414 }
2406 }
2415 }
2407 }
2416 }
@@ -1,318 +1,337
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include "../qabstractaxis/tst_qabstractaxis.h"
19 #include "../qabstractaxis/tst_qabstractaxis.h"
20 #include <QtCharts/QCategoryAxis>
20 #include <QtCharts/QCategoryAxis>
21 #include <QtCharts/QLineSeries>
21 #include <QtCharts/QLineSeries>
22
22
23 class tst_QCategoryAxis: public tst_QAbstractAxis
23 class tst_QCategoryAxis: public tst_QAbstractAxis
24 {
24 {
25 Q_OBJECT
25 Q_OBJECT
26
26
27 public slots:
27 public slots:
28 void initTestCase();
28 void initTestCase();
29 void cleanupTestCase();
29 void cleanupTestCase();
30 void init();
30 void init();
31 void cleanup();
31 void cleanup();
32
32
33 private slots:
33 private slots:
34 void qcategoryaxis_data();
34 void qcategoryaxis_data();
35 void qcategoryaxis();
35 void qcategoryaxis();
36
36
37 void max_raw_data();
37 void max_raw_data();
38 void max_raw();
38 void max_raw();
39 void max_data();
39 void max_data();
40 void max();
40 void max();
41 void max_animation_data();
41 void max_animation_data();
42 void max_animation();
42 void max_animation();
43 void min_raw_data();
43 void min_raw_data();
44 void min_raw();
44 void min_raw();
45 void min_data();
45 void min_data();
46 void min();
46 void min();
47 void min_animation_data();
47 void min_animation_data();
48 void min_animation();
48 void min_animation();
49 void range_raw_data();
49 void range_raw_data();
50 void range_raw();
50 void range_raw();
51 void range_data();
51 void range_data();
52 void range();
52 void range();
53 void range_animation_data();
53 void range_animation_data();
54 void range_animation();
54 void range_animation();
55 void labels_position();
55 void labels_position();
56
56
57 void interval_data();
57 void interval_data();
58 void interval();
58 void interval();
59 void reverse();
59
60
60 private:
61 private:
61 QCategoryAxis* m_categoryaxis;
62 QCategoryAxis* m_categoryaxis;
62 QLineSeries* m_series;
63 QLineSeries* m_series;
63 };
64 };
64
65
65 void tst_QCategoryAxis::initTestCase()
66 void tst_QCategoryAxis::initTestCase()
66 {
67 {
67 qRegisterMetaType<QCategoryAxis::AxisLabelsPosition>("QCategoryAxis::AxisLabelsPosition");
68 qRegisterMetaType<QCategoryAxis::AxisLabelsPosition>("QCategoryAxis::AxisLabelsPosition");
68 }
69 }
69
70
70 void tst_QCategoryAxis::cleanupTestCase()
71 void tst_QCategoryAxis::cleanupTestCase()
71 {
72 {
72 QTest::qWait(1); // Allow final deleteLaters to run
73 QTest::qWait(1); // Allow final deleteLaters to run
73 }
74 }
74
75
75 void tst_QCategoryAxis::init()
76 void tst_QCategoryAxis::init()
76 {
77 {
77 m_categoryaxis = new QCategoryAxis();
78 m_categoryaxis = new QCategoryAxis();
78 m_series = new QLineSeries();
79 m_series = new QLineSeries();
79 *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
80 *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
80 tst_QAbstractAxis::init(m_categoryaxis, m_series);
81 tst_QAbstractAxis::init(m_categoryaxis, m_series);
81 m_chart->addSeries(m_series);
82 m_chart->addSeries(m_series);
82 m_chart->createDefaultAxes();
83 m_chart->createDefaultAxes();
83 }
84 }
84
85
85 void tst_QCategoryAxis::cleanup()
86 void tst_QCategoryAxis::cleanup()
86 {
87 {
87 delete m_series;
88 delete m_series;
88 delete m_categoryaxis;
89 delete m_categoryaxis;
89 m_series = 0;
90 m_series = 0;
90 m_categoryaxis = 0;
91 m_categoryaxis = 0;
91 tst_QAbstractAxis::cleanup();
92 tst_QAbstractAxis::cleanup();
92 }
93 }
93
94
94 void tst_QCategoryAxis::qcategoryaxis_data()
95 void tst_QCategoryAxis::qcategoryaxis_data()
95 {
96 {
96 }
97 }
97
98
98 void tst_QCategoryAxis::qcategoryaxis()
99 void tst_QCategoryAxis::qcategoryaxis()
99 {
100 {
100 qabstractaxis();
101 qabstractaxis();
101
102
102 QVERIFY(qFuzzyCompare(m_categoryaxis->max(), 0));
103 QVERIFY(qFuzzyCompare(m_categoryaxis->max(), 0));
103 QVERIFY(qFuzzyCompare(m_categoryaxis->min(), 0));
104 QVERIFY(qFuzzyCompare(m_categoryaxis->min(), 0));
104 QCOMPARE(m_categoryaxis->type(), QAbstractAxis::AxisTypeCategory);
105 QCOMPARE(m_categoryaxis->type(), QAbstractAxis::AxisTypeCategory);
105 QCOMPARE(m_categoryaxis->labelsPosition(), QCategoryAxis::AxisLabelsPositionCenter);
106 QCOMPARE(m_categoryaxis->labelsPosition(), QCategoryAxis::AxisLabelsPositionCenter);
106
107
107 m_chart->setAxisX(m_categoryaxis, m_series);
108 m_chart->setAxisX(m_categoryaxis, m_series);
108 m_view->show();
109 m_view->show();
109 QTest::qWaitForWindowShown(m_view);
110 QTest::qWaitForWindowShown(m_view);
110
111
111 QVERIFY(!qFuzzyCompare(m_categoryaxis->max(), 0));
112 QVERIFY(!qFuzzyCompare(m_categoryaxis->max(), 0));
112 QVERIFY(!qFuzzyCompare(m_categoryaxis->min(), 0));
113 QVERIFY(!qFuzzyCompare(m_categoryaxis->min(), 0));
114
115 QCOMPARE(m_categoryaxis->isReverse(), false);
113 }
116 }
114
117
115 void tst_QCategoryAxis::max_raw_data()
118 void tst_QCategoryAxis::max_raw_data()
116 {
119 {
117 QTest::addColumn<qreal>("max");
120 QTest::addColumn<qreal>("max");
118 QTest::newRow("1.0") << (qreal)1.0;
121 QTest::newRow("1.0") << (qreal)1.0;
119 QTest::newRow("50.0") << (qreal)50.0;
122 QTest::newRow("50.0") << (qreal)50.0;
120 QTest::newRow("101.0") << (qreal)101.0;
123 QTest::newRow("101.0") << (qreal)101.0;
121 }
124 }
122
125
123 void tst_QCategoryAxis::max_raw()
126 void tst_QCategoryAxis::max_raw()
124 {
127 {
125 QFETCH(qreal, max);
128 QFETCH(qreal, max);
126
129
127 QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal)));
130 QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal)));
128 QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal)));
131 QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal)));
129 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
132 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
130
133
131 m_categoryaxis->setMax(max);
134 m_categoryaxis->setMax(max);
132 QVERIFY2(qFuzzyCompare(m_categoryaxis->max(), max), "Not equal");
135 QVERIFY2(qFuzzyCompare(m_categoryaxis->max(), max), "Not equal");
133
136
134 QCOMPARE(spy0.count(), 1);
137 QCOMPARE(spy0.count(), 1);
135 QCOMPARE(spy1.count(), 0);
138 QCOMPARE(spy1.count(), 0);
136 QCOMPARE(spy2.count(), 1);
139 QCOMPARE(spy2.count(), 1);
137 }
140 }
138
141
139 void tst_QCategoryAxis::max_data()
142 void tst_QCategoryAxis::max_data()
140 {
143 {
141 max_raw_data();
144 max_raw_data();
142 }
145 }
143
146
144 void tst_QCategoryAxis::max()
147 void tst_QCategoryAxis::max()
145 {
148 {
146 m_chart->setAxisX(m_categoryaxis, m_series);
149 m_chart->setAxisX(m_categoryaxis, m_series);
147 m_view->show();
150 m_view->show();
148 QTest::qWaitForWindowShown(m_view);
151 QTest::qWaitForWindowShown(m_view);
149 max_raw();
152 max_raw();
150 }
153 }
151
154
152 void tst_QCategoryAxis::max_animation_data()
155 void tst_QCategoryAxis::max_animation_data()
153 {
156 {
154 max_data();
157 max_data();
155 }
158 }
156
159
157 void tst_QCategoryAxis::max_animation()
160 void tst_QCategoryAxis::max_animation()
158 {
161 {
159 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
162 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
160 max();
163 max();
161 }
164 }
162
165
163 void tst_QCategoryAxis::min_raw_data()
166 void tst_QCategoryAxis::min_raw_data()
164 {
167 {
165 QTest::addColumn<qreal>("min");
168 QTest::addColumn<qreal>("min");
166 QTest::newRow("-1.0") << (qreal)-1.0;
169 QTest::newRow("-1.0") << (qreal)-1.0;
167 QTest::newRow("-50.0") << (qreal)-50.0;
170 QTest::newRow("-50.0") << (qreal)-50.0;
168 QTest::newRow("-101.0") << (qreal)-101.0;
171 QTest::newRow("-101.0") << (qreal)-101.0;
169 }
172 }
170
173
171 void tst_QCategoryAxis::min_raw()
174 void tst_QCategoryAxis::min_raw()
172 {
175 {
173 QFETCH(qreal, min);
176 QFETCH(qreal, min);
174
177
175 QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal)));
178 QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal)));
176 QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal)));
179 QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal)));
177 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
180 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
178
181
179 m_categoryaxis->setMin(min);
182 m_categoryaxis->setMin(min);
180 QVERIFY2(qFuzzyCompare(m_categoryaxis->min(), min), "Not equal");
183 QVERIFY2(qFuzzyCompare(m_categoryaxis->min(), min), "Not equal");
181
184
182 QCOMPARE(spy0.count(), 0);
185 QCOMPARE(spy0.count(), 0);
183 QCOMPARE(spy1.count(), 1);
186 QCOMPARE(spy1.count(), 1);
184 QCOMPARE(spy2.count(), 1);
187 QCOMPARE(spy2.count(), 1);
185 }
188 }
186
189
187 void tst_QCategoryAxis::min_data()
190 void tst_QCategoryAxis::min_data()
188 {
191 {
189 min_raw_data();
192 min_raw_data();
190 }
193 }
191
194
192 void tst_QCategoryAxis::min()
195 void tst_QCategoryAxis::min()
193 {
196 {
194 m_chart->setAxisX(m_categoryaxis, m_series);
197 m_chart->setAxisX(m_categoryaxis, m_series);
195 m_view->show();
198 m_view->show();
196 QTest::qWaitForWindowShown(m_view);
199 QTest::qWaitForWindowShown(m_view);
197 min_raw();
200 min_raw();
198 }
201 }
199
202
200 void tst_QCategoryAxis::min_animation_data()
203 void tst_QCategoryAxis::min_animation_data()
201 {
204 {
202 min_data();
205 min_data();
203 }
206 }
204
207
205 void tst_QCategoryAxis::min_animation()
208 void tst_QCategoryAxis::min_animation()
206 {
209 {
207 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
210 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
208 min();
211 min();
209 }
212 }
210
213
211 void tst_QCategoryAxis::range_raw_data()
214 void tst_QCategoryAxis::range_raw_data()
212 {
215 {
213 QTest::addColumn<qreal>("min");
216 QTest::addColumn<qreal>("min");
214 QTest::addColumn<qreal>("max");
217 QTest::addColumn<qreal>("max");
215 QTest::newRow("1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0;
218 QTest::newRow("1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0;
216 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
219 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
217 QTest::newRow("101.0") << (qreal)40.0 << (qreal)60.0;
220 QTest::newRow("101.0") << (qreal)40.0 << (qreal)60.0;
218 QTest::newRow("-35.0 - 0.0") << (qreal)-35.0 << (qreal)10.0;
221 QTest::newRow("-35.0 - 0.0") << (qreal)-35.0 << (qreal)10.0;
219 QTest::newRow("-35.0 - 0.0") << (qreal)-35.0 << (qreal)-15.0;
222 QTest::newRow("-35.0 - 0.0") << (qreal)-35.0 << (qreal)-15.0;
220 QTest::newRow("0.0 - 0.0") << (qreal)-0.1 << (qreal)0.1;
223 QTest::newRow("0.0 - 0.0") << (qreal)-0.1 << (qreal)0.1;
221 }
224 }
222
225
223 void tst_QCategoryAxis::range_raw()
226 void tst_QCategoryAxis::range_raw()
224 {
227 {
225 QFETCH(qreal, min);
228 QFETCH(qreal, min);
226 QFETCH(qreal, max);
229 QFETCH(qreal, max);
227
230
228 QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal)));
231 QSignalSpy spy0(m_categoryaxis, SIGNAL(maxChanged(qreal)));
229 QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal)));
232 QSignalSpy spy1(m_categoryaxis, SIGNAL(minChanged(qreal)));
230 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
233 QSignalSpy spy2(m_categoryaxis, SIGNAL(rangeChanged(qreal,qreal)));
231
234
232 m_categoryaxis->setRange(min, max);
235 m_categoryaxis->setRange(min, max);
233 QVERIFY2(qFuzzyCompare(m_categoryaxis->min(), min), "Min not equal");
236 QVERIFY2(qFuzzyCompare(m_categoryaxis->min(), min), "Min not equal");
234 QVERIFY2(qFuzzyCompare(m_categoryaxis->max(), max), "Max not equal");
237 QVERIFY2(qFuzzyCompare(m_categoryaxis->max(), max), "Max not equal");
235
238
236 QCOMPARE(spy0.count(), 1);
239 QCOMPARE(spy0.count(), 1);
237 QCOMPARE(spy1.count(), 1);
240 QCOMPARE(spy1.count(), 1);
238 QCOMPARE(spy2.count(), 1);
241 QCOMPARE(spy2.count(), 1);
239 }
242 }
240
243
241 void tst_QCategoryAxis::range_data()
244 void tst_QCategoryAxis::range_data()
242 {
245 {
243 range_raw_data();
246 range_raw_data();
244 }
247 }
245
248
246 void tst_QCategoryAxis::range()
249 void tst_QCategoryAxis::range()
247 {
250 {
248 m_chart->setAxisX(m_categoryaxis, m_series);
251 m_chart->setAxisX(m_categoryaxis, m_series);
249 m_view->show();
252 m_view->show();
250 QTest::qWaitForWindowShown(m_view);
253 QTest::qWaitForWindowShown(m_view);
251 range_raw();
254 range_raw();
252 }
255 }
253
256
254 void tst_QCategoryAxis::range_animation_data()
257 void tst_QCategoryAxis::range_animation_data()
255 {
258 {
256 range_data();
259 range_data();
257 }
260 }
258
261
259 void tst_QCategoryAxis::range_animation()
262 void tst_QCategoryAxis::range_animation()
260 {
263 {
261 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
264 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
262 range();
265 range();
263 }
266 }
264
267
265 void tst_QCategoryAxis::interval_data()
268 void tst_QCategoryAxis::interval_data()
266 {
269 {
267 //
270 //
268 }
271 }
269
272
270 void tst_QCategoryAxis::interval()
273 void tst_QCategoryAxis::interval()
271 {
274 {
272 // append one correct interval
275 // append one correct interval
273 m_categoryaxis->append("first", (qreal)45);
276 m_categoryaxis->append("first", (qreal)45);
274 QCOMPARE(m_categoryaxis->startValue("first"), (qreal)0);
277 QCOMPARE(m_categoryaxis->startValue("first"), (qreal)0);
275 QCOMPARE(m_categoryaxis->endValue("first"), (qreal)45);
278 QCOMPARE(m_categoryaxis->endValue("first"), (qreal)45);
276
279
277 // append one more correct interval
280 // append one more correct interval
278 m_categoryaxis->append("second", (qreal)75);
281 m_categoryaxis->append("second", (qreal)75);
279 QCOMPARE(m_categoryaxis->startValue("second"), (qreal)45);
282 QCOMPARE(m_categoryaxis->startValue("second"), (qreal)45);
280 QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75);
283 QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75);
281
284
282 // append one incorrect interval
285 // append one incorrect interval
283 m_categoryaxis->append("third", (qreal)15);
286 m_categoryaxis->append("third", (qreal)15);
284 QCOMPARE(m_categoryaxis->count(), 2);
287 QCOMPARE(m_categoryaxis->count(), 2);
285 QCOMPARE(m_categoryaxis->endValue(m_categoryaxis->categoriesLabels().last()), (qreal)75);
288 QCOMPARE(m_categoryaxis->endValue(m_categoryaxis->categoriesLabels().last()), (qreal)75);
286 // QCOMPARE(intervalMax("first"), (qreal)75);
289 // QCOMPARE(intervalMax("first"), (qreal)75);
287
290
288 // append one more correct interval
291 // append one more correct interval
289 m_categoryaxis->append("third", (qreal)100);
292 m_categoryaxis->append("third", (qreal)100);
290 QCOMPARE(m_categoryaxis->count(), 3);
293 QCOMPARE(m_categoryaxis->count(), 3);
291 QCOMPARE(m_categoryaxis->startValue("third"), (qreal)75);
294 QCOMPARE(m_categoryaxis->startValue("third"), (qreal)75);
292 QCOMPARE(m_categoryaxis->endValue("third"), (qreal)100);
295 QCOMPARE(m_categoryaxis->endValue("third"), (qreal)100);
293
296
294 // remove one interval
297 // remove one interval
295 m_categoryaxis->remove("first");
298 m_categoryaxis->remove("first");
296 QCOMPARE(m_categoryaxis->count(), 2);
299 QCOMPARE(m_categoryaxis->count(), 2);
297 QCOMPARE(m_categoryaxis->startValue("second"), (qreal)0); // second interval should extend to firstInterval minimum
300 QCOMPARE(m_categoryaxis->startValue("second"), (qreal)0); // second interval should extend to firstInterval minimum
298 QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75);
301 QCOMPARE(m_categoryaxis->endValue("second"), (qreal)75);
299
302
300 // remove one interval
303 // remove one interval
301 m_categoryaxis->replaceLabel("second", "replaced");
304 m_categoryaxis->replaceLabel("second", "replaced");
302 QCOMPARE(m_categoryaxis->count(), 2);
305 QCOMPARE(m_categoryaxis->count(), 2);
303 QCOMPARE(m_categoryaxis->startValue("replaced"), (qreal)0); // second interval should extend to firstInterval minimum
306 QCOMPARE(m_categoryaxis->startValue("replaced"), (qreal)0); // second interval should extend to firstInterval minimum
304 QCOMPARE(m_categoryaxis->endValue("replaced"), (qreal)75);
307 QCOMPARE(m_categoryaxis->endValue("replaced"), (qreal)75);
305 }
308 }
306
309
307 void tst_QCategoryAxis::labels_position()
310 void tst_QCategoryAxis::labels_position()
308 {
311 {
309 QSignalSpy spy(m_categoryaxis,
312 QSignalSpy spy(m_categoryaxis,
310 SIGNAL(labelsPositionChanged(QCategoryAxis::AxisLabelsPosition)));
313 SIGNAL(labelsPositionChanged(QCategoryAxis::AxisLabelsPosition)));
311 m_categoryaxis->setLabelsPosition(QCategoryAxis::AxisLabelsPositionOnValue);
314 m_categoryaxis->setLabelsPosition(QCategoryAxis::AxisLabelsPositionOnValue);
312 QCOMPARE(m_categoryaxis->labelsPosition(), QCategoryAxis::AxisLabelsPositionOnValue);
315 QCOMPARE(m_categoryaxis->labelsPosition(), QCategoryAxis::AxisLabelsPositionOnValue);
313 QCOMPARE(spy.count(), 1);
316 QCOMPARE(spy.count(), 1);
314 }
317 }
315
318
319 void tst_QCategoryAxis::reverse()
320 {
321 QSignalSpy spy(m_categoryaxis, SIGNAL(reverseChanged(bool)));
322 QCOMPARE(m_categoryaxis->isReverse(), false);
323
324 m_categoryaxis->setReverse();
325 QCOMPARE(m_categoryaxis->isReverse(), true);
326
327 m_chart->setAxisX(m_categoryaxis, m_series);
328 QCOMPARE(spy.count(), 1);
329
330 m_view->show();
331 QTest::qWaitForWindowShown(m_view);
332 QCOMPARE(m_categoryaxis->isReverse(), true);
333 }
334
316 QTEST_MAIN(tst_QCategoryAxis)
335 QTEST_MAIN(tst_QCategoryAxis)
317 #include "tst_qcategoryaxis.moc"
336 #include "tst_qcategoryaxis.moc"
318
337
@@ -1,312 +1,330
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include "../qabstractaxis/tst_qabstractaxis.h"
19 #include "../qabstractaxis/tst_qabstractaxis.h"
20 #include <QtCharts/QDateTimeAxis>
20 #include <QtCharts/QDateTimeAxis>
21 #include <QtCharts/QLineSeries>
21 #include <QtCharts/QLineSeries>
22
22
23 class tst_QDateTimeAxis : public QObject//: public tst_QAbstractAxis
23 class tst_QDateTimeAxis : public QObject//: public tst_QAbstractAxis
24 {
24 {
25 Q_OBJECT
25 Q_OBJECT
26
26
27 public slots:
27 public slots:
28 void initTestCase();
28 void initTestCase();
29 void cleanupTestCase();
29 void cleanupTestCase();
30 void init();
30 void init();
31 void cleanup();
31 void cleanup();
32
32
33 private slots:
33 private slots:
34 void qdatetimeaxis_data();
34 void qdatetimeaxis_data();
35 void qdatetimeaxis();
35 void qdatetimeaxis();
36
36
37 void max_raw_data();
37 void max_raw_data();
38 void max_raw();
38 void max_raw();
39 void max_data();
39 void max_data();
40 void max();
40 void max();
41 void max_animation_data();
41 void max_animation_data();
42 void max_animation();
42 void max_animation();
43 void min_raw_data();
43 void min_raw_data();
44 void min_raw();
44 void min_raw();
45 void min_data();
45 void min_data();
46 void min();
46 void min();
47 void min_animation_data();
47 void min_animation_data();
48 void min_animation();
48 void min_animation();
49 void range_raw_data();
49 void range_raw_data();
50 void range_raw();
50 void range_raw();
51 void range_data();
51 void range_data();
52 void range();
52 void range();
53 void range_animation_data();
53 void range_animation_data();
54 void range_animation();
54 void range_animation();
55 void reverse();
55
56
56 private:
57 private:
57 QDateTimeAxis *m_dateTimeAxisX;
58 QDateTimeAxis *m_dateTimeAxisX;
58 QDateTimeAxis *m_dateTimeAxisY;
59 QDateTimeAxis *m_dateTimeAxisY;
59 QLineSeries* m_series;
60 QLineSeries* m_series;
60 QChartView* m_view;
61 QChartView* m_view;
61 QChart* m_chart;
62 QChart* m_chart;
62 };
63 };
63
64
64 void tst_QDateTimeAxis::initTestCase()
65 void tst_QDateTimeAxis::initTestCase()
65 {
66 {
66 }
67 }
67
68
68 void tst_QDateTimeAxis::cleanupTestCase()
69 void tst_QDateTimeAxis::cleanupTestCase()
69 {
70 {
70 QTest::qWait(1); // Allow final deleteLaters to run
71 QTest::qWait(1); // Allow final deleteLaters to run
71 }
72 }
72
73
73 void tst_QDateTimeAxis::init()
74 void tst_QDateTimeAxis::init()
74 {
75 {
75 m_dateTimeAxisX = new QDateTimeAxis();
76 m_dateTimeAxisX = new QDateTimeAxis();
76 m_dateTimeAxisY = new QDateTimeAxis();
77 m_dateTimeAxisY = new QDateTimeAxis();
77 m_series = new QLineSeries();
78 m_series = new QLineSeries();
78 *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
79 *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
79 // tst_QAbstractAxis::init(m_datetimeaxis, m_series);
80 // tst_QAbstractAxis::init(m_datetimeaxis, m_series);
80
81
81 m_view = new QChartView;
82 m_view = new QChartView;
82 m_chart = m_view->chart();
83 m_chart = m_view->chart();
83 m_chart->addSeries(m_series);
84 m_chart->addSeries(m_series);
84 m_chart->setAxisY(m_dateTimeAxisY, m_series);
85 m_chart->setAxisY(m_dateTimeAxisY, m_series);
85 m_chart->setAxisX(m_dateTimeAxisX, m_series);
86 m_chart->setAxisX(m_dateTimeAxisX, m_series);
86 }
87 }
87
88
88 void tst_QDateTimeAxis::cleanup()
89 void tst_QDateTimeAxis::cleanup()
89 {
90 {
90 delete m_series;
91 delete m_series;
91 delete m_dateTimeAxisX;
92 delete m_dateTimeAxisX;
92 delete m_dateTimeAxisY;
93 delete m_dateTimeAxisY;
93 m_series = 0;
94 m_series = 0;
94 m_dateTimeAxisX = 0;
95 m_dateTimeAxisX = 0;
95 m_dateTimeAxisY = 0;
96 m_dateTimeAxisY = 0;
96 delete m_view;
97 delete m_view;
97 m_view = 0;
98 m_view = 0;
98 m_chart = 0;
99 m_chart = 0;
99 // tst_QAbstractAxis::cleanup();
100 // tst_QAbstractAxis::cleanup();
100 }
101 }
101
102
102 void tst_QDateTimeAxis::qdatetimeaxis_data()
103 void tst_QDateTimeAxis::qdatetimeaxis_data()
103 {
104 {
104 }
105 }
105
106
106 void tst_QDateTimeAxis::qdatetimeaxis()
107 void tst_QDateTimeAxis::qdatetimeaxis()
107 {
108 {
108 // qabstractaxis();
109 // qabstractaxis();
109 QCOMPARE(m_dateTimeAxisX->type(), QAbstractAxis::AxisTypeDateTime);
110 QCOMPARE(m_dateTimeAxisX->type(), QAbstractAxis::AxisTypeDateTime);
110
111
111 m_view->show();
112 m_view->show();
112 QTest::qWaitForWindowShown(m_view);
113 QTest::qWaitForWindowShown(m_view);
113
114
114 QVERIFY(m_dateTimeAxisX->max().toMSecsSinceEpoch() != 0);
115 QVERIFY(m_dateTimeAxisX->max().toMSecsSinceEpoch() != 0);
115 QVERIFY(m_dateTimeAxisX->min().toMSecsSinceEpoch() != 0);
116 QVERIFY(m_dateTimeAxisX->min().toMSecsSinceEpoch() != 0);
117
118 QCOMPARE(m_dateTimeAxisX->isReverse(), false);
119 QCOMPARE(m_dateTimeAxisY->isReverse(), false);
116 }
120 }
117
121
118 void tst_QDateTimeAxis::max_raw_data()
122 void tst_QDateTimeAxis::max_raw_data()
119 {
123 {
120 QTest::addColumn<QDateTime>("max");
124 QTest::addColumn<QDateTime>("max");
121 QTest::addColumn<bool>("valid");
125 QTest::addColumn<bool>("valid");
122 QDateTime dateTime;
126 QDateTime dateTime;
123 dateTime.setDate(QDate(2012, 7, 19));
127 dateTime.setDate(QDate(2012, 7, 19));
124 QTest::newRow("19.7.2012 - Valid") << dateTime << true;
128 QTest::newRow("19.7.2012 - Valid") << dateTime << true;
125 dateTime.setDate(QDate(2012, 17, 32));
129 dateTime.setDate(QDate(2012, 17, 32));
126 QTest::newRow("32.17.2012 - Invalid") << dateTime << false;
130 QTest::newRow("32.17.2012 - Invalid") << dateTime << false;
127 }
131 }
128
132
129 void tst_QDateTimeAxis::max_raw()
133 void tst_QDateTimeAxis::max_raw()
130 {
134 {
131 QFETCH(QDateTime, max);
135 QFETCH(QDateTime, max);
132 QFETCH(bool, valid);
136 QFETCH(bool, valid);
133
137
134 QSignalSpy spy0(m_dateTimeAxisX, SIGNAL(maxChanged(QDateTime)));
138 QSignalSpy spy0(m_dateTimeAxisX, SIGNAL(maxChanged(QDateTime)));
135 QSignalSpy spy1(m_dateTimeAxisX, SIGNAL(minChanged(QDateTime)));
139 QSignalSpy spy1(m_dateTimeAxisX, SIGNAL(minChanged(QDateTime)));
136 QSignalSpy spy2(m_dateTimeAxisX, SIGNAL(rangeChanged(QDateTime,QDateTime)));
140 QSignalSpy spy2(m_dateTimeAxisX, SIGNAL(rangeChanged(QDateTime,QDateTime)));
137
141
138 m_dateTimeAxisX->setMax(max);
142 m_dateTimeAxisX->setMax(max);
139
143
140 if (valid) {
144 if (valid) {
141 QVERIFY2(m_dateTimeAxisX->max() == max, "Not equal");
145 QVERIFY2(m_dateTimeAxisX->max() == max, "Not equal");
142 QCOMPARE(spy0.count(), 1);
146 QCOMPARE(spy0.count(), 1);
143 QCOMPARE(spy1.count(), 0);
147 QCOMPARE(spy1.count(), 0);
144 QCOMPARE(spy2.count(), 1);
148 QCOMPARE(spy2.count(), 1);
145 } else {
149 } else {
146 QVERIFY2(m_dateTimeAxisX->max() != max, "Date is invalid and should not be set");
150 QVERIFY2(m_dateTimeAxisX->max() != max, "Date is invalid and should not be set");
147 QCOMPARE(spy0.count(), 0);
151 QCOMPARE(spy0.count(), 0);
148 QCOMPARE(spy1.count(), 0);
152 QCOMPARE(spy1.count(), 0);
149 QCOMPARE(spy2.count(), 0);
153 QCOMPARE(spy2.count(), 0);
150 }
154 }
151 }
155 }
152
156
153 void tst_QDateTimeAxis::max_data()
157 void tst_QDateTimeAxis::max_data()
154 {
158 {
155 max_raw_data();
159 max_raw_data();
156 }
160 }
157
161
158 void tst_QDateTimeAxis::max()
162 void tst_QDateTimeAxis::max()
159 {
163 {
160 // m_chart->setAxisX(m_dateTimeAxisX, m_series);
164 // m_chart->setAxisX(m_dateTimeAxisX, m_series);
161 m_view->show();
165 m_view->show();
162 QTest::qWaitForWindowShown(m_view);
166 QTest::qWaitForWindowShown(m_view);
163 max_raw();
167 max_raw();
164 }
168 }
165
169
166 void tst_QDateTimeAxis::max_animation_data()
170 void tst_QDateTimeAxis::max_animation_data()
167 {
171 {
168 max_data();
172 max_data();
169 }
173 }
170
174
171 void tst_QDateTimeAxis::max_animation()
175 void tst_QDateTimeAxis::max_animation()
172 {
176 {
173 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
177 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
174 max();
178 max();
175 }
179 }
176
180
177 void tst_QDateTimeAxis::min_raw_data()
181 void tst_QDateTimeAxis::min_raw_data()
178 {
182 {
179 QTest::addColumn<QDateTime>("min");
183 QTest::addColumn<QDateTime>("min");
180 QTest::addColumn<bool>("valid");
184 QTest::addColumn<bool>("valid");
181 QDateTime dateTime;
185 QDateTime dateTime;
182 dateTime.setDate(QDate(1908, 1, 11));
186 dateTime.setDate(QDate(1908, 1, 11));
183 QTest::newRow("11.1.1908 - Valid") << dateTime << true; // negative MSecs from Epoch
187 QTest::newRow("11.1.1908 - Valid") << dateTime << true; // negative MSecs from Epoch
184 dateTime.setDate(QDate(2012, 17, 32));
188 dateTime.setDate(QDate(2012, 17, 32));
185 QTest::newRow("32.17.2012 - Invalid") << dateTime << false;
189 QTest::newRow("32.17.2012 - Invalid") << dateTime << false;
186 }
190 }
187
191
188 void tst_QDateTimeAxis::min_raw()
192 void tst_QDateTimeAxis::min_raw()
189 {
193 {
190 QFETCH(QDateTime, min);
194 QFETCH(QDateTime, min);
191 QFETCH(bool, valid);
195 QFETCH(bool, valid);
192
196
193 QSignalSpy spy0(m_dateTimeAxisX, SIGNAL(maxChanged(QDateTime)));
197 QSignalSpy spy0(m_dateTimeAxisX, SIGNAL(maxChanged(QDateTime)));
194 QSignalSpy spy1(m_dateTimeAxisX, SIGNAL(minChanged(QDateTime)));
198 QSignalSpy spy1(m_dateTimeAxisX, SIGNAL(minChanged(QDateTime)));
195 QSignalSpy spy2(m_dateTimeAxisX, SIGNAL(rangeChanged(QDateTime,QDateTime)));
199 QSignalSpy spy2(m_dateTimeAxisX, SIGNAL(rangeChanged(QDateTime,QDateTime)));
196
200
197 m_dateTimeAxisX->setMin(min);
201 m_dateTimeAxisX->setMin(min);
198
202
199 if (valid) {
203 if (valid) {
200 QVERIFY2(m_dateTimeAxisX->min() == min, "Not equal");
204 QVERIFY2(m_dateTimeAxisX->min() == min, "Not equal");
201 QCOMPARE(spy0.count(), 0);
205 QCOMPARE(spy0.count(), 0);
202 QCOMPARE(spy1.count(), 1);
206 QCOMPARE(spy1.count(), 1);
203 QCOMPARE(spy2.count(), 1);
207 QCOMPARE(spy2.count(), 1);
204 } else {
208 } else {
205 QVERIFY2(m_dateTimeAxisX->min() != min, "Date is invalid and should not be set");
209 QVERIFY2(m_dateTimeAxisX->min() != min, "Date is invalid and should not be set");
206 QCOMPARE(spy0.count(), 0);
210 QCOMPARE(spy0.count(), 0);
207 QCOMPARE(spy1.count(), 0);
211 QCOMPARE(spy1.count(), 0);
208 QCOMPARE(spy2.count(), 0);
212 QCOMPARE(spy2.count(), 0);
209 }
213 }
210 }
214 }
211
215
212 void tst_QDateTimeAxis::min_data()
216 void tst_QDateTimeAxis::min_data()
213 {
217 {
214 min_raw_data();
218 min_raw_data();
215 }
219 }
216
220
217 void tst_QDateTimeAxis::min()
221 void tst_QDateTimeAxis::min()
218 {
222 {
219 // m_chart->setAxisX(m_dateTimeAxisX, m_series);
223 // m_chart->setAxisX(m_dateTimeAxisX, m_series);
220 m_view->show();
224 m_view->show();
221 QTest::qWaitForWindowShown(m_view);
225 QTest::qWaitForWindowShown(m_view);
222 min_raw();
226 min_raw();
223 }
227 }
224
228
225 void tst_QDateTimeAxis::min_animation_data()
229 void tst_QDateTimeAxis::min_animation_data()
226 {
230 {
227 min_data();
231 min_data();
228 }
232 }
229
233
230 void tst_QDateTimeAxis::min_animation()
234 void tst_QDateTimeAxis::min_animation()
231 {
235 {
232 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
236 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
233 min();
237 min();
234 }
238 }
235
239
236 void tst_QDateTimeAxis::range_raw_data()
240 void tst_QDateTimeAxis::range_raw_data()
237 {
241 {
238 QTest::addColumn<QDateTime>("min");
242 QTest::addColumn<QDateTime>("min");
239 QTest::addColumn<bool>("minValid");
243 QTest::addColumn<bool>("minValid");
240 QTest::addColumn<QDateTime>("max");
244 QTest::addColumn<QDateTime>("max");
241 QTest::addColumn<bool>("maxValid");
245 QTest::addColumn<bool>("maxValid");
242
246
243 QDateTime minDateTime;
247 QDateTime minDateTime;
244 QDateTime maxDateTime;
248 QDateTime maxDateTime;
245 minDateTime.setDate(QDate(1908, 1, 11));
249 minDateTime.setDate(QDate(1908, 1, 11));
246 maxDateTime.setDate(QDate(1958, 11, 21));
250 maxDateTime.setDate(QDate(1958, 11, 21));
247 QTest::newRow("11.1.1908 - min valid, 21.12.1958 - max valid") << minDateTime << true << maxDateTime << true; // negative MSecs from Epoch, min < max
251 QTest::newRow("11.1.1908 - min valid, 21.12.1958 - max valid") << minDateTime << true << maxDateTime << true; // negative MSecs from Epoch, min < max
248
252
249 minDateTime.setDate(QDate(2012, 17, 32));
253 minDateTime.setDate(QDate(2012, 17, 32));
250 QTest::newRow("32.17.2012 - min invalid, 21.12.1958 - max valid") << minDateTime << false << maxDateTime << true;
254 QTest::newRow("32.17.2012 - min invalid, 21.12.1958 - max valid") << minDateTime << false << maxDateTime << true;
251
255
252 maxDateTime.setDate(QDate(2017, 0, 1));
256 maxDateTime.setDate(QDate(2017, 0, 1));
253 QTest::newRow("32.17.2012 - min invalid, 1.0.2017 - max invalid") << minDateTime << false << maxDateTime << false;
257 QTest::newRow("32.17.2012 - min invalid, 1.0.2017 - max invalid") << minDateTime << false << maxDateTime << false;
254
258
255 minDateTime.setDate(QDate(2012, 1, 1));
259 minDateTime.setDate(QDate(2012, 1, 1));
256 QTest::newRow("1.1.2012 - min valid, 1.0.2017 - max invalid") << minDateTime << true << maxDateTime << false;
260 QTest::newRow("1.1.2012 - min valid, 1.0.2017 - max invalid") << minDateTime << true << maxDateTime << false;
257
261
258 maxDateTime.setDate(QDate(2005, 2, 5));
262 maxDateTime.setDate(QDate(2005, 2, 5));
259 QTest::newRow("1.1.2012 - min valid, 5.2.2005 - max valid") << minDateTime << true << maxDateTime << true; // min > max
263 QTest::newRow("1.1.2012 - min valid, 5.2.2005 - max valid") << minDateTime << true << maxDateTime << true; // min > max
260 }
264 }
261
265
262 void tst_QDateTimeAxis::range_raw()
266 void tst_QDateTimeAxis::range_raw()
263 {
267 {
264 QFETCH(QDateTime, min);
268 QFETCH(QDateTime, min);
265 QFETCH(bool, minValid);
269 QFETCH(bool, minValid);
266 QFETCH(QDateTime, max);
270 QFETCH(QDateTime, max);
267 QFETCH(bool, maxValid);
271 QFETCH(bool, maxValid);
268
272
269 QSignalSpy spy0(m_dateTimeAxisX, SIGNAL(maxChanged(QDateTime)));
273 QSignalSpy spy0(m_dateTimeAxisX, SIGNAL(maxChanged(QDateTime)));
270 QSignalSpy spy1(m_dateTimeAxisX, SIGNAL(minChanged(QDateTime)));
274 QSignalSpy spy1(m_dateTimeAxisX, SIGNAL(minChanged(QDateTime)));
271 QSignalSpy spy2(m_dateTimeAxisX, SIGNAL(rangeChanged(QDateTime,QDateTime)));
275 QSignalSpy spy2(m_dateTimeAxisX, SIGNAL(rangeChanged(QDateTime,QDateTime)));
272
276
273 m_dateTimeAxisX->setRange(min, max);
277 m_dateTimeAxisX->setRange(min, max);
274
278
275 if (minValid && maxValid && min < max) {
279 if (minValid && maxValid && min < max) {
276 QCOMPARE(spy0.count(), 1);
280 QCOMPARE(spy0.count(), 1);
277 QCOMPARE(spy1.count(), 1);
281 QCOMPARE(spy1.count(), 1);
278 QCOMPARE(spy2.count(), 1);
282 QCOMPARE(spy2.count(), 1);
279 } else {
283 } else {
280 QCOMPARE(spy0.count(), 0);
284 QCOMPARE(spy0.count(), 0);
281 QCOMPARE(spy1.count(), 0);
285 QCOMPARE(spy1.count(), 0);
282 QCOMPARE(spy2.count(), 0);
286 QCOMPARE(spy2.count(), 0);
283 }
287 }
284 }
288 }
285
289
286 void tst_QDateTimeAxis::range_data()
290 void tst_QDateTimeAxis::range_data()
287 {
291 {
288 range_raw_data();
292 range_raw_data();
289 }
293 }
290
294
291 void tst_QDateTimeAxis::range()
295 void tst_QDateTimeAxis::range()
292 {
296 {
293 // m_chart->setAxisX(m_dateTimeAxisX, m_series);
297 // m_chart->setAxisX(m_dateTimeAxisX, m_series);
294 m_view->show();
298 m_view->show();
295 QTest::qWaitForWindowShown(m_view);
299 QTest::qWaitForWindowShown(m_view);
296 range_raw();
300 range_raw();
297 }
301 }
298
302
299 void tst_QDateTimeAxis::range_animation_data()
303 void tst_QDateTimeAxis::range_animation_data()
300 {
304 {
301 range_data();
305 range_data();
302 }
306 }
303
307
304 void tst_QDateTimeAxis::range_animation()
308 void tst_QDateTimeAxis::range_animation()
305 {
309 {
306 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
310 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
307 range();
311 range();
308 }
312 }
309
313
314 void tst_QDateTimeAxis::reverse()
315 {
316 QSignalSpy spy(m_dateTimeAxisX, SIGNAL(reverseChanged(bool)));
317 QCOMPARE(m_dateTimeAxisX->isReverse(), false);
318
319 m_dateTimeAxisX->setReverse();
320 QCOMPARE(m_dateTimeAxisX->isReverse(), true);
321 QCOMPARE(spy.count(), 1);
322
323 m_view->show();
324 QTest::qWaitForWindowShown(m_view);
325 QCOMPARE(m_dateTimeAxisX->isReverse(), true);
326 }
327
310 QTEST_MAIN(tst_QDateTimeAxis)
328 QTEST_MAIN(tst_QDateTimeAxis)
311 #include "tst_qdatetimeaxis.moc"
329 #include "tst_qdatetimeaxis.moc"
312
330
@@ -1,386 +1,401
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include "../qabstractaxis/tst_qabstractaxis.h"
19 #include "../qabstractaxis/tst_qabstractaxis.h"
20 #include <QtCharts/QLogValueAxis>
20 #include <QtCharts/QLogValueAxis>
21 #include <QtCharts/QLineSeries>
21 #include <QtCharts/QLineSeries>
22 #include <QtCore/QDebug>
22 #include <QtCore/QDebug>
23
23
24 class tst_QLogValueAxis: public tst_QAbstractAxis
24 class tst_QLogValueAxis: public tst_QAbstractAxis
25 {
25 {
26 Q_OBJECT
26 Q_OBJECT
27
27
28 public slots:
28 public slots:
29 void initTestCase();
29 void initTestCase();
30 void cleanupTestCase();
30 void cleanupTestCase();
31 void init();
31 void init();
32 void cleanup();
32 void cleanup();
33
33
34 private slots:
34 private slots:
35 void qlogvalueaxis_data();
35 void qlogvalueaxis_data();
36 void qlogvalueaxis();
36 void qlogvalueaxis();
37 void max_raw_data();
37 void max_raw_data();
38 void max_raw();
38 void max_raw();
39 void max_data();
39 void max_data();
40 void max();
40 void max();
41 void max_animation_data();
41 void max_animation_data();
42 void max_animation();
42 void max_animation();
43 void min_raw_data();
43 void min_raw_data();
44 void min_raw();
44 void min_raw();
45 void min_data();
45 void min_data();
46 void min();
46 void min();
47 void min_animation_data();
47 void min_animation_data();
48 void min_animation();
48 void min_animation();
49 void range_raw_data();
49 void range_raw_data();
50 void range_raw();
50 void range_raw();
51 void range_data();
51 void range_data();
52 void range();
52 void range();
53 void range_animation_data();
53 void range_animation_data();
54 void range_animation();
54 void range_animation();
55 void noautoscale_data();
55 void noautoscale_data();
56 void noautoscale();
56 void noautoscale();
57 void autoscale_data();
57 void autoscale_data();
58 void autoscale();
58 void autoscale();
59 void zoom();
59 void zoom();
60 void reverse();
60
61
61 private:
62 private:
62 QLogValueAxis* m_logvaluesaxis;
63 QLogValueAxis* m_logvaluesaxis;
63 QLineSeries* m_series;
64 QLineSeries* m_series;
64 };
65 };
65
66
66 void tst_QLogValueAxis::initTestCase()
67 void tst_QLogValueAxis::initTestCase()
67 {
68 {
68 }
69 }
69
70
70 void tst_QLogValueAxis::cleanupTestCase()
71 void tst_QLogValueAxis::cleanupTestCase()
71 {
72 {
72 QTest::qWait(1); // Allow final deleteLaters to run
73 QTest::qWait(1); // Allow final deleteLaters to run
73 }
74 }
74
75
75 void tst_QLogValueAxis::init()
76 void tst_QLogValueAxis::init()
76 {
77 {
77 m_logvaluesaxis = new QLogValueAxis();
78 m_logvaluesaxis = new QLogValueAxis();
78 m_series = new QLineSeries();
79 m_series = new QLineSeries();
79 *m_series << QPointF(1, 1) << QPointF(100, 100);
80 *m_series << QPointF(1, 1) << QPointF(100, 100);
80 tst_QAbstractAxis::init(m_logvaluesaxis,m_series);
81 tst_QAbstractAxis::init(m_logvaluesaxis,m_series);
81 m_chart->addSeries(m_series);
82 m_chart->addSeries(m_series);
82 m_chart->createDefaultAxes();
83 m_chart->createDefaultAxes();
83 }
84 }
84
85
85 void tst_QLogValueAxis::cleanup()
86 void tst_QLogValueAxis::cleanup()
86 {
87 {
87 delete m_series;
88 delete m_series;
88 delete m_logvaluesaxis;
89 delete m_logvaluesaxis;
89 m_series = 0;
90 m_series = 0;
90 m_logvaluesaxis = 0;
91 m_logvaluesaxis = 0;
91 tst_QAbstractAxis::cleanup();
92 tst_QAbstractAxis::cleanup();
92 }
93 }
93
94
94 void tst_QLogValueAxis::qlogvalueaxis_data()
95 void tst_QLogValueAxis::qlogvalueaxis_data()
95 {
96 {
96 }
97 }
97
98
98 void tst_QLogValueAxis::qlogvalueaxis()
99 void tst_QLogValueAxis::qlogvalueaxis()
99 {
100 {
100 qabstractaxis();
101 qabstractaxis();
101
102
102 QCOMPARE(m_logvaluesaxis->max(), (qreal)1);
103 QCOMPARE(m_logvaluesaxis->max(), (qreal)1);
103 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
104 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
104 QCOMPARE(m_logvaluesaxis->type(), QAbstractAxis::AxisTypeLogValue);
105 QCOMPARE(m_logvaluesaxis->type(), QAbstractAxis::AxisTypeLogValue);
105
106
106 m_chart->setAxisX(m_logvaluesaxis, m_series);
107 m_chart->setAxisX(m_logvaluesaxis, m_series);
107 m_view->show();
108 m_view->show();
108 QTest::qWaitForWindowShown(m_view);
109 QTest::qWaitForWindowShown(m_view);
109
110
110 QCOMPARE(m_logvaluesaxis->max(), (qreal)100);
111 QCOMPARE(m_logvaluesaxis->max(), (qreal)100);
111 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
112 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
113
114 QCOMPARE(m_logvaluesaxis->isReverse(), false);
112 }
115 }
113
116
114 void tst_QLogValueAxis::max_raw_data()
117 void tst_QLogValueAxis::max_raw_data()
115 {
118 {
116 QTest::addColumn<qreal>("max");
119 QTest::addColumn<qreal>("max");
117 QTest::addColumn<qreal>("expected");
120 QTest::addColumn<qreal>("expected");
118 QTest::addColumn<bool>("minChanged");
121 QTest::addColumn<bool>("minChanged");
119 QTest::addColumn<bool>("maxChanged");
122 QTest::addColumn<bool>("maxChanged");
120 QTest::newRow("-1.0") << (qreal)-1.0 << (qreal)1.0 << false << false;
123 QTest::newRow("-1.0") << (qreal)-1.0 << (qreal)1.0 << false << false;
121 QTest::newRow("0.0") << (qreal)0.0 << (qreal)1.0 << false << false;
124 QTest::newRow("0.0") << (qreal)0.0 << (qreal)1.0 << false << false;
122 QTest::newRow("0.5") << (qreal)0.5 << (qreal)0.5 << true << true;
125 QTest::newRow("0.5") << (qreal)0.5 << (qreal)0.5 << true << true;
123 QTest::newRow("101.0") << (qreal)101.0 << (qreal)101.0 << false << true;
126 QTest::newRow("101.0") << (qreal)101.0 << (qreal)101.0 << false << true;
124 }
127 }
125
128
126 void tst_QLogValueAxis::max_raw()
129 void tst_QLogValueAxis::max_raw()
127 {
130 {
128 QFETCH(qreal, max);
131 QFETCH(qreal, max);
129 QFETCH(qreal, expected);
132 QFETCH(qreal, expected);
130 QFETCH(bool, minChanged);
133 QFETCH(bool, minChanged);
131 QFETCH(bool, maxChanged);
134 QFETCH(bool, maxChanged);
132
135
133 // setting the axis in max() changes the max to value other than 1
136 // setting the axis in max() changes the max to value other than 1
134 // set it back to 1
137 // set it back to 1
135 m_logvaluesaxis->setMax((qreal)1);
138 m_logvaluesaxis->setMax((qreal)1);
136
139
137 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
140 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
138 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
141 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
139 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
142 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
140
143
141 m_logvaluesaxis->setMax(max);
144 m_logvaluesaxis->setMax(max);
142 QCOMPARE(m_logvaluesaxis->max(), expected);
145 QCOMPARE(m_logvaluesaxis->max(), expected);
143
146
144 QCOMPARE(spy0.count(), (int)maxChanged);
147 QCOMPARE(spy0.count(), (int)maxChanged);
145 QCOMPARE(spy1.count(), (int)minChanged);
148 QCOMPARE(spy1.count(), (int)minChanged);
146 QCOMPARE(spy2.count(), (int)maxChanged);
149 QCOMPARE(spy2.count(), (int)maxChanged);
147
150
148 }
151 }
149
152
150 void tst_QLogValueAxis::max_data()
153 void tst_QLogValueAxis::max_data()
151 {
154 {
152 max_raw_data();
155 max_raw_data();
153 }
156 }
154
157
155 void tst_QLogValueAxis::max()
158 void tst_QLogValueAxis::max()
156 {
159 {
157 m_chart->setAxisX(m_logvaluesaxis, m_series);
160 m_chart->setAxisX(m_logvaluesaxis, m_series);
158 m_view->show();
161 m_view->show();
159 QTest::qWaitForWindowShown(m_view);
162 QTest::qWaitForWindowShown(m_view);
160 max_raw();
163 max_raw();
161 }
164 }
162
165
163 void tst_QLogValueAxis::max_animation_data()
166 void tst_QLogValueAxis::max_animation_data()
164 {
167 {
165 max_data();
168 max_data();
166 }
169 }
167
170
168 void tst_QLogValueAxis::max_animation()
171 void tst_QLogValueAxis::max_animation()
169 {
172 {
170 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
173 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
171 max();
174 max();
172 }
175 }
173
176
174 void tst_QLogValueAxis::min_raw_data()
177 void tst_QLogValueAxis::min_raw_data()
175 {
178 {
176 QTest::addColumn<qreal>("min");
179 QTest::addColumn<qreal>("min");
177 QTest::addColumn<qreal>("expected");
180 QTest::addColumn<qreal>("expected");
178 QTest::addColumn<bool>("minChanged");
181 QTest::addColumn<bool>("minChanged");
179 QTest::addColumn<bool>("maxChanged");
182 QTest::addColumn<bool>("maxChanged");
180 QTest::newRow("-1.0") << (qreal)-1.0 << (qreal)1.0 << false << false;
183 QTest::newRow("-1.0") << (qreal)-1.0 << (qreal)1.0 << false << false;
181 QTest::newRow("0.0") << (qreal)0.0 << (qreal)1.0 << false << false;
184 QTest::newRow("0.0") << (qreal)0.0 << (qreal)1.0 << false << false;
182 QTest::newRow("0.5") << (qreal)0.5 << (qreal)0.5 << true << false;
185 QTest::newRow("0.5") << (qreal)0.5 << (qreal)0.5 << true << false;
183 QTest::newRow("101.0") << (qreal)101.0 << (qreal)101.0 << true << true;
186 QTest::newRow("101.0") << (qreal)101.0 << (qreal)101.0 << true << true;
184 }
187 }
185
188
186 void tst_QLogValueAxis::min_raw()
189 void tst_QLogValueAxis::min_raw()
187 {
190 {
188 QFETCH(qreal, min);
191 QFETCH(qreal, min);
189 QFETCH(qreal, expected);
192 QFETCH(qreal, expected);
190 QFETCH(bool, minChanged);
193 QFETCH(bool, minChanged);
191 QFETCH(bool, maxChanged);
194 QFETCH(bool, maxChanged);
192
195
193 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
196 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
194 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
197 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
195 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
198 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
196
199
197 m_logvaluesaxis->setMin(min);
200 m_logvaluesaxis->setMin(min);
198 QCOMPARE(m_logvaluesaxis->min(), expected);
201 QCOMPARE(m_logvaluesaxis->min(), expected);
199
202
200 QCOMPARE(spy0.count(), (int)maxChanged);
203 QCOMPARE(spy0.count(), (int)maxChanged);
201 QCOMPARE(spy1.count(), (int)minChanged);
204 QCOMPARE(spy1.count(), (int)minChanged);
202 QCOMPARE(spy2.count(), (int)minChanged);
205 QCOMPARE(spy2.count(), (int)minChanged);
203 }
206 }
204
207
205 void tst_QLogValueAxis::min_data()
208 void tst_QLogValueAxis::min_data()
206 {
209 {
207 min_raw_data();
210 min_raw_data();
208 }
211 }
209
212
210 void tst_QLogValueAxis::min()
213 void tst_QLogValueAxis::min()
211 {
214 {
212 m_chart->setAxisX(m_logvaluesaxis, m_series);
215 m_chart->setAxisX(m_logvaluesaxis, m_series);
213 m_view->show();
216 m_view->show();
214 QTest::qWaitForWindowShown(m_view);
217 QTest::qWaitForWindowShown(m_view);
215 min_raw();
218 min_raw();
216 }
219 }
217
220
218 void tst_QLogValueAxis::min_animation_data()
221 void tst_QLogValueAxis::min_animation_data()
219 {
222 {
220 min_data();
223 min_data();
221 }
224 }
222
225
223 void tst_QLogValueAxis::min_animation()
226 void tst_QLogValueAxis::min_animation()
224 {
227 {
225 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
228 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
226 min();
229 min();
227 }
230 }
228
231
229 void tst_QLogValueAxis::range_raw_data()
232 void tst_QLogValueAxis::range_raw_data()
230 {
233 {
231 QTest::addColumn<qreal>("min");
234 QTest::addColumn<qreal>("min");
232 QTest::addColumn<qreal>("max");
235 QTest::addColumn<qreal>("max");
233 QTest::addColumn<qreal>("expectedMin");
236 QTest::addColumn<qreal>("expectedMin");
234 QTest::addColumn<qreal>("expectedMax");
237 QTest::addColumn<qreal>("expectedMax");
235 QTest::addColumn<bool>("minChanged");
238 QTest::addColumn<bool>("minChanged");
236 QTest::addColumn<bool>("maxChanged");
239 QTest::addColumn<bool>("maxChanged");
237 QTest::newRow("-1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0 << (qreal)1.0 << (qreal)1.0 << false << false;
240 QTest::newRow("-1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0 << (qreal)1.0 << (qreal)1.0 << false << false;
238 QTest::newRow("1.0 - 101.0") << (qreal)1.0 << (qreal)101.0 << (qreal)1.0 << (qreal)101.0 << false << true;
241 QTest::newRow("1.0 - 101.0") << (qreal)1.0 << (qreal)101.0 << (qreal)1.0 << (qreal)101.0 << false << true;
239 QTest::newRow("0.1 - 1.0") << (qreal)0.1 << (qreal)1.0 << (qreal)0.1 << (qreal)1.0 << true << false;
242 QTest::newRow("0.1 - 1.0") << (qreal)0.1 << (qreal)1.0 << (qreal)0.1 << (qreal)1.0 << true << false;
240 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0 << (qreal)25.0 << (qreal)75.0 << true << true;
243 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0 << (qreal)25.0 << (qreal)75.0 << true << true;
241 QTest::newRow("10.0 - 5.0") << (qreal)10.0 << (qreal)5.0 << (qreal)1.0 << (qreal)1.0 << false << false;
244 QTest::newRow("10.0 - 5.0") << (qreal)10.0 << (qreal)5.0 << (qreal)1.0 << (qreal)1.0 << false << false;
242 }
245 }
243
246
244 void tst_QLogValueAxis::range_raw()
247 void tst_QLogValueAxis::range_raw()
245 {
248 {
246 QFETCH(qreal, min);
249 QFETCH(qreal, min);
247 QFETCH(qreal, max);
250 QFETCH(qreal, max);
248 QFETCH(qreal, expectedMin);
251 QFETCH(qreal, expectedMin);
249 QFETCH(qreal, expectedMax);
252 QFETCH(qreal, expectedMax);
250 QFETCH(bool, minChanged);
253 QFETCH(bool, minChanged);
251 QFETCH(bool, maxChanged);
254 QFETCH(bool, maxChanged);
252
255
253 m_logvaluesaxis->setRange((qreal)1, (qreal)1);
256 m_logvaluesaxis->setRange((qreal)1, (qreal)1);
254
257
255 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
258 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
256 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
259 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
257 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
260 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
258
261
259 m_logvaluesaxis->setRange(min, max);
262 m_logvaluesaxis->setRange(min, max);
260 QCOMPARE(m_logvaluesaxis->min(), expectedMin);
263 QCOMPARE(m_logvaluesaxis->min(), expectedMin);
261 QCOMPARE(m_logvaluesaxis->max(), expectedMax);
264 QCOMPARE(m_logvaluesaxis->max(), expectedMax);
262
265
263 QCOMPARE(spy0.count(), (int)maxChanged);
266 QCOMPARE(spy0.count(), (int)maxChanged);
264 QCOMPARE(spy1.count(), (int)minChanged);
267 QCOMPARE(spy1.count(), (int)minChanged);
265 QCOMPARE(spy2.count(), (int)(minChanged || maxChanged));
268 QCOMPARE(spy2.count(), (int)(minChanged || maxChanged));
266 }
269 }
267
270
268 void tst_QLogValueAxis::range_data()
271 void tst_QLogValueAxis::range_data()
269 {
272 {
270 range_raw_data();
273 range_raw_data();
271 }
274 }
272
275
273 void tst_QLogValueAxis::range()
276 void tst_QLogValueAxis::range()
274 {
277 {
275 m_chart->setAxisX(m_logvaluesaxis, m_series);
278 m_chart->setAxisX(m_logvaluesaxis, m_series);
276 m_view->show();
279 m_view->show();
277 QTest::qWaitForWindowShown(m_view);
280 QTest::qWaitForWindowShown(m_view);
278 range_raw();
281 range_raw();
279 }
282 }
280
283
281 void tst_QLogValueAxis::range_animation_data()
284 void tst_QLogValueAxis::range_animation_data()
282 {
285 {
283 range_data();
286 range_data();
284 }
287 }
285
288
286 void tst_QLogValueAxis::range_animation()
289 void tst_QLogValueAxis::range_animation()
287 {
290 {
288 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
291 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
289 range();
292 range();
290 }
293 }
291
294
292 void tst_QLogValueAxis::noautoscale_data()
295 void tst_QLogValueAxis::noautoscale_data()
293 {
296 {
294 QTest::addColumn<qreal>("min");
297 QTest::addColumn<qreal>("min");
295 QTest::addColumn<qreal>("max");
298 QTest::addColumn<qreal>("max");
296 QTest::newRow("0.1 - 101.0") << (qreal)0.1 << (qreal)101.0;
299 QTest::newRow("0.1 - 101.0") << (qreal)0.1 << (qreal)101.0;
297 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
300 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
298 }
301 }
299
302
300 void tst_QLogValueAxis::noautoscale()
303 void tst_QLogValueAxis::noautoscale()
301 {
304 {
302 QFETCH(qreal, min);
305 QFETCH(qreal, min);
303 QFETCH(qreal, max);
306 QFETCH(qreal, max);
304
307
305 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
308 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
306 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
309 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
307 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
310 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
308
311
309 m_logvaluesaxis->setRange(min, max);
312 m_logvaluesaxis->setRange(min, max);
310 QCOMPARE(m_logvaluesaxis->min(), min);
313 QCOMPARE(m_logvaluesaxis->min(), min);
311 QCOMPARE(m_logvaluesaxis->max(), max);
314 QCOMPARE(m_logvaluesaxis->max(), max);
312
315
313 QCOMPARE(spy0.count(), 1);
316 QCOMPARE(spy0.count(), 1);
314 QCOMPARE(spy1.count(), 1);
317 QCOMPARE(spy1.count(), 1);
315 QCOMPARE(spy2.count(), 1);
318 QCOMPARE(spy2.count(), 1);
316
317 m_chart->setAxisX(m_logvaluesaxis, m_series);
318 m_view->show();
319 m_view->show();
319 QTest::qWaitForWindowShown(m_view);
320 QTest::qWaitForWindowShown(m_view);
320 QCOMPARE(m_logvaluesaxis->min(), min);
321 QCOMPARE(m_logvaluesaxis->min(), min);
321 QCOMPARE(m_logvaluesaxis->max(), max);
322 QCOMPARE(m_logvaluesaxis->max(), max);
322 }
323 }
323
324
324 void tst_QLogValueAxis::autoscale_data()
325 void tst_QLogValueAxis::autoscale_data()
325 {
326 {
326
327
327 }
328 }
328
329
329 void tst_QLogValueAxis::autoscale()
330 void tst_QLogValueAxis::autoscale()
330 {
331 {
331 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
332 QSignalSpy spy0(m_logvaluesaxis, SIGNAL(maxChanged(qreal)));
332 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
333 QSignalSpy spy1(m_logvaluesaxis, SIGNAL(minChanged(qreal)));
333 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
334 QSignalSpy spy2(m_logvaluesaxis, SIGNAL(rangeChanged(qreal,qreal)));
334
335
335 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
336 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
336 QCOMPARE(m_logvaluesaxis->max(), (qreal)1);
337 QCOMPARE(m_logvaluesaxis->max(), (qreal)1);
337 m_chart->setAxisX(m_logvaluesaxis, m_series);
338 m_chart->setAxisX(m_logvaluesaxis, m_series);
338
339
339 QCOMPARE(spy0.count(), 1);
340 QCOMPARE(spy0.count(), 1);
340 QCOMPARE(spy1.count(), 0);
341 QCOMPARE(spy1.count(), 0);
341 QCOMPARE(spy2.count(), 1);
342 QCOMPARE(spy2.count(), 1);
342
343
343 m_view->show();
344 m_view->show();
344 QTest::qWaitForWindowShown(m_view);
345 QTest::qWaitForWindowShown(m_view);
345 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
346 QCOMPARE(m_logvaluesaxis->min(), (qreal)1);
346 QCOMPARE(m_logvaluesaxis->max(), (qreal)100);
347 QCOMPARE(m_logvaluesaxis->max(), (qreal)100);
347 }
348 }
348
349
349 void tst_QLogValueAxis::zoom()
350 void tst_QLogValueAxis::zoom()
350 {
351 {
351 m_chart->setAxisX(m_logvaluesaxis, m_series);
352 m_chart->setAxisX(m_logvaluesaxis, m_series);
352 m_view->show();
353 m_view->show();
353 QTest::qWaitForWindowShown(m_view);
354 QTest::qWaitForWindowShown(m_view);
354 m_logvaluesaxis->setBase(2);
355 m_logvaluesaxis->setBase(2);
355 m_logvaluesaxis->setRange(0.5, 2);
356 m_logvaluesaxis->setRange(0.5, 2);
356
357
357 QCOMPARE(m_logvaluesaxis->min(), (qreal)0.5);
358 QCOMPARE(m_logvaluesaxis->min(), (qreal)0.5);
358 QCOMPARE(m_logvaluesaxis->max(), (qreal)2.0);
359 QCOMPARE(m_logvaluesaxis->max(), (qreal)2.0);
359
360
360 m_chart->zoomOut();
361 m_chart->zoomOut();
361
362
362 QCOMPARE(m_logvaluesaxis->min(), (qreal)0.25);
363 QCOMPARE(m_logvaluesaxis->min(), (qreal)0.25);
363 QCOMPARE(m_logvaluesaxis->max(), (qreal)4.0);
364 QCOMPARE(m_logvaluesaxis->max(), (qreal)4.0);
364
365
365 m_chart->zoomIn();
366 m_chart->zoomIn();
366
367
367 QCOMPARE(m_logvaluesaxis->min(), (qreal)0.5);
368 QCOMPARE(m_logvaluesaxis->min(), (qreal)0.5);
368 QCOMPARE(m_logvaluesaxis->max(), (qreal)2.0);
369 QCOMPARE(m_logvaluesaxis->max(), (qreal)2.0);
369
370
370 m_logvaluesaxis->setRange(0.5, 1024);
371 m_logvaluesaxis->setRange(0.5, 1024);
371 m_chart->zoom(11.0);
372 m_chart->zoom(11.0);
372
373
373 QCOMPARE(m_logvaluesaxis->min(), (qreal)16.0);
374 QCOMPARE(m_logvaluesaxis->min(), (qreal)16.0);
374 QCOMPARE(m_logvaluesaxis->max(), (qreal)32.0);
375 QCOMPARE(m_logvaluesaxis->max(), (qreal)32.0);
375
376
376 m_logvaluesaxis->setRange(16, 64);
377 m_logvaluesaxis->setRange(16, 64);
377 m_chart->zoom(1/3.0);
378 m_chart->zoom(1/3.0);
378
379
379 QCOMPARE(m_logvaluesaxis->min(), (qreal)4);
380 QCOMPARE(m_logvaluesaxis->min(), (qreal)4);
380 QCOMPARE(m_logvaluesaxis->max(), (qreal)256.0);
381 QCOMPARE(m_logvaluesaxis->max(), (qreal)256.0);
381
382
382 }
383 }
383
384
385 void tst_QLogValueAxis::reverse()
386 {
387 QSignalSpy spy(m_logvaluesaxis, SIGNAL(reverseChanged(bool)));
388 QCOMPARE(m_logvaluesaxis->isReverse(), false);
389
390 m_logvaluesaxis->setReverse();
391 QCOMPARE(m_logvaluesaxis->isReverse(), true);
392 QCOMPARE(spy.count(), 1);
393
394 m_view->show();
395 QTest::qWaitForWindowShown(m_view);
396 QCOMPARE(m_logvaluesaxis->isReverse(), true);
397 }
398
384 QTEST_MAIN(tst_QLogValueAxis)
399 QTEST_MAIN(tst_QLogValueAxis)
385 #include "tst_qlogvalueaxis.moc"
400 #include "tst_qlogvalueaxis.moc"
386
401
@@ -1,97 +1,118
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 import QtQuick 2.0
19 import QtQuick 2.0
20 import QtTest 1.0
20 import QtTest 1.0
21 import QtCharts 2.1
21 import QtCharts 2.1
22
22
23 Rectangle {
23 Rectangle {
24 width: 400
24 width: 400
25 height: 300
25 height: 300
26
26
27 TestCase {
27 TestCase {
28 id: tc1
28 id: tc1
29 name: "tst_qml-qtquicktest CategoryAxis"
29 name: "tst_qml-qtquicktest CategoryAxis"
30 when: windowShown
30 when: windowShown
31
31
32 function test_minMax() {
32 function test_minMax() {
33 compare(lineSeries1.axisX.min, 0, "AxisX min");
33 compare(lineSeries1.axisX.min, 0, "AxisX min");
34 compare(lineSeries1.axisX.max, 10, "AxisX max");
34 compare(lineSeries1.axisX.max, 10, "AxisX max");
35 compare(lineSeries1.axisY.min, 0, "AxisY min");
35 compare(lineSeries1.axisY.min, 0, "AxisY min");
36 compare(lineSeries1.axisY.max, 10, "AxisY max");
36 compare(lineSeries1.axisY.max, 10, "AxisY max");
37 }
37 }
38
38
39 function test_categories() {
39 function test_categories() {
40 compare(lineSeries1.axisY.startValue, 0, "AxisY start value");
40 compare(lineSeries1.axisY.startValue, 0, "AxisY start value");
41 compare(lineSeries1.axisY.count, 3, "AxisY count");
41 compare(lineSeries1.axisY.count, 3, "AxisY count");
42 compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels");
42 compare(lineSeries1.axisY.categoriesLabels[0], "label0", "AxisY categories labels");
43 compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels");
43 compare(lineSeries1.axisY.categoriesLabels[1], "label1", "AxisY categories labels");
44 compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels");
44 compare(lineSeries1.axisY.categoriesLabels[2], "label2", "AxisY categories labels");
45 }
45 }
46
46
47 function test_properties() {
47 function test_properties() {
48 compare(lineSeries1.axisY.labelsPosition, CategoryAxis.AxisLabelsPositionCenter);
48 compare(lineSeries1.axisY.labelsPosition, CategoryAxis.AxisLabelsPositionCenter);
49 verify(lineSeries1.axisX.reverse == false, "AxisX reverse");
50 verify(lineSeries1.axisY.reverse == false, "AxisY reverse");
51
52 // Modify properties
53 lineSeries1.axisX.reverse = true;
54 verify(lineSeries1.axisX.reverse == true, "AxisX reverse");
55 lineSeries1.axisX.reverse = false;
56 verify(lineSeries1.axisX.reverse == false, "AxisX reverse");
49 }
57 }
50
58
51 function test_signals() {
59 function test_signals() {
52 axisLabelsPositionSpy.clear();
60 axisLabelsPositionSpy.clear();
61 reverseChangedSpy.clear();
53 lineSeries1.axisY.labelsPosition = CategoryAxis.AxisLabelsPositionOnValue;
62 lineSeries1.axisY.labelsPosition = CategoryAxis.AxisLabelsPositionOnValue;
54 compare(axisLabelsPositionSpy.count, 1, "onLabelsPositionChanged")
63 compare(axisLabelsPositionSpy.count, 1, "onLabelsPositionChanged");
64
65 lineSeries1.axisX.reverse = true;
66 compare(reverseChangedSpy.count, 1, "onReverseChanged");
67
68 // restore original values
69 lineSeries1.axisX.reverse = false;
70 compare(reverseChangedSpy.count, 2, "onReverseChanged");
55 }
71 }
56 }
72 }
57
73
58 ChartView {
74 ChartView {
59 id: chartView
75 id: chartView
60 anchors.fill: parent
76 anchors.fill: parent
61
77
62 LineSeries {
78 LineSeries {
63 id: lineSeries1
79 id: lineSeries1
64 axisX: ValueAxis {
80 axisX: ValueAxis {
65 id: axisX
81 id: axisX
66 min: 0
82 min: 0
67 max: 10
83 max: 10
68 }
84 }
69 axisY: CategoryAxis {
85 axisY: CategoryAxis {
70 id: axisY
86 id: axisY
71 min: 0
87 min: 0
72 max: 10
88 max: 10
73 startValue: 0
89 startValue: 0
74 CategoryRange {
90 CategoryRange {
75 label: "label0"
91 label: "label0"
76 endValue: 1
92 endValue: 1
77 }
93 }
78 CategoryRange {
94 CategoryRange {
79 label: "label1"
95 label: "label1"
80 endValue: 3
96 endValue: 3
81 }
97 }
82 CategoryRange {
98 CategoryRange {
83 label: "label2"
99 label: "label2"
84 endValue: 10
100 endValue: 10
85 }
101 }
86 SignalSpy {
102 SignalSpy {
87 id: axisLabelsPositionSpy
103 id: axisLabelsPositionSpy
88 target: axisY
104 target: axisY
89 signalName: "labelsPositionChanged"
105 signalName: "labelsPositionChanged"
90 }
106 }
91 }
107 }
92 XYPoint { x: -1; y: -1 }
108 XYPoint { x: -1; y: -1 }
93 XYPoint { x: 0; y: 0 }
109 XYPoint { x: 0; y: 0 }
94 XYPoint { x: 5; y: 5 }
110 XYPoint { x: 5; y: 5 }
95 }
111 }
112 SignalSpy {
113 id: reverseChangedSpy
114 target: axisX
115 signalName: "reverseChanged"
116 }
96 }
117 }
97 }
118 }
@@ -1,114 +1,132
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 import QtQuick 2.0
19 import QtQuick 2.0
20 import QtTest 1.0
20 import QtTest 1.0
21 import QtCharts 2.0
21 import QtCharts 2.0
22
22
23 Rectangle {
23 Rectangle {
24 width: 400
24 width: 400
25 height: 300
25 height: 300
26
26
27 TestCase {
27 TestCase {
28 id: tc1
28 id: tc1
29 name: "tst_qml-qtquicktest ValueAxis"
29 name: "tst_qml-qtquicktest ValueAxis"
30 when: windowShown
30 when: windowShown
31
31
32 // test functions are run in alphabetical order, the name has 'a' so that it
32 // test functions are run in alphabetical order, the name has 'a' so that it
33 // will be the first function to execute.
33 // will be the first function to execute.
34 function test_a_properties() {
34 function test_a_properties() {
35 // Default properties
35 // Default properties
36 verify(axisX.min < 0, "AxisX min");
36 verify(axisX.min < 0, "AxisX min");
37 verify(axisX.max > 0, "AxisX max");
37 verify(axisX.max > 0, "AxisX max");
38 verify(axisY.min < 0, "AxisY min");
38 verify(axisY.min < 0, "AxisY min");
39 verify(axisY.max > 0, "AxisY max");
39 verify(axisY.max > 0, "AxisY max");
40 verify(axisX.tickCount == 5, "AxisX tick count");
40 verify(axisX.tickCount == 5, "AxisX tick count");
41 verify(axisY.tickCount == 5, "AxisY tick count");
41 verify(axisY.tickCount == 5, "AxisY tick count");
42 verify(axisX.labelFormat == "", "label format");
42 verify(axisX.labelFormat == "", "label format");
43 verify(axisX.reverse == false, "AxisX reverse");
44 verify(axisY.reverse == false, "AxisY reverse");
43
45
44 // Modify properties
46 // Modify properties
45 axisX.tickCount = 3;
47 axisX.tickCount = 3;
46 verify(axisX.tickCount == 3, "set tick count");
48 verify(axisX.tickCount == 3, "set tick count");
49 axisX.reverse = true;
50 verify(axisX.reverse == true, "AxisX reverse");
51 axisX.reverse = false;
52 verify(axisX.reverse == false, "AxisX reverse");
47 }
53 }
48
54
49 function test_functions() {
55 function test_functions() {
50 // Set the axis ranges to not "nice" ones...
56 // Set the axis ranges to not "nice" ones...
51 var min = 0.032456456;
57 var min = 0.032456456;
52 var max = 10.67845634;
58 var max = 10.67845634;
53 axisX.min = min;
59 axisX.min = min;
54 axisX.max = max;
60 axisX.max = max;
55 axisY.min = min;
61 axisY.min = min;
56 axisY.max = max;
62 axisY.max = max;
57
63
58 // ...And then apply nice numbers and verify the range was changed
64 // ...And then apply nice numbers and verify the range was changed
59 axisX.applyNiceNumbers();
65 axisX.applyNiceNumbers();
60 axisY.applyNiceNumbers();
66 axisY.applyNiceNumbers();
61 verify(axisX.min != min);
67 verify(axisX.min != min);
62 verify(axisX.max != max);
68 verify(axisX.max != max);
63 verify(axisY.min != min);
69 verify(axisY.min != min);
64 verify(axisY.max != max);
70 verify(axisY.max != max);
65 }
71 }
66
72
67 function test_signals() {
73 function test_signals() {
68 minChangedSpy.clear();
74 minChangedSpy.clear();
69 maxChangedSpy.clear();
75 maxChangedSpy.clear();
76 reverseChangedSpy.clear();
77
70 axisX.min = 2;
78 axisX.min = 2;
71 compare(minChangedSpy.count, 1, "onMinChanged");
79 compare(minChangedSpy.count, 1, "onMinChanged");
72 compare(maxChangedSpy.count, 0, "onMaxChanged");
80 compare(maxChangedSpy.count, 0, "onMaxChanged");
73
81
74 axisX.max = 8;
82 axisX.max = 8;
75 compare(minChangedSpy.count, 1, "onMinChanged");
83 compare(minChangedSpy.count, 1, "onMinChanged");
76 compare(maxChangedSpy.count, 1, "onMaxChanged");
84 compare(maxChangedSpy.count, 1, "onMaxChanged");
77
85
86 axisX.reverse = true;
87 compare(reverseChangedSpy.count, 1, "onReverseChanged");
88
78 // restore original values
89 // restore original values
79 axisX.min = 0;
90 axisX.min = 0;
80 axisX.max = 10;
91 axisX.max = 10;
92 axisX.reverse = false;
81 compare(minChangedSpy.count, 2, "onMinChanged");
93 compare(minChangedSpy.count, 2, "onMinChanged");
82 compare(maxChangedSpy.count, 2, "onMaxChanged");
94 compare(maxChangedSpy.count, 2, "onMaxChanged");
95 compare(reverseChangedSpy.count, 2, "onReverseChanged");
83 }
96 }
84 }
97 }
85
98
86 ChartView {
99 ChartView {
87 id: chartView
100 id: chartView
88 anchors.fill: parent
101 anchors.fill: parent
89
102
90 LineSeries {
103 LineSeries {
91 id: lineSeries1
104 id: lineSeries1
92 axisX: ValueAxis {
105 axisX: ValueAxis {
93 id: axisX
106 id: axisX
94 }
107 }
95 axisY: ValueAxis {
108 axisY: ValueAxis {
96 id: axisY
109 id: axisY
97 }
110 }
98 XYPoint { x: -1; y: -1 }
111 XYPoint { x: -1; y: -1 }
99 XYPoint { x: 0; y: 0 }
112 XYPoint { x: 0; y: 0 }
100 XYPoint { x: 5; y: 5 }
113 XYPoint { x: 5; y: 5 }
101 }
114 }
102
115
103 SignalSpy {
116 SignalSpy {
104 id: minChangedSpy
117 id: minChangedSpy
105 target: axisX
118 target: axisX
106 signalName: "minChanged"
119 signalName: "minChanged"
107 }
120 }
108 SignalSpy {
121 SignalSpy {
109 id: maxChangedSpy
122 id: maxChangedSpy
110 target: axisX
123 target: axisX
111 signalName: "maxChanged"
124 signalName: "maxChanged"
112 }
125 }
126 SignalSpy {
127 id: reverseChangedSpy
128 target: axisX
129 signalName: "reverseChanged"
130 }
113 }
131 }
114 }
132 }
@@ -1,411 +1,430
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 #include "../qabstractaxis/tst_qabstractaxis.h"
19 #include "../qabstractaxis/tst_qabstractaxis.h"
20 #include <QtCharts/QValueAxis>
20 #include <QtCharts/QValueAxis>
21 #include <QtCharts/QLineSeries>
21 #include <QtCharts/QLineSeries>
22
22
23 class tst_QValueAxis: public tst_QAbstractAxis
23 class tst_QValueAxis: public tst_QAbstractAxis
24 {
24 {
25 Q_OBJECT
25 Q_OBJECT
26
26
27 public slots:
27 public slots:
28 void initTestCase();
28 void initTestCase();
29 void cleanupTestCase();
29 void cleanupTestCase();
30 void init();
30 void init();
31 void cleanup();
31 void cleanup();
32
32
33 private slots:
33 private slots:
34 void qvalueaxis_data();
34 void qvalueaxis_data();
35 void qvalueaxis();
35 void qvalueaxis();
36 void max_raw_data();
36 void max_raw_data();
37 void max_raw();
37 void max_raw();
38 void max_data();
38 void max_data();
39 void max();
39 void max();
40 void max_animation_data();
40 void max_animation_data();
41 void max_animation();
41 void max_animation();
42 void min_raw_data();
42 void min_raw_data();
43 void min_raw();
43 void min_raw();
44 void min_data();
44 void min_data();
45 void min();
45 void min();
46 void min_animation_data();
46 void min_animation_data();
47 void min_animation();
47 void min_animation();
48 void applyNiceNumbers_data();
48 void applyNiceNumbers_data();
49 void applyNiceNumbers();
49 void applyNiceNumbers();
50 void range_raw_data();
50 void range_raw_data();
51 void range_raw();
51 void range_raw();
52 void range_data();
52 void range_data();
53 void range();
53 void range();
54 void range_animation_data();
54 void range_animation_data();
55 void range_animation();
55 void range_animation();
56 void ticksCount_data();
56 void ticksCount_data();
57 void ticksCount();
57 void ticksCount();
58 void noautoscale_data();
58 void noautoscale_data();
59 void noautoscale();
59 void noautoscale();
60 void autoscale_data();
60 void autoscale_data();
61 void autoscale();
61 void autoscale();
62 void reverse();
62
63
63 private:
64 private:
64 QValueAxis* m_valuesaxis;
65 QValueAxis* m_valuesaxis;
65 QLineSeries* m_series;
66 QLineSeries* m_series;
66 };
67 };
67
68
68 void tst_QValueAxis::initTestCase()
69 void tst_QValueAxis::initTestCase()
69 {
70 {
70 }
71 }
71
72
72 void tst_QValueAxis::cleanupTestCase()
73 void tst_QValueAxis::cleanupTestCase()
73 {
74 {
74 QTest::qWait(1); // Allow final deleteLaters to run
75 QTest::qWait(1); // Allow final deleteLaters to run
75 }
76 }
76
77
77 void tst_QValueAxis::init()
78 void tst_QValueAxis::init()
78 {
79 {
79 m_valuesaxis = new QValueAxis();
80 m_valuesaxis = new QValueAxis();
80 m_series = new QLineSeries();
81 m_series = new QLineSeries();
81 *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
82 *m_series << QPointF(-100, -100) << QPointF(0, 0) << QPointF(100, 100);
82 tst_QAbstractAxis::init(m_valuesaxis,m_series);
83 tst_QAbstractAxis::init(m_valuesaxis,m_series);
83 m_chart->addSeries(m_series);
84 m_chart->addSeries(m_series);
84 m_chart->createDefaultAxes();
85 m_chart->createDefaultAxes();
85 }
86 }
86
87
87 void tst_QValueAxis::cleanup()
88 void tst_QValueAxis::cleanup()
88 {
89 {
89 delete m_series;
90 delete m_series;
90 delete m_valuesaxis;
91 delete m_valuesaxis;
91 m_series = 0;
92 m_series = 0;
92 m_valuesaxis = 0;
93 m_valuesaxis = 0;
93 tst_QAbstractAxis::cleanup();
94 tst_QAbstractAxis::cleanup();
94 }
95 }
95
96
96 void tst_QValueAxis::qvalueaxis_data()
97 void tst_QValueAxis::qvalueaxis_data()
97 {
98 {
98 }
99 }
99
100
100 void tst_QValueAxis::qvalueaxis()
101 void tst_QValueAxis::qvalueaxis()
101 {
102 {
102 qabstractaxis();
103 qabstractaxis();
103
104
104 QVERIFY(qFuzzyCompare(m_valuesaxis->max(), 0));
105 QVERIFY(qFuzzyCompare(m_valuesaxis->max(), 0));
105 QVERIFY(qFuzzyCompare(m_valuesaxis->min(), 0));
106 QVERIFY(qFuzzyCompare(m_valuesaxis->min(), 0));
106 QCOMPARE(m_valuesaxis->tickCount(), 5);
107 QCOMPARE(m_valuesaxis->tickCount(), 5);
107 QCOMPARE(m_valuesaxis->type(), QAbstractAxis::AxisTypeValue);
108 QCOMPARE(m_valuesaxis->type(), QAbstractAxis::AxisTypeValue);
108
109
109 m_chart->setAxisX(m_valuesaxis, m_series);
110 m_chart->setAxisX(m_valuesaxis, m_series);
110 m_view->show();
111 m_view->show();
111 QTest::qWaitForWindowShown(m_view);
112 QTest::qWaitForWindowShown(m_view);
112
113
113 QVERIFY(!qFuzzyCompare(m_valuesaxis->max(), 0));
114 QVERIFY(!qFuzzyCompare(m_valuesaxis->max(), 0));
114 QVERIFY(!qFuzzyCompare(m_valuesaxis->min(), 0));
115 QVERIFY(!qFuzzyCompare(m_valuesaxis->min(), 0));
115 QCOMPARE(m_valuesaxis->tickCount(), 5);
116 QCOMPARE(m_valuesaxis->tickCount(), 5);
117
118 QCOMPARE(m_valuesaxis->isReverse(), false);
116 }
119 }
117
120
118 void tst_QValueAxis::max_raw_data()
121 void tst_QValueAxis::max_raw_data()
119 {
122 {
120 QTest::addColumn<qreal>("max");
123 QTest::addColumn<qreal>("max");
121 QTest::newRow("1.0") << (qreal)1.0;
124 QTest::newRow("1.0") << (qreal)1.0;
122 QTest::newRow("50.0") << (qreal)50.0;
125 QTest::newRow("50.0") << (qreal)50.0;
123 QTest::newRow("101.0") << (qreal)101.0;
126 QTest::newRow("101.0") << (qreal)101.0;
124 }
127 }
125
128
126 void tst_QValueAxis::max_raw()
129 void tst_QValueAxis::max_raw()
127 {
130 {
128 QFETCH(qreal, max);
131 QFETCH(qreal, max);
129
132
130 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
133 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
131 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
134 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
132 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
135 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
133
136
134 m_valuesaxis->setMax(max);
137 m_valuesaxis->setMax(max);
135 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Not equal");
138 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Not equal");
136
139
137 QCOMPARE(spy0.count(), 1);
140 QCOMPARE(spy0.count(), 1);
138 QCOMPARE(spy1.count(), 0);
141 QCOMPARE(spy1.count(), 0);
139 QCOMPARE(spy2.count(), 1);
142 QCOMPARE(spy2.count(), 1);
140
143
141 }
144 }
142
145
143 void tst_QValueAxis::max_data()
146 void tst_QValueAxis::max_data()
144 {
147 {
145 max_raw_data();
148 max_raw_data();
146 }
149 }
147
150
148 void tst_QValueAxis::max()
151 void tst_QValueAxis::max()
149 {
152 {
150 m_chart->setAxisX(m_valuesaxis, m_series);
153 m_chart->setAxisX(m_valuesaxis, m_series);
151 m_view->show();
154 m_view->show();
152 QTest::qWaitForWindowShown(m_view);
155 QTest::qWaitForWindowShown(m_view);
153 max_raw();
156 max_raw();
154 }
157 }
155
158
156 void tst_QValueAxis::max_animation_data()
159 void tst_QValueAxis::max_animation_data()
157 {
160 {
158 max_data();
161 max_data();
159 }
162 }
160
163
161 void tst_QValueAxis::max_animation()
164 void tst_QValueAxis::max_animation()
162 {
165 {
163 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
166 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
164 max();
167 max();
165 }
168 }
166
169
167 void tst_QValueAxis::min_raw_data()
170 void tst_QValueAxis::min_raw_data()
168 {
171 {
169 QTest::addColumn<qreal>("min");
172 QTest::addColumn<qreal>("min");
170 QTest::newRow("-1.0") << (qreal)-1.0;
173 QTest::newRow("-1.0") << (qreal)-1.0;
171 QTest::newRow("-50.0") << (qreal)-50.0;
174 QTest::newRow("-50.0") << (qreal)-50.0;
172 QTest::newRow("-101.0") << (qreal)-101.0;
175 QTest::newRow("-101.0") << (qreal)-101.0;
173 }
176 }
174
177
175 void tst_QValueAxis::min_raw()
178 void tst_QValueAxis::min_raw()
176 {
179 {
177 QFETCH(qreal, min);
180 QFETCH(qreal, min);
178
181
179 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
182 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
180 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
183 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
181 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
184 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
182
185
183 m_valuesaxis->setMin(min);
186 m_valuesaxis->setMin(min);
184 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Not equal");
187 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Not equal");
185
188
186 QCOMPARE(spy0.count(), 0);
189 QCOMPARE(spy0.count(), 0);
187 QCOMPARE(spy1.count(), 1);
190 QCOMPARE(spy1.count(), 1);
188 QCOMPARE(spy2.count(), 1);
191 QCOMPARE(spy2.count(), 1);
189 }
192 }
190
193
191 void tst_QValueAxis::min_data()
194 void tst_QValueAxis::min_data()
192 {
195 {
193 min_raw_data();
196 min_raw_data();
194 }
197 }
195
198
196 void tst_QValueAxis::min()
199 void tst_QValueAxis::min()
197 {
200 {
198 m_chart->setAxisX(m_valuesaxis, m_series);
201 m_chart->setAxisX(m_valuesaxis, m_series);
199 m_view->show();
202 m_view->show();
200 QTest::qWaitForWindowShown(m_view);
203 QTest::qWaitForWindowShown(m_view);
201 min_raw();
204 min_raw();
202 }
205 }
203
206
204 void tst_QValueAxis::min_animation_data()
207 void tst_QValueAxis::min_animation_data()
205 {
208 {
206 min_data();
209 min_data();
207 }
210 }
208
211
209 void tst_QValueAxis::min_animation()
212 void tst_QValueAxis::min_animation()
210 {
213 {
211 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
214 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
212 min();
215 min();
213 }
216 }
214
217
215 void tst_QValueAxis::applyNiceNumbers_data()
218 void tst_QValueAxis::applyNiceNumbers_data()
216 {
219 {
217 QTest::addColumn<bool>("niceNumbersEnabled");
220 QTest::addColumn<bool>("niceNumbersEnabled");
218 QTest::addColumn<qreal>("min");
221 QTest::addColumn<qreal>("min");
219 QTest::addColumn<qreal>("max");
222 QTest::addColumn<qreal>("max");
220 QTest::addColumn<int>("ticks");
223 QTest::addColumn<int>("ticks");
221 QTest::addColumn<qreal>("expectedMin");
224 QTest::addColumn<qreal>("expectedMin");
222 QTest::addColumn<qreal>("expectedMax");
225 QTest::addColumn<qreal>("expectedMax");
223 QTest::addColumn<int>("expectedTicks");
226 QTest::addColumn<int>("expectedTicks");
224 QTest::newRow("true 0.1 , 99.0 , 5") << true << (qreal)0.1 << (qreal)99.0 << 5 << (qreal)0.0 << (qreal)100.0 << 6;
227 QTest::newRow("true 0.1 , 99.0 , 5") << true << (qreal)0.1 << (qreal)99.0 << 5 << (qreal)0.0 << (qreal)100.0 << 6;
225 QTest::newRow("true 1 , 10.0 , 5") << true << (qreal)1.0 << (qreal)10.0 << 5 << (qreal)0.0 << (qreal)10.0 << 6;
228 QTest::newRow("true 1 , 10.0 , 5") << true << (qreal)1.0 << (qreal)10.0 << 5 << (qreal)0.0 << (qreal)10.0 << 6;
226 QTest::newRow("true 0.1 , 6.6 , 5") << true << (qreal)0.1 << (qreal)6.6 << 5 << (qreal)0.0 << (qreal)8.0 << 5;
229 QTest::newRow("true 0.1 , 6.6 , 5") << true << (qreal)0.1 << (qreal)6.6 << 5 << (qreal)0.0 << (qreal)8.0 << 5;
227 QTest::newRow("false 0.1 , 6.6 , 5") << false << (qreal)0.1 << (qreal)6.6 << 5 << (qreal)0.1 << (qreal)6.6 << 5;
230 QTest::newRow("false 0.1 , 6.6 , 5") << false << (qreal)0.1 << (qreal)6.6 << 5 << (qreal)0.1 << (qreal)6.6 << 5;
228 QTest::newRow("true 0.1, 99, 5") << true << (qreal)0.1 << (qreal)99.0 << 5 << (qreal)0.0 << (qreal)100.0 << 6;
231 QTest::newRow("true 0.1, 99, 5") << true << (qreal)0.1 << (qreal)99.0 << 5 << (qreal)0.0 << (qreal)100.0 << 6;
229 QTest::newRow("true 5, 93.5 , 5") << true << (qreal)5.0 << (qreal)93.5 << 5 << (qreal)0.0 << (qreal)100.0 << 6;
232 QTest::newRow("true 5, 93.5 , 5") << true << (qreal)5.0 << (qreal)93.5 << 5 << (qreal)0.0 << (qreal)100.0 << 6;
230 }
233 }
231
234
232 void tst_QValueAxis::applyNiceNumbers()
235 void tst_QValueAxis::applyNiceNumbers()
233 {
236 {
234 QFETCH(bool, niceNumbersEnabled);
237 QFETCH(bool, niceNumbersEnabled);
235 QFETCH(qreal, min);
238 QFETCH(qreal, min);
236 QFETCH(qreal, max);
239 QFETCH(qreal, max);
237 QFETCH(int, ticks);
240 QFETCH(int, ticks);
238 QFETCH(qreal, expectedMin);
241 QFETCH(qreal, expectedMin);
239 QFETCH(qreal, expectedMax);
242 QFETCH(qreal, expectedMax);
240 QFETCH(int, expectedTicks);
243 QFETCH(int, expectedTicks);
241
244
242 m_valuesaxis->setRange(min, max);
245 m_valuesaxis->setRange(min, max);
243 m_valuesaxis->setTickCount(ticks);
246 m_valuesaxis->setTickCount(ticks);
244
247
245 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
248 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
246 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
249 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
247
250
248 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
251 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
249 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
252 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
250 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
253 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
251
254
252 if(niceNumbersEnabled) m_valuesaxis->applyNiceNumbers();
255 if(niceNumbersEnabled) m_valuesaxis->applyNiceNumbers();
253
256
254 if(!qFuzzyCompare(expectedMin, min))
257 if(!qFuzzyCompare(expectedMin, min))
255 QCOMPARE(spy1.count(), 1);
258 QCOMPARE(spy1.count(), 1);
256 if(!qFuzzyCompare(expectedMax, max))
259 if(!qFuzzyCompare(expectedMax, max))
257 QCOMPARE(spy0.count(), 1);
260 QCOMPARE(spy0.count(), 1);
258 if((!qFuzzyCompare(expectedMin, min)) || (!qFuzzyCompare(expectedMax, max)))
261 if((!qFuzzyCompare(expectedMin, min)) || (!qFuzzyCompare(expectedMax, max)))
259 QCOMPARE(spy2.count(), 1);
262 QCOMPARE(spy2.count(), 1);
260
263
261 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), expectedMin), "Min not equal");
264 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), expectedMin), "Min not equal");
262 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), expectedMax), "Max not equal");
265 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), expectedMax), "Max not equal");
263 QCOMPARE(m_valuesaxis->tickCount(), expectedTicks);
266 QCOMPARE(m_valuesaxis->tickCount(), expectedTicks);
264
267
265 }
268 }
266
269
267 void tst_QValueAxis::range_raw_data()
270 void tst_QValueAxis::range_raw_data()
268 {
271 {
269 QTest::addColumn<qreal>("min");
272 QTest::addColumn<qreal>("min");
270 QTest::addColumn<qreal>("max");
273 QTest::addColumn<qreal>("max");
271 QTest::newRow("1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0;
274 QTest::newRow("1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0;
272 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
275 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
273 QTest::newRow("101.0") << (qreal)40.0 << (qreal)60.0;
276 QTest::newRow("101.0") << (qreal)40.0 << (qreal)60.0;
274 }
277 }
275
278
276 void tst_QValueAxis::range_raw()
279 void tst_QValueAxis::range_raw()
277 {
280 {
278 QFETCH(qreal, min);
281 QFETCH(qreal, min);
279 QFETCH(qreal, max);
282 QFETCH(qreal, max);
280
283
281 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
284 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
282 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
285 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
283 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
286 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
284
287
285 m_valuesaxis->setRange(min, max);
288 m_valuesaxis->setRange(min, max);
286 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
289 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
287 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
290 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
288
291
289 QCOMPARE(spy0.count(), 1);
292 QCOMPARE(spy0.count(), 1);
290 QCOMPARE(spy1.count(), 1);
293 QCOMPARE(spy1.count(), 1);
291 QCOMPARE(spy2.count(), 1);
294 QCOMPARE(spy2.count(), 1);
292 }
295 }
293
296
294 void tst_QValueAxis::range_data()
297 void tst_QValueAxis::range_data()
295 {
298 {
296 range_raw_data();
299 range_raw_data();
297 }
300 }
298
301
299 void tst_QValueAxis::range()
302 void tst_QValueAxis::range()
300 {
303 {
301 m_chart->setAxisX(m_valuesaxis, m_series);
304 m_chart->setAxisX(m_valuesaxis, m_series);
302 m_view->show();
305 m_view->show();
303 QTest::qWaitForWindowShown(m_view);
306 QTest::qWaitForWindowShown(m_view);
304 range_raw();
307 range_raw();
305 }
308 }
306
309
307 void tst_QValueAxis::range_animation_data()
310 void tst_QValueAxis::range_animation_data()
308 {
311 {
309 range_data();
312 range_data();
310 }
313 }
311
314
312 void tst_QValueAxis::range_animation()
315 void tst_QValueAxis::range_animation()
313 {
316 {
314 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
317 m_chart->setAnimationOptions(QChart::GridAxisAnimations);
315 range();
318 range();
316 }
319 }
317
320
318 void tst_QValueAxis::ticksCount_data()
321 void tst_QValueAxis::ticksCount_data()
319 {
322 {
320 QTest::addColumn<int>("ticksCount");
323 QTest::addColumn<int>("ticksCount");
321 QTest::addColumn<int>("expectedCount");
324 QTest::addColumn<int>("expectedCount");
322 QTest::newRow("0") << 2;
325 QTest::newRow("0") << 2;
323 QTest::newRow("1") << 2;
326 QTest::newRow("1") << 2;
324 QTest::newRow("2") << 2;
327 QTest::newRow("2") << 2;
325 QTest::newRow("3") << 3;
328 QTest::newRow("3") << 3;
326 QTest::newRow("-1") << 2;
329 QTest::newRow("-1") << 2;
327 }
330 }
328
331
329 void tst_QValueAxis::ticksCount()
332 void tst_QValueAxis::ticksCount()
330 {
333 {
331 QFETCH(int, ticksCount);
334 QFETCH(int, ticksCount);
332
335
333 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
336 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
334 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
337 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
335 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
338 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
336
339
337 m_valuesaxis->setTickCount(ticksCount);
340 m_valuesaxis->setTickCount(ticksCount);
338 QCOMPARE(m_valuesaxis->tickCount(), ticksCount);
341 QCOMPARE(m_valuesaxis->tickCount(), ticksCount);
339
342
340 QCOMPARE(spy0.count(), 0);
343 QCOMPARE(spy0.count(), 0);
341 QCOMPARE(spy1.count(), 0);
344 QCOMPARE(spy1.count(), 0);
342 QCOMPARE(spy2.count(), 0);
345 QCOMPARE(spy2.count(), 0);
343
346
344 m_chart->setAxisX(m_valuesaxis, m_series);
347 m_chart->setAxisX(m_valuesaxis, m_series);
345 m_view->show();
348 m_view->show();
346 QTest::qWaitForWindowShown(m_view);
349 QTest::qWaitForWindowShown(m_view);
347
350
348 QCOMPARE(m_valuesaxis->tickCount(), ticksCount);
351 QCOMPARE(m_valuesaxis->tickCount(), ticksCount);
349 }
352 }
350
353
351 void tst_QValueAxis::noautoscale_data()
354 void tst_QValueAxis::noautoscale_data()
352 {
355 {
353 QTest::addColumn<qreal>("min");
356 QTest::addColumn<qreal>("min");
354 QTest::addColumn<qreal>("max");
357 QTest::addColumn<qreal>("max");
355 QTest::newRow("1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0;
358 QTest::newRow("1.0 - 101.0") << (qreal)-1.0 << (qreal)101.0;
356 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
359 QTest::newRow("25.0 - 75.0") << (qreal)25.0 << (qreal)75.0;
357 QTest::newRow("101.0") << (qreal)40.0 << (qreal)60.0;
360 QTest::newRow("101.0") << (qreal)40.0 << (qreal)60.0;
358 }
361 }
359
362
360 void tst_QValueAxis::noautoscale()
363 void tst_QValueAxis::noautoscale()
361 {
364 {
362 QFETCH(qreal, min);
365 QFETCH(qreal, min);
363 QFETCH(qreal, max);
366 QFETCH(qreal, max);
364
367
365 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
368 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
366 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
369 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
367 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
370 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
368
371
369 m_valuesaxis->setRange(min, max);
372 m_valuesaxis->setRange(min, max);
370 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
373 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
371 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
374 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
372
375
373 QCOMPARE(spy0.count(), 1);
376 QCOMPARE(spy0.count(), 1);
374 QCOMPARE(spy1.count(), 1);
377 QCOMPARE(spy1.count(), 1);
375 QCOMPARE(spy2.count(), 1);
378 QCOMPARE(spy2.count(), 1);
376
379
377 m_chart->setAxisX(m_valuesaxis, m_series);
380 m_chart->setAxisX(m_valuesaxis, m_series);
378 m_view->show();
381 m_view->show();
379 QTest::qWaitForWindowShown(m_view);
382 QTest::qWaitForWindowShown(m_view);
380 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
383 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), min), "Min not equal");
381 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
384 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), max), "Max not equal");
382 }
385 }
383
386
384 void tst_QValueAxis::autoscale_data()
387 void tst_QValueAxis::autoscale_data()
385 {
388 {
386
389
387 }
390 }
388
391
389 void tst_QValueAxis::autoscale()
392 void tst_QValueAxis::autoscale()
390 {
393 {
391 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
394 QSignalSpy spy0(m_valuesaxis, SIGNAL(maxChanged(qreal)));
392 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
395 QSignalSpy spy1(m_valuesaxis, SIGNAL(minChanged(qreal)));
393 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
396 QSignalSpy spy2(m_valuesaxis, SIGNAL(rangeChanged(qreal,qreal)));
394
397
395 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), 0), "Min not equal");
398 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), 0), "Min not equal");
396 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), 0), "Max not equal");
399 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), 0), "Max not equal");
397 m_chart->setAxisX(m_valuesaxis, m_series);
400 m_chart->setAxisX(m_valuesaxis, m_series);
398
401
399 QCOMPARE(spy0.count(), 1);
402 QCOMPARE(spy0.count(), 1);
400 QCOMPARE(spy1.count(), 1);
403 QCOMPARE(spy1.count(), 1);
401 QCOMPARE(spy2.count(), 1);
404 QCOMPARE(spy2.count(), 1);
402
405
403 m_view->show();
406 m_view->show();
404 QTest::qWaitForWindowShown(m_view);
407 QTest::qWaitForWindowShown(m_view);
405 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), -100), "Min not equal");
408 QVERIFY2(qFuzzyCompare(m_valuesaxis->min(), -100), "Min not equal");
406 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), 100), "Max not equal");
409 QVERIFY2(qFuzzyCompare(m_valuesaxis->max(), 100), "Max not equal");
407 }
410 }
408
411
412 void tst_QValueAxis::reverse()
413 {
414 QSignalSpy spy(m_valuesaxis, SIGNAL(reverseChanged(bool)));
415 QCOMPARE(m_valuesaxis->isReverse(), false);
416
417 m_valuesaxis->setReverse();
418 QCOMPARE(m_valuesaxis->isReverse(), true);
419
420 m_chart->setAxisX(m_valuesaxis, m_series);
421 QCOMPARE(spy.count(), 1);
422
423 m_view->show();
424 QTest::qWaitForWindowShown(m_view);
425 QCOMPARE(m_valuesaxis->isReverse(), true);
426 }
427
409 QTEST_MAIN(tst_QValueAxis)
428 QTEST_MAIN(tst_QValueAxis)
410 #include "tst_qvalueaxis.moc"
429 #include "tst_qvalueaxis.moc"
411
430
@@ -1,73 +1,67
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 import QtQuick 2.0
19 import QtQuick 2.0
20 import QtCharts 2.0
20 import QtCharts 2.0
21
21
22 ChartView {
22 ChartView {
23 id: chartView
23 id: chartView
24 title: "chart axes"
24 title: "chart axes"
25
25
26 // TODO: Do we need a property for orientation or properties "axisX" and "axisY" on ChartView
27 // to make an axis the default axis for all series with no other axes defined...?
28 // ValueAxis {
29 // orientation: ValueAxis.AxisX
30 // min: 0
31 // max: 10
32 // }
33 // axisX: ValueAxis {
34 // min: 0
35 // max: 10
36 // }
37 // ...Now that we don't have this implementation, the following axes won't have any affect:
38 ValueAxis {
26 ValueAxis {
27 id: valueAxisX
39 min: 0
28 min: 0
40 max: 10
29 max: 10
41 }
30 }
42 ValueAxis {
31 ValueAxis {
32 id: valueAxisY
43 min: 0
33 min: 0
44 max: 5
34 max: 5
45 }
35 }
46
36
47 LineSeries {
37 LineSeries {
48 name: "line series"
38 name: "line series"
49 XYPoint { x: 0; y: 0 }
39 XYPoint { x: 0; y: 0 }
50 XYPoint { x: 1; y: 1 }
40 XYPoint { x: 1; y: 1 }
51 XYPoint { x: 2; y: 2 }
41 XYPoint { x: 2; y: 2 }
52 XYPoint { x: 3; y: 3 }
42 XYPoint { x: 3; y: 3 }
53 XYPoint { x: 4; y: 4 }
43 XYPoint { x: 4; y: 4 }
44 axisX: valueAxisX
45 axisY: valueAxisY
54 }
46 }
55
47
56 ScatterSeries {
48 ScatterSeries {
57 name: "scatter series"
49 name: "scatter series"
58 XYPoint { x: 0; y: 0 }
50 XYPoint { x: 0; y: 0 }
59 XYPoint { x: 0.5; y: 1 }
51 XYPoint { x: 0.5; y: 1 }
60 XYPoint { x: 1; y: 2 }
52 XYPoint { x: 1; y: 2 }
61 XYPoint { x: 1.5; y: 3 }
53 XYPoint { x: 1.5; y: 3 }
62 XYPoint { x: 2; y: 4 }
54 XYPoint { x: 2; y: 4 }
63 XYPoint { x: 1; y: 1 }
55 XYPoint { x: 1; y: 1 }
64 XYPoint { x: 2; y: 2 }
56 XYPoint { x: 2; y: 2 }
65 XYPoint { x: 3; y: 3 }
57 XYPoint { x: 3; y: 3 }
66 XYPoint { x: 4; y: 4 }
58 XYPoint { x: 4; y: 4 }
59 axisX: valueAxisX
60 axisY: valueAxisY
67 }
61 }
68
62
69 // Component.onCompleted: {
63 // Component.onCompleted: {
70 // // You can also set the axes dynamically
64 // // You can also set the axes dynamically
71 // chartView.setAxisX(axisX, scatter);
65 // chartView.setAxisX(axisX, scatter);
72 // }
66 // }
73 }
67 }
@@ -1,56 +1,62
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 import QtQuick 2.0
19 import QtQuick 2.0
20 import QtCharts 2.0
20 import QtCharts 2.0
21
21
22 ChartView {
22 ChartView {
23 id: chartView
23 id: chartView
24 title: "chart axes reverted"
24 title: "chart axes reverted"
25
25
26 ValueAxis {
26 ValueAxis {
27 id: valueAxisX
27 min: 0
28 min: 0
28 max: 10
29 max: 10
29 }
30 }
30 ValueAxis {
31 ValueAxis {
32 id: valueAxisY
31 min: 0
33 min: 0
32 max: 5
34 max: 5
33 }
35 }
34
36
35 ScatterSeries {
37 ScatterSeries {
36 name: "scatter series"
38 name: "scatter series"
37 XYPoint { x: 0; y: 0 }
39 XYPoint { x: 0; y: 0 }
38 XYPoint { x: 0.5; y: 1 }
40 XYPoint { x: 0.5; y: 1 }
39 XYPoint { x: 1; y: 2 }
41 XYPoint { x: 1; y: 2 }
40 XYPoint { x: 1.5; y: 3 }
42 XYPoint { x: 1.5; y: 3 }
41 XYPoint { x: 2; y: 4 }
43 XYPoint { x: 2; y: 4 }
42 XYPoint { x: 1; y: 1 }
44 XYPoint { x: 1; y: 1 }
43 XYPoint { x: 2; y: 2 }
45 XYPoint { x: 2; y: 2 }
44 XYPoint { x: 3; y: 3 }
46 XYPoint { x: 3; y: 3 }
45 XYPoint { x: 4; y: 4 }
47 XYPoint { x: 4; y: 4 }
48 axisX: valueAxisX
49 axisY: valueAxisY
46 }
50 }
47
51
48 LineSeries {
52 LineSeries {
49 name: "line series"
53 name: "line series"
50 XYPoint { x: 0; y: 0 }
54 XYPoint { x: 0; y: 0 }
51 XYPoint { x: 1; y: 1 }
55 XYPoint { x: 1; y: 1 }
52 XYPoint { x: 2; y: 2 }
56 XYPoint { x: 2; y: 2 }
53 XYPoint { x: 3; y: 3 }
57 XYPoint { x: 3; y: 3 }
54 XYPoint { x: 4; y: 4 }
58 XYPoint { x: 4; y: 4 }
59 axisX: valueAxisX
60 axisY: valueAxisY
55 }
61 }
56 }
62 }
@@ -1,108 +1,114
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 import QtQuick 2.0
19 import QtQuick 2.0
20 import QtCharts 2.0
20 import QtCharts 2.0
21
21
22 ChartView {
22 ChartView {
23 id: chartView
23 id: chartView
24 title: "Chart Title"
24 title: "Chart Title"
25 anchors.fill: parent
25 anchors.fill: parent
26 property variant chart: chartView
26 property variant chart: chartView
27
27
28 LineSeries {
28 LineSeries {
29 name: "line"
29 name: "line"
30 XYPoint { x: 0; y: 0 }
30 XYPoint { x: 0; y: 0 }
31 XYPoint { x: 1.1; y: 2.1 }
31 XYPoint { x: 1.1; y: 2.1 }
32 XYPoint { x: 1.9; y: 3.3 }
32 XYPoint { x: 1.9; y: 3.3 }
33 XYPoint { x: 2.1; y: 2.1 }
33 XYPoint { x: 2.1; y: 2.1 }
34 XYPoint { x: 2.9; y: 4.9 }
34 XYPoint { x: 2.9; y: 4.9 }
35 XYPoint { x: 3.4; y: 3.0 }
35 XYPoint { x: 3.4; y: 3.0 }
36 XYPoint { x: 4.1; y: 3.3 }
36 XYPoint { x: 4.1; y: 3.3 }
37 axisX: axisX
38 axisY: axisY
37 }
39 }
38
40
39 onVisibleChanged: console.log("chart.onVisibleChanged: " + visible);
41 onVisibleChanged: console.log("chart.onVisibleChanged: " + visible);
40 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + color);
42 onTitleColorChanged: console.log("chart.onTitleColorChanged: " + color);
41 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + chart.backgroundColor);
43 onBackgroundColorChanged: console.log("chart.onBackgroundColorChanged: " + chart.backgroundColor);
42 onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
44 onDropShadowEnabledChanged: console.log("chart.onDropShadowEnabledChanged: " + enabled);
43 onBackgroundRoundnessChanged: console.log("chart.onBackgroundRoundnessChanged: " + diameter);
45 onBackgroundRoundnessChanged: console.log("chart.onBackgroundRoundnessChanged: " + diameter);
44 onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name);
46 onSeriesAdded: console.log("chart.onSeriesAdded: " + series.name);
45 onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name);
47 onSeriesRemoved: console.log("chart.onSeriesRemoved: " + series.name);
46 onPlotAreaColorChanged: console.log("chart.plotAreaColorChanged: " + chart.plotAreaColor);
48 onPlotAreaColorChanged: console.log("chart.plotAreaColorChanged: " + chart.plotAreaColor);
47
49
48 legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible);
50 legend.onVisibleChanged: console.log("legend.onVisibleChanged: " + chart.legend.visible);
49 legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
51 legend.onBackgroundVisibleChanged: console.log("legend.onBackgroundVisibleChanged: " + visible);
50 legend.onColorChanged: console.log("legend.onColorChanged: " + color);
52 legend.onColorChanged: console.log("legend.onColorChanged: " + color);
51 legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
53 legend.onBorderColorChanged: console.log("legend.onBorderColorChanged: " + color);
52 legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color);
54 legend.onLabelColorChanged: console.log("legend.onLabelColorChanged: " + color);
53 legend.onReverseMarkersChanged: console.log("legend.onReverseMarkersChanged: "
55 legend.onReverseMarkersChanged: console.log("legend.onReverseMarkersChanged: "
54 + chart.legend.reverseMarkers)
56 + chart.legend.reverseMarkers)
55 margins.onTopChanged: console.log("chart.margins.onTopChanged: " + top );
57 margins.onTopChanged: console.log("chart.margins.onTopChanged: " + top );
56 margins.onBottomChanged: console.log("chart.margins.onBottomChanged: " + bottom);
58 margins.onBottomChanged: console.log("chart.margins.onBottomChanged: " + bottom);
57 margins.onLeftChanged: console.log("chart.margins.onLeftChanged: " + left);
59 margins.onLeftChanged: console.log("chart.margins.onLeftChanged: " + left);
58 margins.onRightChanged: console.log("chart.margins.onRightChanged: " + right);
60 margins.onRightChanged: console.log("chart.margins.onRightChanged: " + right);
59 onPlotAreaChanged: {
61 onPlotAreaChanged: {
60 console.log("chart.onPlotAreaChanged, width: " + chartView.plotArea.width
62 console.log("chart.onPlotAreaChanged, width: " + chartView.plotArea.width
61 + " height: " + chartView.plotArea.height
63 + " height: " + chartView.plotArea.height
62 + " y: " + chartView.plotArea.y
64 + " y: " + chartView.plotArea.y
63 + " x: " + chartView.plotArea.x);
65 + " x: " + chartView.plotArea.x);
64 marginVisualizer.opacity = 1.0;
66 marginVisualizer.opacity = 1.0;
65 }
67 }
66
68
67 ValueAxis{
69 ValueAxis{
70 id: axisX
68 onColorChanged: console.log("axisX.onColorChanged: " + color);
71 onColorChanged: console.log("axisX.onColorChanged: " + color);
69 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
72 onLabelsVisibleChanged: console.log("axisX.onLabelsVisibleChanged: " + visible);
70 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
73 onLabelsColorChanged: console.log("axisX.onLabelsColorChanged: " + color);
71 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
74 onVisibleChanged: console.log("axisX.onVisibleChanged: " + visible);
72 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
75 onGridVisibleChanged: console.log("axisX.onGridVisibleChanged: " + visible);
73 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
76 onShadesVisibleChanged: console.log("axisX.onShadesVisibleChanged: " + visible);
74 onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
77 onShadesColorChanged: console.log("axisX.onShadesColorChanged: " + color);
75 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
78 onShadesBorderColorChanged: console.log("axisX.onShadesBorderColorChanged: " + color);
76 onMinChanged: console.log("axisX.onMinChanged: " + min);
79 onMinChanged: console.log("axisX.onMinChanged: " + min);
77 onMaxChanged: console.log("axisX.onMaxChanged: " + max);
80 onMaxChanged: console.log("axisX.onMaxChanged: " + max);
81 onReverseChanged: console.log("axisX.onReverseChanged: " + reverse);
78 }
82 }
79
83
80 ValueAxis{
84 ValueAxis{
85 id: axisY
81 onColorChanged: console.log("axisY.onColorChanged: " + color);
86 onColorChanged: console.log("axisY.onColorChanged: " + color);
82 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
87 onLabelsVisibleChanged: console.log("axisY.onLabelsVisibleChanged: " + visible);
83 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
88 onLabelsColorChanged: console.log("axisY.onLabelsColorChanged: " + color);
84 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
89 onVisibleChanged: console.log("axisY.onVisibleChanged: " + visible);
85 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
90 onGridVisibleChanged: console.log("axisY.onGridVisibleChanged: " + visible);
86 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
91 onShadesVisibleChanged: console.log("axisY.onShadesVisibleChanged: " + visible);
87 onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
92 onShadesColorChanged: console.log("axisY.onShadesColorChanged: " + color);
88 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
93 onShadesBorderColorChanged: console.log("axisY.onShadesBorderColorChanged: " + color);
89 onMinChanged: console.log("axisY.onMinChanged: " + min);
94 onMinChanged: console.log("axisY.onMinChanged: " + min);
90 onMaxChanged: console.log("axisY.onMaxChanged: " + max);
95 onMaxChanged: console.log("axisY.onMaxChanged: " + max);
96 onReverseChanged: console.log("axisY.onReverseChanged: " + reverse);
91 }
97 }
92
98
93 Rectangle {
99 Rectangle {
94 id: marginVisualizer
100 id: marginVisualizer
95 color: "transparent"
101 color: "transparent"
96 border.color: "red"
102 border.color: "red"
97 anchors.fill: parent
103 anchors.fill: parent
98 anchors.topMargin: chartView.margins.top
104 anchors.topMargin: chartView.margins.top
99 anchors.bottomMargin: chartView.margins.bottom
105 anchors.bottomMargin: chartView.margins.bottom
100 anchors.leftMargin: chartView.margins.left
106 anchors.leftMargin: chartView.margins.left
101 anchors.rightMargin: chartView.margins.right
107 anchors.rightMargin: chartView.margins.right
102 opacity: 0.0
108 opacity: 0.0
103 onOpacityChanged: if (opacity > 0.9) opacity = 0.0;
109 onOpacityChanged: if (opacity > 0.9) opacity = 0.0;
104 Behavior on opacity {
110 Behavior on opacity {
105 NumberAnimation { duration: 800 }
111 NumberAnimation { duration: 800 }
106 }
112 }
107 }
113 }
108 }
114 }
@@ -1,125 +1,129
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd
3 ** Copyright (C) 2015 The Qt Company Ltd
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
5 ** For any questions to The Qt Company, please use contact form at http://qt.io
6 **
6 **
7 ** This file is part of the Qt Charts module.
7 ** This file is part of the Qt Charts module.
8 **
8 **
9 ** Licensees holding valid commercial license for Qt may use this file in
9 ** Licensees holding valid commercial license for Qt may use this file in
10 ** accordance with the Qt License Agreement provided with the Software
10 ** accordance with the Qt License Agreement provided with the Software
11 ** or, alternatively, in accordance with the terms contained in a written
11 ** or, alternatively, in accordance with the terms contained in a written
12 ** agreement between you and The Qt Company.
12 ** agreement between you and The Qt Company.
13 **
13 **
14 ** If you have questions regarding the use of this file, please use
14 ** If you have questions regarding the use of this file, please use
15 ** contact form at http://qt.io
15 ** contact form at http://qt.io
16 **
16 **
17 ****************************************************************************/
17 ****************************************************************************/
18
18
19 import QtQuick 2.0
19 import QtQuick 2.0
20
20
21 Row {
21 Row {
22 anchors.fill: parent
22 anchors.fill: parent
23 spacing: 5
23 spacing: 5
24 property variant axis
24 property variant axis
25
25
26 Flow {
26 Flow {
27 spacing: 5
27 spacing: 5
28 flow: Flow.TopToBottom
28 flow: Flow.TopToBottom
29 height: parent.height
29 height: parent.height
30
30
31 Button {
31 Button {
32 text: "axis visible"
32 text: "axis visible"
33 onClicked: axis.visible = !axis.visible;
33 onClicked: axis.visible = !axis.visible;
34 }
34 }
35 Button {
35 Button {
36 text: "axis line visible"
36 text: "axis line visible"
37 onClicked: axis.lineVisible = !axis.lineVisible;
37 onClicked: axis.lineVisible = !axis.lineVisible;
38 }
38 }
39 Button {
39 Button {
40 text: "axis color"
40 text: "axis color"
41 onClicked: axis.color = main.nextColor();
41 onClicked: axis.color = main.nextColor();
42 }
42 }
43 Button {
43 Button {
44 text: "axis labels visible"
44 text: "axis labels visible"
45 onClicked: axis.labelsVisible = !axis.labelsVisible;
45 onClicked: axis.labelsVisible = !axis.labelsVisible;
46 }
46 }
47 Button {
47 Button {
48 text: "axis labels angle +"
48 text: "axis labels angle +"
49 onClicked: axis.labelsAngle += 5;
49 onClicked: axis.labelsAngle += 5;
50 }
50 }
51 Button {
51 Button {
52 text: "axis labels angle -"
52 text: "axis labels angle -"
53 onClicked: axis.labelsAngle -= 5;
53 onClicked: axis.labelsAngle -= 5;
54 }
54 }
55 Button {
55 Button {
56 text: "axis labels color"
56 text: "axis labels color"
57 onClicked: axis.labelsColor = main.nextColor();
57 onClicked: axis.labelsColor = main.nextColor();
58 }
58 }
59 Button {
59 Button {
60 text: "axis grid visible"
60 text: "axis grid visible"
61 onClicked: axis.gridVisible = !axis.gridVisible;
61 onClicked: axis.gridVisible = !axis.gridVisible;
62 }
62 }
63 Button {
63 Button {
64 text: "axis shades visible"
64 text: "axis shades visible"
65 onClicked: axis.shadesVisible = !axis.shadesVisible;
65 onClicked: axis.shadesVisible = !axis.shadesVisible;
66 }
66 }
67 Button {
67 Button {
68 text: "axis shades color"
68 text: "axis shades color"
69 onClicked: axis.shadesColor = main.nextColor();
69 onClicked: axis.shadesColor = main.nextColor();
70 }
70 }
71 Button {
71 Button {
72 text: "axis shades bcolor"
72 text: "axis shades bcolor"
73 onClicked: axis.shadesBorderColor = main.nextColor();
73 onClicked: axis.shadesBorderColor = main.nextColor();
74 }
74 }
75 Button {
75 Button {
76 text: "axis title text"
76 text: "axis title text"
77 onClicked: axis.titleText = axis.titleText + "X";
77 onClicked: axis.titleText = axis.titleText + "X";
78 }
78 }
79 Button {
79 Button {
80 text: "axis title visible"
80 text: "axis title visible"
81 onClicked: axis.titleVisible = !axis.titleVisible;
81 onClicked: axis.titleVisible = !axis.titleVisible;
82 }
82 }
83 Button {
83 Button {
84 text: "axis max +"
84 text: "axis max +"
85 onClicked: axis.max += 0.1;
85 onClicked: axis.max += 0.1;
86 }
86 }
87 Button {
87 Button {
88 text: "axis max -"
88 text: "axis max -"
89 onClicked: axis.max -= 0.1;
89 onClicked: axis.max -= 0.1;
90 }
90 }
91 Button {
91 Button {
92 text: "axis min +"
92 text: "axis min +"
93 onClicked: axis.min += 0.1;
93 onClicked: axis.min += 0.1;
94 }
94 }
95 Button {
95 Button {
96 text: "axis min -"
96 text: "axis min -"
97 onClicked: axis.min -= 0.1;
97 onClicked: axis.min -= 0.1;
98 }
98 }
99 Button {
99 Button {
100 text: "axis tick count +"
100 text: "axis tick count +"
101 onClicked: axis.tickCount++;
101 onClicked: axis.tickCount++;
102 }
102 }
103 Button {
103 Button {
104 text: "axis tick count -"
104 text: "axis tick count -"
105
105
106 onClicked: axis.tickCount--;
106 onClicked: axis.tickCount--;
107 }
107 }
108 Button {
109 text: "axis reverse"
110 onClicked: axis.reverse = !axis.reverse;
111 }
108
112
109 FontEditor {
113 FontEditor {
110 id: fontEditor
114 id: fontEditor
111 fontDescription: "axis"
115 fontDescription: "axis"
112 function editedFont() {
116 function editedFont() {
113 return axis.labelsFont;
117 return axis.labelsFont;
114 }
118 }
115 }
119 }
116
120
117 FontEditor {
121 FontEditor {
118 id: titleFontEditor
122 id: titleFontEditor
119 fontDescription: "title"
123 fontDescription: "title"
120 function editedFont() {
124 function editedFont() {
121 return axis.titleFont;
125 return axis.titleFont;
122 }
126 }
123 }
127 }
124 }
128 }
125 }
129 }
General Comments 0
You need to be logged in to leave comments. Login now