@@ -1,325 +1,372 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qlogvalueaxis.h" |
|
21 | #include "qlogvalueaxis.h" | |
22 | #include "qlogvalueaxis_p.h" |
|
22 | #include "qlogvalueaxis_p.h" | |
23 | #include "chartlogvalueaxisx_p.h" |
|
23 | #include "chartlogvalueaxisx_p.h" | |
24 | #include "chartlogvalueaxisy_p.h" |
|
24 | #include "chartlogvalueaxisy_p.h" | |
25 | #include "abstractdomain_p.h" |
|
25 | #include "abstractdomain_p.h" | |
26 | #include <float.h> |
|
26 | #include <float.h> | |
27 | #include <cmath> |
|
27 | #include <cmath> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 | /*! |
|
30 | /*! | |
31 | \class QLogValueAxis |
|
31 | \class QLogValueAxis | |
32 | \brief The QLogValueAxis class is used for manipulating chart's axis. |
|
32 | \brief The QLogValueAxis class is used for manipulating chart's axis. | |
33 | \mainclass |
|
33 | \mainclass | |
34 | */ |
|
34 | */ | |
35 |
|
35 | |||
36 | /*! |
|
36 | /*! | |
37 | \qmlclass DateTimeAxis QLogValueAxis |
|
37 | \qmlclass DateTimeAxis QLogValueAxis | |
38 |
\brief The |
|
38 | \brief The QLogValueAxis element is used for manipulating chart's axes | |
39 | \inherits AbstractAxis |
|
39 | \inherits AbstractAxis | |
40 | */ |
|
40 | */ | |
41 |
|
41 | |||
42 | /*! |
|
42 | /*! | |
43 | \property QLogValueAxis::min |
|
43 | \property QLogValueAxis::min | |
44 | Defines the minimum value on the axis. |
|
44 | Defines the minimum value on the axis. | |
45 | When setting this property the max is adjusted if necessary, to ensure that the range remains valid. |
|
45 | When setting this property the max is adjusted if necessary, to ensure that the range remains valid. | |
|
46 | Value has to be greater then 0. | |||
46 | */ |
|
47 | */ | |
47 | /*! |
|
48 | /*! | |
48 | \qmlproperty real ValuesAxis::min |
|
49 | \qmlproperty real LogValuesAxis::min | |
49 | Defines the minimum value on the axis. |
|
50 | Defines the minimum value on the axis. | |
50 | When setting this property the max is adjusted if necessary, to ensure that the range remains valid. |
|
51 | When setting this property the max is adjusted if necessary, to ensure that the range remains valid. | |
|
52 | Value has to be greater then 0. | |||
51 | */ |
|
53 | */ | |
52 |
|
54 | |||
53 | /*! |
|
55 | /*! | |
54 | \property QLogValueAxis::max |
|
56 | \property QLogValueAxis::max | |
55 | Defines the maximum value on the axis. |
|
57 | Defines the maximum value on the axis. | |
56 | When setting this property the min is adjusted if necessary, to ensure that the range remains valid. |
|
58 | When setting this property the min is adjusted if necessary, to ensure that the range remains valid. | |
|
59 | Value has to be greater then 0. | |||
57 | */ |
|
60 | */ | |
58 | /*! |
|
61 | /*! | |
59 | \qmlproperty real ValuesAxis::max |
|
62 | \qmlproperty real LogValuesAxis::max | |
60 | Defines the maximum value on the axis. |
|
63 | Defines the maximum value on the axis. | |
61 | When setting this property the min is adjusted if necessary, to ensure that the range remains valid. |
|
64 | When setting this property the min is adjusted if necessary, to ensure that the range remains valid. | |
|
65 | Value has to be greater then 0. | |||
|
66 | */ | |||
|
67 | ||||
|
68 | /*! | |||
|
69 | \property QLogValueAxis::base | |||
|
70 | Defines the base of the logarithm. | |||
|
71 | Value has to be greater then 0 and not equal 1 | |||
|
72 | */ | |||
|
73 | /*! | |||
|
74 | \qmlproperty real LogValuesAxis::base | |||
|
75 | Defines the maximum value on the axis. | |||
|
76 | Defines the base of the logarithm. | |||
|
77 | Value has to be greater then 0 and not equal 1 | |||
|
78 | */ | |||
|
79 | ||||
|
80 | /*! | |||
|
81 | \property QLogValueAxis::labelFormat | |||
|
82 | Defines the label format of the axis. | |||
|
83 | Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c | |||
|
84 | See QString::sprintf() for additional details. | |||
|
85 | */ | |||
|
86 | /*! | |||
|
87 | \qmlproperty real LogValuesAxis::labelFormat | |||
|
88 | Defines the label format of the axis. | |||
|
89 | Supported specifiers are: d, i, o, x, X, f, F, e, E, g, G, c | |||
|
90 | See QString::sprintf() for additional details. | |||
62 | */ |
|
91 | */ | |
63 |
|
92 | |||
64 | /*! |
|
93 | /*! | |
65 | \fn void QLogValueAxis::minChanged(qreal min) |
|
94 | \fn void QLogValueAxis::minChanged(qreal min) | |
66 | Axis emits signal when \a min of axis has changed. |
|
95 | Axis emits signal when \a min of axis has changed. | |
67 | */ |
|
96 | */ | |
68 | /*! |
|
97 | /*! | |
69 | \qmlsignal ValuesAxis::onMinChanged(qreal min) |
|
98 | \qmlsignal LogValuesAxis::onMinChanged(qreal min) | |
70 | Axis emits signal when \a min of axis has changed. |
|
99 | Axis emits signal when \a min of axis has changed. | |
71 | */ |
|
100 | */ | |
72 |
|
101 | |||
73 | /*! |
|
102 | /*! | |
74 | \fn void QLogValueAxis::maxChanged(qreal max) |
|
103 | \fn void QLogValueAxis::maxChanged(qreal max) | |
75 | Axis emits signal when \a max of axis has changed. |
|
104 | Axis emits signal when \a max of axis has changed. | |
76 | */ |
|
105 | */ | |
77 | /*! |
|
106 | /*! | |
78 | \qmlsignal ValuesAxis::onMaxChanged(qreal max) |
|
107 | \qmlsignal LogValuesAxis::onMaxChanged(qreal max) | |
79 | Axis emits signal when \a max of axis has changed. |
|
108 | Axis emits signal when \a max of axis has changed. | |
80 | */ |
|
109 | */ | |
81 |
|
110 | |||
82 | /*! |
|
111 | /*! | |
83 | \fn void QLogValueAxis::rangeChanged(qreal min, qreal max) |
|
112 | \fn void QLogValueAxis::rangeChanged(qreal min, qreal max) | |
84 | Axis emits signal when \a min or \a max of axis has changed. |
|
113 | Axis emits signal when \a min or \a max of axis has changed. | |
85 | */ |
|
114 | */ | |
86 |
|
115 | |||
87 | /*! |
|
116 | /*! | |
|
117 | \fn void QLogValueAxis::labelFormatChanged(const QString &format) | |||
|
118 | Axis emits signal when \a format of axis labels has changed. | |||
|
119 | */ | |||
|
120 | /*! | |||
|
121 | \qmlsignal LogValueAxis::labelFormatChanged(const QString &format) | |||
|
122 | Axis emits signal when \a format of axis labels has changed. | |||
|
123 | */ | |||
|
124 | ||||
|
125 | /*! | |||
|
126 | \fn void QLogValueAxis::baseChanged(qreal base) | |||
|
127 | Axis emits signal when \a base of logarithm of the axis has changed. | |||
|
128 | */ | |||
|
129 | /*! | |||
|
130 | \qmlsignal LogValuesAxis::baseChanged(qreal base) | |||
|
131 | Axis emits signal when \a base of logarithm of the axis has changed. | |||
|
132 | */ | |||
|
133 | ||||
|
134 | /*! | |||
88 | Constructs an axis object which is a child of \a parent. |
|
135 | Constructs an axis object which is a child of \a parent. | |
89 | */ |
|
136 | */ | |
90 | QLogValueAxis::QLogValueAxis(QObject *parent) : |
|
137 | QLogValueAxis::QLogValueAxis(QObject *parent) : | |
91 | QAbstractAxis(*new QLogValueAxisPrivate(this), parent) |
|
138 | QAbstractAxis(*new QLogValueAxisPrivate(this), parent) | |
92 | { |
|
139 | { | |
93 |
|
140 | |||
94 | } |
|
141 | } | |
95 |
|
142 | |||
96 | /*! |
|
143 | /*! | |
97 | \internal |
|
144 | \internal | |
98 | */ |
|
145 | */ | |
99 | QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent) |
|
146 | QLogValueAxis::QLogValueAxis(QLogValueAxisPrivate &d, QObject *parent) : QAbstractAxis(d, parent) | |
100 | { |
|
147 | { | |
101 |
|
148 | |||
102 | } |
|
149 | } | |
103 |
|
150 | |||
104 | /*! |
|
151 | /*! | |
105 | Destroys the object |
|
152 | Destroys the object | |
106 | */ |
|
153 | */ | |
107 | QLogValueAxis::~QLogValueAxis() |
|
154 | QLogValueAxis::~QLogValueAxis() | |
108 | { |
|
155 | { | |
109 | Q_D(QLogValueAxis); |
|
156 | Q_D(QLogValueAxis); | |
110 | if (d->m_chart) |
|
157 | if (d->m_chart) | |
111 | d->m_chart->removeAxis(this); |
|
158 | d->m_chart->removeAxis(this); | |
112 | } |
|
159 | } | |
113 |
|
160 | |||
114 | void QLogValueAxis::setMin(qreal min) |
|
161 | void QLogValueAxis::setMin(qreal min) | |
115 | { |
|
162 | { | |
116 | Q_D(QLogValueAxis); |
|
163 | Q_D(QLogValueAxis); | |
117 | setRange(min, qMax(d->m_max, min)); |
|
164 | setRange(min, qMax(d->m_max, min)); | |
118 | } |
|
165 | } | |
119 |
|
166 | |||
120 | qreal QLogValueAxis::min() const |
|
167 | qreal QLogValueAxis::min() const | |
121 | { |
|
168 | { | |
122 | Q_D(const QLogValueAxis); |
|
169 | Q_D(const QLogValueAxis); | |
123 | return d->m_min; |
|
170 | return d->m_min; | |
124 | } |
|
171 | } | |
125 |
|
172 | |||
126 | void QLogValueAxis::setMax(qreal max) |
|
173 | void QLogValueAxis::setMax(qreal max) | |
127 | { |
|
174 | { | |
128 | Q_D(QLogValueAxis); |
|
175 | Q_D(QLogValueAxis); | |
129 | setRange(qMin(d->m_min, max), max); |
|
176 | setRange(qMin(d->m_min, max), max); | |
130 | } |
|
177 | } | |
131 |
|
178 | |||
132 | qreal QLogValueAxis::max() const |
|
179 | qreal QLogValueAxis::max() const | |
133 | { |
|
180 | { | |
134 | Q_D(const QLogValueAxis); |
|
181 | Q_D(const QLogValueAxis); | |
135 | return d->m_max; |
|
182 | return d->m_max; | |
136 | } |
|
183 | } | |
137 |
|
184 | |||
138 | /*! |
|
185 | /*! | |
139 | Sets range from \a min to \a max on the axis. |
|
186 | Sets range from \a min to \a max on the axis. | |
140 | If min is greater than max then this function returns without making any changes. |
|
187 | If min is greater than max then this function returns without making any changes. | |
141 | */ |
|
188 | */ | |
142 | void QLogValueAxis::setRange(qreal min, qreal max) |
|
189 | void QLogValueAxis::setRange(qreal min, qreal max) | |
143 | { |
|
190 | { | |
144 | Q_D(QLogValueAxis); |
|
191 | Q_D(QLogValueAxis); | |
145 | bool changed = false; |
|
192 | bool changed = false; | |
146 |
|
193 | |||
147 | if (min > max) |
|
194 | if (min > max) | |
148 | return; |
|
195 | return; | |
149 |
|
196 | |||
150 | if (min > 0) { |
|
197 | if (min > 0) { | |
151 | if (!qFuzzyCompare(d->m_min, min)) { |
|
198 | if (!qFuzzyCompare(d->m_min, min)) { | |
152 | d->m_min = min; |
|
199 | d->m_min = min; | |
153 | changed = true; |
|
200 | changed = true; | |
154 | emit minChanged(min); |
|
201 | emit minChanged(min); | |
155 | } |
|
202 | } | |
156 |
|
203 | |||
157 | if (!qFuzzyCompare(d->m_max, max)) { |
|
204 | if (!qFuzzyCompare(d->m_max, max)) { | |
158 | d->m_max = max; |
|
205 | d->m_max = max; | |
159 | changed = true; |
|
206 | changed = true; | |
160 | emit maxChanged(max); |
|
207 | emit maxChanged(max); | |
161 | } |
|
208 | } | |
162 |
|
209 | |||
163 | if (changed) { |
|
210 | if (changed) { | |
164 | emit rangeChanged(min, max); |
|
211 | emit rangeChanged(min, max); | |
165 | emit d->rangeChanged(min,max); |
|
212 | emit d->rangeChanged(min,max); | |
166 | } |
|
213 | } | |
167 | } |
|
214 | } | |
168 | } |
|
215 | } | |
169 |
|
216 | |||
170 | void QLogValueAxis::setLabelFormat(const QString &format) |
|
217 | void QLogValueAxis::setLabelFormat(const QString &format) | |
171 | { |
|
218 | { | |
172 | Q_D(QLogValueAxis); |
|
219 | Q_D(QLogValueAxis); | |
173 | d->m_format = format; |
|
220 | d->m_format = format; | |
174 | emit labelFormatChanged(format); |
|
221 | emit labelFormatChanged(format); | |
175 | } |
|
222 | } | |
176 |
|
223 | |||
177 | QString QLogValueAxis::labelFormat() const |
|
224 | QString QLogValueAxis::labelFormat() const | |
178 | { |
|
225 | { | |
179 | Q_D(const QLogValueAxis); |
|
226 | Q_D(const QLogValueAxis); | |
180 | return d->m_format; |
|
227 | return d->m_format; | |
181 | } |
|
228 | } | |
182 |
|
229 | |||
183 | void QLogValueAxis::setBase(qreal base) |
|
230 | void QLogValueAxis::setBase(qreal base) | |
184 | { |
|
231 | { | |
185 | // check if base is correct |
|
232 | // check if base is correct | |
186 | if (qFuzzyCompare(base, 1)) |
|
233 | if (qFuzzyCompare(base, 1)) | |
187 | return; |
|
234 | return; | |
188 |
|
235 | |||
189 | if (base > 0) { |
|
236 | if (base > 0) { | |
190 | Q_D(QLogValueAxis); |
|
237 | Q_D(QLogValueAxis); | |
191 | d->m_base = base; |
|
238 | d->m_base = base; | |
192 | emit baseChanged(base); |
|
239 | emit baseChanged(base); | |
193 | } |
|
240 | } | |
194 | } |
|
241 | } | |
195 |
|
242 | |||
196 | qreal QLogValueAxis::base() const |
|
243 | qreal QLogValueAxis::base() const | |
197 | { |
|
244 | { | |
198 | Q_D(const QLogValueAxis); |
|
245 | Q_D(const QLogValueAxis); | |
199 | return d->m_base; |
|
246 | return d->m_base; | |
200 | } |
|
247 | } | |
201 |
|
248 | |||
202 | /*! |
|
249 | /*! | |
203 | Returns the type of the axis |
|
250 | Returns the type of the axis | |
204 | */ |
|
251 | */ | |
205 | QAbstractAxis::AxisType QLogValueAxis::type() const |
|
252 | QAbstractAxis::AxisType QLogValueAxis::type() const | |
206 | { |
|
253 | { | |
207 | return AxisTypeLogValue; |
|
254 | return AxisTypeLogValue; | |
208 | } |
|
255 | } | |
209 |
|
256 | |||
210 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
257 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
211 |
|
258 | |||
212 | QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q) |
|
259 | QLogValueAxisPrivate::QLogValueAxisPrivate(QLogValueAxis *q) | |
213 | : QAbstractAxisPrivate(q), |
|
260 | : QAbstractAxisPrivate(q), | |
214 | m_min(1), |
|
261 | m_min(1), | |
215 | m_max(1), |
|
262 | m_max(1), | |
216 | m_base(10), |
|
263 | m_base(10), | |
217 | m_format(QString::null) |
|
264 | m_format(QString::null) | |
218 | { |
|
265 | { | |
219 | } |
|
266 | } | |
220 |
|
267 | |||
221 | QLogValueAxisPrivate::~QLogValueAxisPrivate() |
|
268 | QLogValueAxisPrivate::~QLogValueAxisPrivate() | |
222 | { |
|
269 | { | |
223 |
|
270 | |||
224 | } |
|
271 | } | |
225 |
|
272 | |||
226 | void QLogValueAxisPrivate::setMin(const QVariant &min) |
|
273 | void QLogValueAxisPrivate::setMin(const QVariant &min) | |
227 | { |
|
274 | { | |
228 | Q_Q(QLogValueAxis); |
|
275 | Q_Q(QLogValueAxis); | |
229 | bool ok; |
|
276 | bool ok; | |
230 | qreal value = min.toReal(&ok); |
|
277 | qreal value = min.toReal(&ok); | |
231 | if (ok) |
|
278 | if (ok) | |
232 | q->setMin(value); |
|
279 | q->setMin(value); | |
233 | } |
|
280 | } | |
234 |
|
281 | |||
235 | void QLogValueAxisPrivate::setMax(const QVariant &max) |
|
282 | void QLogValueAxisPrivate::setMax(const QVariant &max) | |
236 | { |
|
283 | { | |
237 |
|
284 | |||
238 | Q_Q(QLogValueAxis); |
|
285 | Q_Q(QLogValueAxis); | |
239 | bool ok; |
|
286 | bool ok; | |
240 | qreal value = max.toReal(&ok); |
|
287 | qreal value = max.toReal(&ok); | |
241 | if (ok) |
|
288 | if (ok) | |
242 | q->setMax(value); |
|
289 | q->setMax(value); | |
243 | } |
|
290 | } | |
244 |
|
291 | |||
245 | void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max) |
|
292 | void QLogValueAxisPrivate::setRange(const QVariant &min, const QVariant &max) | |
246 | { |
|
293 | { | |
247 | Q_Q(QLogValueAxis); |
|
294 | Q_Q(QLogValueAxis); | |
248 | bool ok1; |
|
295 | bool ok1; | |
249 | bool ok2; |
|
296 | bool ok2; | |
250 | qreal value1 = min.toReal(&ok1); |
|
297 | qreal value1 = min.toReal(&ok1); | |
251 | qreal value2 = max.toReal(&ok2); |
|
298 | qreal value2 = max.toReal(&ok2); | |
252 | if (ok1 && ok2) |
|
299 | if (ok1 && ok2) | |
253 | q->setRange(value1, value2); |
|
300 | q->setRange(value1, value2); | |
254 | } |
|
301 | } | |
255 |
|
302 | |||
256 | void QLogValueAxisPrivate::setRange(qreal min, qreal max) |
|
303 | void QLogValueAxisPrivate::setRange(qreal min, qreal max) | |
257 | { |
|
304 | { | |
258 | Q_Q(QLogValueAxis); |
|
305 | Q_Q(QLogValueAxis); | |
259 | bool changed = false; |
|
306 | bool changed = false; | |
260 |
|
307 | |||
261 | if (min > max) |
|
308 | if (min > max) | |
262 | return; |
|
309 | return; | |
263 |
|
310 | |||
264 | if (min > 0) { |
|
311 | if (min > 0) { | |
265 | if (!qFuzzyCompare(m_min, min)) { |
|
312 | if (!qFuzzyCompare(m_min, min)) { | |
266 | m_min = min; |
|
313 | m_min = min; | |
267 | changed = true; |
|
314 | changed = true; | |
268 | emit q->minChanged(min); |
|
315 | emit q->minChanged(min); | |
269 | } |
|
316 | } | |
270 |
|
317 | |||
271 | if (!qFuzzyCompare(m_max, max)) { |
|
318 | if (!qFuzzyCompare(m_max, max)) { | |
272 | m_max = max; |
|
319 | m_max = max; | |
273 | changed = true; |
|
320 | changed = true; | |
274 | emit q->maxChanged(max); |
|
321 | emit q->maxChanged(max); | |
275 | } |
|
322 | } | |
276 |
|
323 | |||
277 | if (changed) { |
|
324 | if (changed) { | |
278 | emit rangeChanged(min,max); |
|
325 | emit rangeChanged(min,max); | |
279 | emit q->rangeChanged(min, max); |
|
326 | emit q->rangeChanged(min, max); | |
280 | } |
|
327 | } | |
281 | } |
|
328 | } | |
282 | } |
|
329 | } | |
283 |
|
330 | |||
284 | void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem* parent) |
|
331 | void QLogValueAxisPrivate::initializeGraphics(QGraphicsItem* parent) | |
285 | { |
|
332 | { | |
286 | Q_Q(QLogValueAxis); |
|
333 | Q_Q(QLogValueAxis); | |
287 | ChartAxis* axis(0); |
|
334 | ChartAxis* axis(0); | |
288 | if (orientation() == Qt::Vertical) |
|
335 | if (orientation() == Qt::Vertical) | |
289 | axis = new ChartLogValueAxisY(q,parent); |
|
336 | axis = new ChartLogValueAxisY(q,parent); | |
290 | if (orientation() == Qt::Horizontal) |
|
337 | if (orientation() == Qt::Horizontal) | |
291 | axis = new ChartLogValueAxisX(q,parent); |
|
338 | axis = new ChartLogValueAxisX(q,parent); | |
292 |
|
339 | |||
293 | m_item.reset(axis); |
|
340 | m_item.reset(axis); | |
294 | QAbstractAxisPrivate::initializeGraphics(parent); |
|
341 | QAbstractAxisPrivate::initializeGraphics(parent); | |
295 | } |
|
342 | } | |
296 |
|
343 | |||
297 |
|
344 | |||
298 | void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain) |
|
345 | void QLogValueAxisPrivate::initializeDomain(AbstractDomain *domain) | |
299 | { |
|
346 | { | |
300 | if (orientation() == Qt::Vertical) { |
|
347 | if (orientation() == Qt::Vertical) { | |
301 | if(!qFuzzyCompare(m_max, m_min)) { |
|
348 | if(!qFuzzyCompare(m_max, m_min)) { | |
302 | domain->setRangeY(m_min, m_max); |
|
349 | domain->setRangeY(m_min, m_max); | |
303 | } |
|
350 | } | |
304 | else if ( domain->minY() > 0) { |
|
351 | else if ( domain->minY() > 0) { | |
305 | setRange(domain->minY(), domain->maxY()); |
|
352 | setRange(domain->minY(), domain->maxY()); | |
306 | } else { |
|
353 | } else { | |
307 | domain->setRangeY(m_min, domain->maxY()); |
|
354 | domain->setRangeY(m_min, domain->maxY()); | |
308 | } |
|
355 | } | |
309 | } |
|
356 | } | |
310 | if (orientation() == Qt::Horizontal) { |
|
357 | if (orientation() == Qt::Horizontal) { | |
311 | if(!qFuzzyCompare(m_max, m_min)) { |
|
358 | if(!qFuzzyCompare(m_max, m_min)) { | |
312 | domain->setRangeX(m_min, m_max); |
|
359 | domain->setRangeX(m_min, m_max); | |
313 | } |
|
360 | } | |
314 | else if (domain->minX() > 0){ |
|
361 | else if (domain->minX() > 0){ | |
315 | setRange(domain->minX(), domain->maxX()); |
|
362 | setRange(domain->minX(), domain->maxX()); | |
316 | } else { |
|
363 | } else { | |
317 | domain->setRangeX(m_min, domain->maxX()); |
|
364 | domain->setRangeX(m_min, domain->maxX()); | |
318 | } |
|
365 | } | |
319 | } |
|
366 | } | |
320 | } |
|
367 | } | |
321 |
|
368 | |||
322 | #include "moc_qlogvalueaxis.cpp" |
|
369 | #include "moc_qlogvalueaxis.cpp" | |
323 | #include "moc_qlogvalueaxis_p.cpp" |
|
370 | #include "moc_qlogvalueaxis_p.cpp" | |
324 |
|
371 | |||
325 | QTCOMMERCIALCHART_END_NAMESPACE |
|
372 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now