##// END OF EJS Templates
Fix the documentation for the qml properties to refer to DateTimeAxis...
Andy Shaw -
r2679:1b2e5857f541
parent child
Show More
@@ -1,391 +1,391
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2013 Digia Plc
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #include "qdatetimeaxis.h"
21 #include "qdatetimeaxis.h"
22 #include "qdatetimeaxis_p.h"
22 #include "qdatetimeaxis_p.h"
23 #include "chartdatetimeaxisx_p.h"
23 #include "chartdatetimeaxisx_p.h"
24 #include "chartdatetimeaxisy_p.h"
24 #include "chartdatetimeaxisy_p.h"
25 #include "polarchartdatetimeaxisangular_p.h"
25 #include "polarchartdatetimeaxisangular_p.h"
26 #include "polarchartdatetimeaxisradial_p.h"
26 #include "polarchartdatetimeaxisradial_p.h"
27 #include "abstractdomain_p.h"
27 #include "abstractdomain_p.h"
28 #include "qchart.h"
28 #include "qchart.h"
29 #include <float.h>
29 #include <float.h>
30 #include <cmath>
30 #include <cmath>
31
31
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
33 /*!
33 /*!
34 \class QDateTimeAxis
34 \class QDateTimeAxis
35 \inmodule Qt Charts
35 \inmodule Qt Charts
36 \brief The QDateTimeAxis class is used for manipulating chart's axis.
36 \brief The QDateTimeAxis class is used for manipulating chart's axis.
37 \mainclass
37 \mainclass
38
38
39 The labels can be configured by setting an appropriate DateTime format.
39 The labels can be configured by setting an appropriate DateTime format.
40 QDateTimeAxis works correctly with dates from 4714 BCE to 287396 CE.
40 QDateTimeAxis works correctly with dates from 4714 BCE to 287396 CE.
41 There are also other limitiation related to QDateTime. Please refer to QDateTime documentation.
41 There are also other limitiation related to QDateTime. Please refer to QDateTime documentation.
42 QDateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
42 QDateTimeAxis can be setup to show axis line with tick marks, grid lines and shades.
43
43
44 Note: QDateTimeAxis is disabled on ARM architecture.
44 Note: QDateTimeAxis is disabled on ARM architecture.
45
45
46 \image api_datatime_axis.png
46 \image api_datatime_axis.png
47
47
48 QDateTimeAxis can be used with any QXYSeries.
48 QDateTimeAxis can be used with any QXYSeries.
49 To add a data point to the series QDateTime::toMSecsSinceEpoch() is used.
49 To add a data point to the series QDateTime::toMSecsSinceEpoch() is used.
50 \code
50 \code
51 QLineSeries *series = new QLineSeries;
51 QLineSeries *series = new QLineSeries;
52
52
53 QDateTime xValue;
53 QDateTime xValue;
54 xValue.setDate(QDate(2012, 1 , 18));
54 xValue.setDate(QDate(2012, 1 , 18));
55 xValue.setTime(QTime(9, 34));
55 xValue.setTime(QTime(9, 34));
56 qreal yValue = 12;
56 qreal yValue = 12;
57 series->append(xValue.toMSecsSinceEpoch(), yValue);
57 series->append(xValue.toMSecsSinceEpoch(), yValue);
58
58
59 xValue.setDate(QDate(2013, 5 , 11));
59 xValue.setDate(QDate(2013, 5 , 11));
60 xValue.setTime(QTime(11, 14));
60 xValue.setTime(QTime(11, 14));
61 qreal yValue = 22;
61 qreal yValue = 22;
62 series->append(xValue.toMSecsSinceEpoch(), yValue);
62 series->append(xValue.toMSecsSinceEpoch(), yValue);
63 \endcode
63 \endcode
64
64
65 Adding the series to the chart and setting up the QDateTimeAxis.
65 Adding the series to the chart and setting up the QDateTimeAxis.
66 \code
66 \code
67 QChartView *chartView = new QChartView;
67 QChartView *chartView = new QChartView;
68 chartView->chart()->addSeries(series);
68 chartView->chart()->addSeries(series);
69
69
70 // ...
70 // ...
71 QDateTimeAxis *axisX = new QDateTimeAxis;
71 QDateTimeAxis *axisX = new QDateTimeAxis;
72 axisX->setFormat("dd-MM-yyyy h:mm");
72 axisX->setFormat("dd-MM-yyyy h:mm");
73 chartView->chart()->setAxisX(axisX, series);
73 chartView->chart()->setAxisX(axisX, series);
74 \endcode
74 \endcode
75 */
75 */
76
76
77 #ifdef QDOC_QT5
77 #ifdef QDOC_QT5
78 /*!
78 /*!
79 \qmltype DateTimeAxis
79 \qmltype DateTimeAxis
80 \instantiates QDateTimeAxis
80 \instantiates QDateTimeAxis
81 \inqmlmodule QtCommercial.Chart
81 \inqmlmodule QtCommercial.Chart
82
82
83 \include doc/src/datetimeaxis.qdocinc
83 \include doc/src/datetimeaxis.qdocinc
84 */
84 */
85 #else
85 #else
86 /*!
86 /*!
87 \qmlclass DateTimeAxis QDateTimeAxis
87 \qmlclass DateTimeAxis QDateTimeAxis
88
88
89 \include ../doc/src/datetimeaxis.qdocinc
89 \include ../doc/src/datetimeaxis.qdocinc
90 */
90 */
91 #endif
91 #endif
92
92
93 /*!
93 /*!
94 \property QDateTimeAxis::min
94 \property QDateTimeAxis::min
95 Defines the minimum value on the axis.
95 Defines the minimum value on the axis.
96 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
96 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
97 */
97 */
98 /*!
98 /*!
99 \qmlproperty real ValuesAxis::min
99 \qmlproperty real DateTimeAxis::min
100 Defines the minimum value on the axis.
100 Defines the minimum value on the axis.
101 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
101 When setting this property the max is adjusted if necessary, to ensure that the range remains valid.
102 */
102 */
103
103
104 /*!
104 /*!
105 \property QDateTimeAxis::max
105 \property QDateTimeAxis::max
106 Defines the maximum value on the axis.
106 Defines the maximum value on the axis.
107 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
107 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
108 */
108 */
109 /*!
109 /*!
110 \qmlproperty real ValuesAxis::max
110 \qmlproperty real DateTimeAxis::max
111 Defines the maximum value on the axis.
111 Defines the maximum value on the axis.
112 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
112 When setting this property the min is adjusted if necessary, to ensure that the range remains valid.
113 */
113 */
114
114
115 /*!
115 /*!
116 \fn void QDateTimeAxis::minChanged(QDateTime min)
116 \fn void QDateTimeAxis::minChanged(QDateTime min)
117 Axis emits signal when \a min of axis has changed.
117 Axis emits signal when \a min of axis has changed.
118 */
118 */
119 /*!
119 /*!
120 \qmlsignal ValuesAxis::onMinChanged(QDateTime min)
120 \qmlsignal DateTimeAxis::onMinChanged(QDateTime min)
121 Axis emits signal when \a min of axis has changed.
121 Axis emits signal when \a min of axis has changed.
122 */
122 */
123
123
124 /*!
124 /*!
125 \fn void QDateTimeAxis::maxChanged(QDateTime max)
125 \fn void QDateTimeAxis::maxChanged(QDateTime max)
126 Axis emits signal when \a max of axis has changed.
126 Axis emits signal when \a max of axis has changed.
127 */
127 */
128 /*!
128 /*!
129 \qmlsignal ValuesAxis::onMaxChanged(QDateTime max)
129 \qmlsignal DateTimeAxis::onMaxChanged(QDateTime max)
130 Axis emits signal when \a max of axis has changed.
130 Axis emits signal when \a max of axis has changed.
131 */
131 */
132
132
133 /*!
133 /*!
134 \fn void QDateTimeAxis::rangeChanged(QDateTime min, QDateTime max)
134 \fn void QDateTimeAxis::rangeChanged(QDateTime min, QDateTime max)
135 Axis emits signal when \a min or \a max of axis has changed.
135 Axis emits signal when \a min or \a max of axis has changed.
136 */
136 */
137
137
138 /*!
138 /*!
139 \property QDateTimeAxis::tickCount
139 \property QDateTimeAxis::tickCount
140 The number of tick marks for the axis.
140 The number of tick marks for the axis.
141 */
141 */
142
142
143 /*!
143 /*!
144 \qmlproperty int DateTimeAxis::tickCount
144 \qmlproperty int DateTimeAxis::tickCount
145 The number of tick marks for the axis.
145 The number of tick marks for the axis.
146 */
146 */
147
147
148 /*!
148 /*!
149 \property QDateTimeAxis::format
149 \property QDateTimeAxis::format
150 The format string that is used when creating label for the axis out of a QDateTime object.
150 The format string that is used when creating label for the axis out of a QDateTime object.
151 Check QDateTime documentation for information on how the string should be defined.
151 Check QDateTime documentation for information on how the string should be defined.
152 */
152 */
153 /*!
153 /*!
154 \qmlproperty string DateTimeAxis::format
154 \qmlproperty string DateTimeAxis::format
155 The format string that is used when creating label for the axis out of a QDateTime object.
155 The format string that is used when creating label for the axis out of a QDateTime object.
156 Check QDateTime documentation for information on how the string should be defined.
156 Check QDateTime documentation for information on how the string should be defined.
157 */
157 */
158
158
159 /*!
159 /*!
160 \fn void QDateTimeAxis::tickCountChanged(int tickCount)
160 \fn void QDateTimeAxis::tickCountChanged(int tickCount)
161 Axis emits signal when \a tickCount number on axis have changed.
161 Axis emits signal when \a tickCount number on axis have changed.
162 */
162 */
163 /*!
163 /*!
164 \qmlsignal DateTimeAxis::tickCountChanged(int tickCount)
164 \qmlsignal DateTimeAxis::tickCountChanged(int tickCount)
165 Axis emits signal when \a tickCount number on axis have changed.
165 Axis emits signal when \a tickCount number on axis have changed.
166 */
166 */
167
167
168 /*!
168 /*!
169 \fn void QDateTimeAxis::formatChanged(QString format)
169 \fn void QDateTimeAxis::formatChanged(QString format)
170 Axis emits signal when \a format of the axis has changed.
170 Axis emits signal when \a format of the axis has changed.
171 */
171 */
172 /*!
172 /*!
173 \qmlsignal DateTimeAxis::onFormatChanged(string format)
173 \qmlsignal DateTimeAxis::onFormatChanged(string format)
174 Axis emits signal when \a format of the axis has changed.
174 Axis emits signal when \a format of the axis has changed.
175 */
175 */
176
176
177 /*!
177 /*!
178 Constructs an axis object which is a child of \a parent.
178 Constructs an axis object which is a child of \a parent.
179 */
179 */
180 QDateTimeAxis::QDateTimeAxis(QObject *parent) :
180 QDateTimeAxis::QDateTimeAxis(QObject *parent) :
181 QAbstractAxis(*new QDateTimeAxisPrivate(this), parent)
181 QAbstractAxis(*new QDateTimeAxisPrivate(this), parent)
182 {
182 {
183
183
184 }
184 }
185
185
186 /*!
186 /*!
187 \internal
187 \internal
188 */
188 */
189 QDateTimeAxis::QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
189 QDateTimeAxis::QDateTimeAxis(QDateTimeAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent)
190 {
190 {
191
191
192 }
192 }
193
193
194 /*!
194 /*!
195 Destroys the object
195 Destroys the object
196 */
196 */
197 QDateTimeAxis::~QDateTimeAxis()
197 QDateTimeAxis::~QDateTimeAxis()
198 {
198 {
199 Q_D(QDateTimeAxis);
199 Q_D(QDateTimeAxis);
200 if (d->m_chart)
200 if (d->m_chart)
201 d->m_chart->removeAxis(this);
201 d->m_chart->removeAxis(this);
202 }
202 }
203
203
204 void QDateTimeAxis::setMin(QDateTime min)
204 void QDateTimeAxis::setMin(QDateTime min)
205 {
205 {
206 Q_D(QDateTimeAxis);
206 Q_D(QDateTimeAxis);
207 if (min.isValid())
207 if (min.isValid())
208 d->setRange(min.toMSecsSinceEpoch(), qMax(d->m_max, qreal(min.toMSecsSinceEpoch())));
208 d->setRange(min.toMSecsSinceEpoch(), qMax(d->m_max, qreal(min.toMSecsSinceEpoch())));
209 }
209 }
210
210
211 QDateTime QDateTimeAxis::min() const
211 QDateTime QDateTimeAxis::min() const
212 {
212 {
213 Q_D(const QDateTimeAxis);
213 Q_D(const QDateTimeAxis);
214 return QDateTime::fromMSecsSinceEpoch(d->m_min);
214 return QDateTime::fromMSecsSinceEpoch(d->m_min);
215 }
215 }
216
216
217 void QDateTimeAxis::setMax(QDateTime max)
217 void QDateTimeAxis::setMax(QDateTime max)
218 {
218 {
219 Q_D(QDateTimeAxis);
219 Q_D(QDateTimeAxis);
220 if (max.isValid())
220 if (max.isValid())
221 d->setRange(qMin(d->m_min, qreal(max.toMSecsSinceEpoch())), max.toMSecsSinceEpoch());
221 d->setRange(qMin(d->m_min, qreal(max.toMSecsSinceEpoch())), max.toMSecsSinceEpoch());
222 }
222 }
223
223
224 QDateTime QDateTimeAxis::max() const
224 QDateTime QDateTimeAxis::max() const
225 {
225 {
226 Q_D(const QDateTimeAxis);
226 Q_D(const QDateTimeAxis);
227 return QDateTime::fromMSecsSinceEpoch(d->m_max);
227 return QDateTime::fromMSecsSinceEpoch(d->m_max);
228 }
228 }
229
229
230 /*!
230 /*!
231 Sets range from \a min to \a max on the axis.
231 Sets range from \a min to \a max on the axis.
232 If min is greater than max then this function returns without making any changes.
232 If min is greater than max then this function returns without making any changes.
233 */
233 */
234 void QDateTimeAxis::setRange(QDateTime min, QDateTime max)
234 void QDateTimeAxis::setRange(QDateTime min, QDateTime max)
235 {
235 {
236 Q_D(QDateTimeAxis);
236 Q_D(QDateTimeAxis);
237 if (!min.isValid() || !max.isValid() || min > max)
237 if (!min.isValid() || !max.isValid() || min > max)
238 return;
238 return;
239
239
240 d->setRange(min.toMSecsSinceEpoch(),max.toMSecsSinceEpoch());
240 d->setRange(min.toMSecsSinceEpoch(),max.toMSecsSinceEpoch());
241 }
241 }
242
242
243 void QDateTimeAxis::setFormat(QString format)
243 void QDateTimeAxis::setFormat(QString format)
244 {
244 {
245 Q_D(QDateTimeAxis);
245 Q_D(QDateTimeAxis);
246 if (d->m_format != format) {
246 if (d->m_format != format) {
247 d->m_format = format;
247 d->m_format = format;
248 emit formatChanged(format);
248 emit formatChanged(format);
249 }
249 }
250 }
250 }
251
251
252 QString QDateTimeAxis::format() const
252 QString QDateTimeAxis::format() const
253 {
253 {
254 Q_D(const QDateTimeAxis);
254 Q_D(const QDateTimeAxis);
255 return d->m_format;
255 return d->m_format;
256 }
256 }
257
257
258 /*!
258 /*!
259 Sets \a count for ticks on the axis.
259 Sets \a count for ticks on the axis.
260 */
260 */
261 void QDateTimeAxis::setTickCount(int count)
261 void QDateTimeAxis::setTickCount(int count)
262 {
262 {
263 Q_D(QDateTimeAxis);
263 Q_D(QDateTimeAxis);
264 if (d->m_tickCount != count && count >= 2) {
264 if (d->m_tickCount != count && count >= 2) {
265 d->m_tickCount = count;
265 d->m_tickCount = count;
266 emit tickCountChanged(count);
266 emit tickCountChanged(count);
267 }
267 }
268 }
268 }
269
269
270 /*!
270 /*!
271 \fn int QDateTimeAxis::tickCount() const
271 \fn int QDateTimeAxis::tickCount() const
272 Return number of ticks on the axis
272 Return number of ticks on the axis
273 */
273 */
274 int QDateTimeAxis::tickCount() const
274 int QDateTimeAxis::tickCount() const
275 {
275 {
276 Q_D(const QDateTimeAxis);
276 Q_D(const QDateTimeAxis);
277 return d->m_tickCount;
277 return d->m_tickCount;
278 }
278 }
279
279
280 /*!
280 /*!
281 Returns the type of the axis
281 Returns the type of the axis
282 */
282 */
283 QAbstractAxis::AxisType QDateTimeAxis::type() const
283 QAbstractAxis::AxisType QDateTimeAxis::type() const
284 {
284 {
285 return AxisTypeDateTime;
285 return AxisTypeDateTime;
286 }
286 }
287
287
288 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
288 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
289
289
290 QDateTimeAxisPrivate::QDateTimeAxisPrivate(QDateTimeAxis *q)
290 QDateTimeAxisPrivate::QDateTimeAxisPrivate(QDateTimeAxis *q)
291 : QAbstractAxisPrivate(q),
291 : QAbstractAxisPrivate(q),
292 m_min(0),
292 m_min(0),
293 m_max(0),
293 m_max(0),
294 m_tickCount(5)
294 m_tickCount(5)
295 {
295 {
296 m_format = "dd-MM-yyyy\nh:mm";
296 m_format = "dd-MM-yyyy\nh:mm";
297 }
297 }
298
298
299 QDateTimeAxisPrivate::~QDateTimeAxisPrivate()
299 QDateTimeAxisPrivate::~QDateTimeAxisPrivate()
300 {
300 {
301
301
302 }
302 }
303
303
304 void QDateTimeAxisPrivate::setRange(qreal min,qreal max)
304 void QDateTimeAxisPrivate::setRange(qreal min,qreal max)
305 {
305 {
306 Q_Q(QDateTimeAxis);
306 Q_Q(QDateTimeAxis);
307
307
308 bool changed = false;
308 bool changed = false;
309
309
310 if (m_min != min) {
310 if (m_min != min) {
311 m_min = min;
311 m_min = min;
312 changed = true;
312 changed = true;
313 emit q->minChanged(QDateTime::fromMSecsSinceEpoch(min));
313 emit q->minChanged(QDateTime::fromMSecsSinceEpoch(min));
314 }
314 }
315
315
316 if (m_max != max) {
316 if (m_max != max) {
317 m_max = max;
317 m_max = max;
318 changed = true;
318 changed = true;
319 emit q->maxChanged(QDateTime::fromMSecsSinceEpoch(max));
319 emit q->maxChanged(QDateTime::fromMSecsSinceEpoch(max));
320 }
320 }
321
321
322 if (changed) {
322 if (changed) {
323 emit q->rangeChanged(QDateTime::fromMSecsSinceEpoch(min), QDateTime::fromMSecsSinceEpoch(max));
323 emit q->rangeChanged(QDateTime::fromMSecsSinceEpoch(min), QDateTime::fromMSecsSinceEpoch(max));
324 emit rangeChanged(m_min,m_max);
324 emit rangeChanged(m_min,m_max);
325 }
325 }
326 }
326 }
327
327
328
328
329 void QDateTimeAxisPrivate::setMin(const QVariant &min)
329 void QDateTimeAxisPrivate::setMin(const QVariant &min)
330 {
330 {
331 Q_Q(QDateTimeAxis);
331 Q_Q(QDateTimeAxis);
332 if (min.canConvert(QVariant::DateTime))
332 if (min.canConvert(QVariant::DateTime))
333 q->setMin(min.toDateTime());
333 q->setMin(min.toDateTime());
334 }
334 }
335
335
336 void QDateTimeAxisPrivate::setMax(const QVariant &max)
336 void QDateTimeAxisPrivate::setMax(const QVariant &max)
337 {
337 {
338
338
339 Q_Q(QDateTimeAxis);
339 Q_Q(QDateTimeAxis);
340 if (max.canConvert(QVariant::DateTime))
340 if (max.canConvert(QVariant::DateTime))
341 q->setMax(max.toDateTime());
341 q->setMax(max.toDateTime());
342 }
342 }
343
343
344 void QDateTimeAxisPrivate::setRange(const QVariant &min, const QVariant &max)
344 void QDateTimeAxisPrivate::setRange(const QVariant &min, const QVariant &max)
345 {
345 {
346 Q_Q(QDateTimeAxis);
346 Q_Q(QDateTimeAxis);
347 if (min.canConvert(QVariant::DateTime) && max.canConvert(QVariant::DateTime))
347 if (min.canConvert(QVariant::DateTime) && max.canConvert(QVariant::DateTime))
348 q->setRange(min.toDateTime(), max.toDateTime());
348 q->setRange(min.toDateTime(), max.toDateTime());
349 }
349 }
350
350
351 void QDateTimeAxisPrivate::initializeGraphics(QGraphicsItem* parent)
351 void QDateTimeAxisPrivate::initializeGraphics(QGraphicsItem* parent)
352 {
352 {
353 Q_Q(QDateTimeAxis);
353 Q_Q(QDateTimeAxis);
354 ChartAxisElement *axis(0);
354 ChartAxisElement *axis(0);
355 if (m_chart->chartType() == QChart::ChartTypeCartesian) {
355 if (m_chart->chartType() == QChart::ChartTypeCartesian) {
356 if (orientation() == Qt::Vertical)
356 if (orientation() == Qt::Vertical)
357 axis = new ChartDateTimeAxisY(q,parent);
357 axis = new ChartDateTimeAxisY(q,parent);
358 if (orientation() == Qt::Horizontal)
358 if (orientation() == Qt::Horizontal)
359 axis = new ChartDateTimeAxisX(q,parent);
359 axis = new ChartDateTimeAxisX(q,parent);
360 }
360 }
361
361
362 if (m_chart->chartType() == QChart::ChartTypePolar) {
362 if (m_chart->chartType() == QChart::ChartTypePolar) {
363 if (orientation() == Qt::Vertical)
363 if (orientation() == Qt::Vertical)
364 axis = new PolarChartDateTimeAxisRadial(q, parent);
364 axis = new PolarChartDateTimeAxisRadial(q, parent);
365 if (orientation() == Qt::Horizontal)
365 if (orientation() == Qt::Horizontal)
366 axis = new PolarChartDateTimeAxisAngular(q, parent);
366 axis = new PolarChartDateTimeAxisAngular(q, parent);
367 }
367 }
368
368
369 m_item.reset(axis);
369 m_item.reset(axis);
370 QAbstractAxisPrivate::initializeGraphics(parent);
370 QAbstractAxisPrivate::initializeGraphics(parent);
371 }
371 }
372
372
373 void QDateTimeAxisPrivate::initializeDomain(AbstractDomain *domain)
373 void QDateTimeAxisPrivate::initializeDomain(AbstractDomain *domain)
374 {
374 {
375 if (m_max == m_min) {
375 if (m_max == m_min) {
376 if (orientation() == Qt::Vertical)
376 if (orientation() == Qt::Vertical)
377 setRange(domain->minY(), domain->maxY());
377 setRange(domain->minY(), domain->maxY());
378 else
378 else
379 setRange(domain->minX(), domain->maxX());
379 setRange(domain->minX(), domain->maxX());
380 } else {
380 } else {
381 if (orientation() == Qt::Vertical)
381 if (orientation() == Qt::Vertical)
382 domain->setRangeY(m_min, m_max);
382 domain->setRangeY(m_min, m_max);
383 else
383 else
384 domain->setRangeX(m_min, m_max);
384 domain->setRangeX(m_min, m_max);
385 }
385 }
386 }
386 }
387
387
388 #include "moc_qdatetimeaxis.cpp"
388 #include "moc_qdatetimeaxis.cpp"
389 #include "moc_qdatetimeaxis_p.cpp"
389 #include "moc_qdatetimeaxis_p.cpp"
390
390
391 QTCOMMERCIALCHART_END_NAMESPACE
391 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now