##// END OF EJS Templates
barcategories axis initialisation crash commented out. add to known issues list
sauimone -
r1664:8fb25c9f2d87
parent child
Show More
@@ -1,432 +1,442
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 "qbarcategoriesaxis.h"
21 #include "qbarcategoriesaxis.h"
22 #include "qbarcategoriesaxis_p.h"
22 #include "qbarcategoriesaxis_p.h"
23 #include "chartcategoriesaxisx_p.h"
23 #include "chartcategoriesaxisx_p.h"
24 #include "chartcategoriesaxisy_p.h"
24 #include "chartcategoriesaxisy_p.h"
25 #include "domain_p.h"
25 #include "domain_p.h"
26 #include <qmath.h>
26 #include <qmath.h>
27 #include <QDebug>
27 #include <QDebug>
28
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 /*!
30 /*!
31 \class QBarCategoriesAxis
31 \class QBarCategoriesAxis
32 \brief The QBarCategoriesAxis class is used for manipulating chart's axis.
32 \brief The QBarCategoriesAxis class is used for manipulating chart's axis.
33 \mainclass
33 \mainclass
34
34
35 BarCategoriesAxis can be setup to show axis line with tick marks, grid lines and shades.
35 BarCategoriesAxis can be setup to show axis line with tick marks, grid lines and shades.
36 Categories are drawn between ticks. Note that you can use this also with lineseries too.
36 Categories are drawn between ticks. Note that you can use this also with lineseries too.
37 See the \l {Line and BarChart Example} {Line and BarChart Example} to learn how to do that.
37 See the \l {Line and BarChart Example} {Line and BarChart Example} to learn how to do that.
38 */
38 */
39
39
40 /*!
40 /*!
41 \qmlclass BarCategoriesAxis QBarCategoriesAxis
41 \qmlclass BarCategoriesAxis QBarCategoriesAxis
42 \brief The Axis element is used for manipulating chart's axes.
42 \brief The Axis element is used for manipulating chart's axes.
43
43
44 Axis can be setup to show axis line with tick marks, grid lines and shades.
44 Axis can be setup to show axis line with tick marks, grid lines and shades.
45 Categories are drawn between ticks. Note that you can use this also with lineseries too.
45 Categories are drawn between ticks. Note that you can use this also with lineseries too.
46
46
47 To access BarCategoriesAxis you can use ChartView API. For example:
47 To access BarCategoriesAxis you can use ChartView API. For example:
48 \code
48 \code
49 ChartView {
49 ChartView {
50 BarCategoriesAxis {
50 BarCategoriesAxis {
51 id: categoryAxis
51 id: categoryAxis
52 categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
52 categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun" ]
53 }
53 }
54 // Add a few series...
54 // Add a few series...
55 }
55 }
56 \endcode
56 \endcode
57 */
57 */
58
58
59 /*!
59 /*!
60 \property QBarCategoriesAxis::categories
60 \property QBarCategoriesAxis::categories
61 Defines the categories of axis
61 Defines the categories of axis
62 */
62 */
63 /*!
63 /*!
64 \qmlproperty QStringList BarCategoriesAxis::categories
64 \qmlproperty QStringList BarCategoriesAxis::categories
65 Defines the categories of axis
65 Defines the categories of axis
66 */
66 */
67
67
68 /*!
68 /*!
69 \property QBarCategoriesAxis::min
69 \property QBarCategoriesAxis::min
70 Defines the minimum value on the axis.
70 Defines the minimum value on the axis.
71 */
71 */
72 /*!
72 /*!
73 \qmlproperty QString BarCategoriesAxis::min
73 \qmlproperty QString BarCategoriesAxis::min
74 Defines the minimum value on the axis.
74 Defines the minimum value on the axis.
75 */
75 */
76
76
77 /*!
77 /*!
78 \property QBarCategoriesAxis::max
78 \property QBarCategoriesAxis::max
79 Defines the maximum value on the axis.
79 Defines the maximum value on the axis.
80 */
80 */
81 /*!
81 /*!
82 \qmlproperty QString BarCategoriesAxis::max
82 \qmlproperty QString BarCategoriesAxis::max
83 Defines the maximum value on the axis.
83 Defines the maximum value on the axis.
84 */
84 */
85
85
86
86
87 /*!
87 /*!
88 \fn void QBarCategoriesAxis::categoriesChanged()
88 \fn void QBarCategoriesAxis::categoriesChanged()
89 Axis emits signal when the categories of the axis has changed.
89 Axis emits signal when the categories of the axis has changed.
90 */
90 */
91 /*!
91 /*!
92 \fn void QBarCategoriesAxis::minChanged(const QString &min)
92 \fn void QBarCategoriesAxis::minChanged(const QString &min)
93 Axis emits signal when \a min of axis has changed.
93 Axis emits signal when \a min of axis has changed.
94 */
94 */
95 /*!
95 /*!
96 \qmlsignal BarCategoriesAxis::onMinChanged(const QString &min)
96 \qmlsignal BarCategoriesAxis::onMinChanged(const QString &min)
97 Axis emits signal when \a min of axis has changed.
97 Axis emits signal when \a min of axis has changed.
98 */
98 */
99
99
100 /*!
100 /*!
101 \fn void QBarCategoriesAxis::maxChanged(const QString &max)
101 \fn void QBarCategoriesAxis::maxChanged(const QString &max)
102 Axis emits signal when \a max of axis has changed.
102 Axis emits signal when \a max of axis has changed.
103 */
103 */
104 /*!
104 /*!
105 \qmlsignal BarCategoriesAxis::onMaxChanged(const QString &max)
105 \qmlsignal BarCategoriesAxis::onMaxChanged(const QString &max)
106 Axis emits signal when \a max of axis has changed.
106 Axis emits signal when \a max of axis has changed.
107 */
107 */
108
108
109 /*!
109 /*!
110 \fn void QBarCategoriesAxis::rangeChanged(const QString &min, const QString &max)
110 \fn void QBarCategoriesAxis::rangeChanged(const QString &min, const QString &max)
111 Axis emits signal when \a min or \a max of axis has changed.
111 Axis emits signal when \a min or \a max of axis has changed.
112 */
112 */
113
113
114 /*!
114 /*!
115 Constructs an axis object which is a child of \a parent.
115 Constructs an axis object which is a child of \a parent.
116 */
116 */
117 QBarCategoriesAxis::QBarCategoriesAxis(QObject *parent):
117 QBarCategoriesAxis::QBarCategoriesAxis(QObject *parent):
118 QAbstractAxis(*new QBarCategoriesAxisPrivate(this),parent)
118 QAbstractAxis(*new QBarCategoriesAxisPrivate(this),parent)
119 {
119 {
120 }
120 }
121
121
122 /*!
122 /*!
123 Destroys the object
123 Destroys the object
124 */
124 */
125 QBarCategoriesAxis::~QBarCategoriesAxis()
125 QBarCategoriesAxis::~QBarCategoriesAxis()
126 {
126 {
127 }
127 }
128
128
129 /*!
129 /*!
130 \internal
130 \internal
131 */
131 */
132 QBarCategoriesAxis::QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent)
132 QBarCategoriesAxis::QBarCategoriesAxis(QBarCategoriesAxisPrivate &d,QObject *parent):QAbstractAxis(d,parent)
133 {
133 {
134
134
135 }
135 }
136
136
137 /*!
137 /*!
138 Appends \a categories to axis
138 Appends \a categories to axis
139 */
139 */
140 void QBarCategoriesAxis::append(const QStringList &categories)
140 void QBarCategoriesAxis::append(const QStringList &categories)
141 {
141 {
142 if(categories.isEmpty()) return;
142 if(categories.isEmpty()) return;
143
143
144 Q_D(QBarCategoriesAxis);
144 Q_D(QBarCategoriesAxis);
145 if (d->m_categories.isEmpty()) {
145 if (d->m_categories.isEmpty()) {
146 d->m_categories.append(categories);
146 d->m_categories.append(categories);
147 setRange(categories.first(),categories.last());
147 setRange(categories.first(),categories.last());
148 }else{
148 }else{
149 d->m_categories.append(categories);
149 d->m_categories.append(categories);
150 }
150 }
151 emit d->updated();
151 emit d->updated();
152 emit categoriesChanged();
152 emit categoriesChanged();
153 }
153 }
154
154
155 /*!
155 /*!
156 Appends \a category to axis
156 Appends \a category to axis
157 */
157 */
158 void QBarCategoriesAxis::append(const QString &category)
158 void QBarCategoriesAxis::append(const QString &category)
159 {
159 {
160 Q_D(QBarCategoriesAxis);
160 Q_D(QBarCategoriesAxis);
161 if (d->m_categories.isEmpty()) {
161 if (d->m_categories.isEmpty()) {
162 d->m_categories.append(category);
162 d->m_categories.append(category);
163 setRange(category,category);
163 setRange(category,category);
164 }else{
164 }else{
165 d->m_categories.append(category);
165 d->m_categories.append(category);
166 }
166 }
167 emit d->updated();
167 emit d->updated();
168 emit categoriesChanged();
168 emit categoriesChanged();
169 }
169 }
170
170
171 /*!
171 /*!
172 Removes \a category from axis
172 Removes \a category from axis
173 */
173 */
174 void QBarCategoriesAxis::remove(const QString &category)
174 void QBarCategoriesAxis::remove(const QString &category)
175 {
175 {
176 Q_D(QBarCategoriesAxis);
176 Q_D(QBarCategoriesAxis);
177 if (d->m_categories.contains(category)) {
177 if (d->m_categories.contains(category)) {
178 d->m_categories.removeAt(d->m_categories.indexOf(category));
178 d->m_categories.removeAt(d->m_categories.indexOf(category));
179 setRange(d->m_categories.first(),d->m_categories.last());
179 setRange(d->m_categories.first(),d->m_categories.last());
180 emit d->updated();
180 emit d->updated();
181 emit categoriesChanged();
181 emit categoriesChanged();
182 }
182 }
183 }
183 }
184
184
185 /*!
185 /*!
186 Inserts \a category to axis at \a index
186 Inserts \a category to axis at \a index
187 */
187 */
188 void QBarCategoriesAxis::insert(int index, const QString &category)
188 void QBarCategoriesAxis::insert(int index, const QString &category)
189 {
189 {
190 Q_D(QBarCategoriesAxis);
190 Q_D(QBarCategoriesAxis);
191 if (d->m_categories.isEmpty()) {
191 if (d->m_categories.isEmpty()) {
192 d->m_categories.insert(index,category);
192 d->m_categories.insert(index,category);
193 setRange(category,category);
193 setRange(category,category);
194 }else{
194 }else{
195 d->m_categories.insert(index,category);
195 d->m_categories.insert(index,category);
196 }
196 }
197 emit d->updated();
197 emit d->updated();
198 emit categoriesChanged();
198 emit categoriesChanged();
199 }
199 }
200
200
201 /*!
201 /*!
202 Removes all categories.
202 Removes all categories.
203 */
203 */
204 void QBarCategoriesAxis::clear()
204 void QBarCategoriesAxis::clear()
205 {
205 {
206 Q_D(QBarCategoriesAxis);
206 Q_D(QBarCategoriesAxis);
207 d->m_categories.clear();
207 d->m_categories.clear();
208 setRange(QString::null,QString::null);
208 setRange(QString::null,QString::null);
209 emit d->updated();
209 emit d->updated();
210 emit categoriesChanged();
210 emit categoriesChanged();
211 }
211 }
212
212
213 void QBarCategoriesAxis::setCategories(const QStringList &categories)
213 void QBarCategoriesAxis::setCategories(const QStringList &categories)
214 {
214 {
215 Q_D(QBarCategoriesAxis);
215 Q_D(QBarCategoriesAxis);
216 if(d->m_categories!=categories){
216 if(d->m_categories!=categories){
217 d->m_categories = categories;
217 d->m_categories = categories;
218 setRange(categories.first(),categories.last());
218 setRange(categories.first(),categories.last());
219 emit d->updated();
219 emit d->updated();
220 emit categoriesChanged();
220 emit categoriesChanged();
221 }
221 }
222 }
222 }
223
223
224 QStringList QBarCategoriesAxis::categories()
224 QStringList QBarCategoriesAxis::categories()
225 {
225 {
226 Q_D(QBarCategoriesAxis);
226 Q_D(QBarCategoriesAxis);
227 return d->m_categories;
227 return d->m_categories;
228 }
228 }
229
229
230 /*!
230 /*!
231 Returns number of categories.
231 Returns number of categories.
232 */
232 */
233 int QBarCategoriesAxis::count() const
233 int QBarCategoriesAxis::count() const
234 {
234 {
235 Q_D(const QBarCategoriesAxis);
235 Q_D(const QBarCategoriesAxis);
236 return d->m_categories.count();
236 return d->m_categories.count();
237 }
237 }
238
238
239 /*!
239 /*!
240 Returns category at \a index. Index must be valid.
240 Returns category at \a index. Index must be valid.
241 */
241 */
242 QString QBarCategoriesAxis::at(int index) const
242 QString QBarCategoriesAxis::at(int index) const
243 {
243 {
244 Q_D(const QBarCategoriesAxis);
244 Q_D(const QBarCategoriesAxis);
245 return d->m_categories.at(index);
245 return d->m_categories.at(index);
246 }
246 }
247
247
248 /*!
248 /*!
249 Sets minimum category to \a min.
249 Sets minimum category to \a min.
250 */
250 */
251 void QBarCategoriesAxis::setMin(const QString& min)
251 void QBarCategoriesAxis::setMin(const QString& min)
252 {
252 {
253 Q_D(QBarCategoriesAxis);
253 Q_D(QBarCategoriesAxis);
254 setRange(min,d->m_maxCategory);
254 setRange(min,d->m_maxCategory);
255 }
255 }
256
256
257 /*!
257 /*!
258 Returns minimum category.
258 Returns minimum category.
259 */
259 */
260 QString QBarCategoriesAxis::min() const
260 QString QBarCategoriesAxis::min() const
261 {
261 {
262 Q_D(const QBarCategoriesAxis);
262 Q_D(const QBarCategoriesAxis);
263 return d->m_minCategory;
263 return d->m_minCategory;
264 }
264 }
265
265
266 /*!
266 /*!
267 Sets maximum category to \a max.
267 Sets maximum category to \a max.
268 */
268 */
269 void QBarCategoriesAxis::setMax(const QString& max)
269 void QBarCategoriesAxis::setMax(const QString& max)
270 {
270 {
271 Q_D(QBarCategoriesAxis);
271 Q_D(QBarCategoriesAxis);
272 setRange(d->m_minCategory,max);
272 setRange(d->m_minCategory,max);
273 }
273 }
274
274
275 /*!
275 /*!
276 Returns maximum category
276 Returns maximum category
277 */
277 */
278 QString QBarCategoriesAxis::max() const
278 QString QBarCategoriesAxis::max() const
279 {
279 {
280 Q_D(const QBarCategoriesAxis);
280 Q_D(const QBarCategoriesAxis);
281 return d->m_maxCategory;
281 return d->m_maxCategory;
282 }
282 }
283
283
284 /*!
284 /*!
285 Sets range from \a minCategory to \a maxCategory
285 Sets range from \a minCategory to \a maxCategory
286 */
286 */
287 void QBarCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory)
287 void QBarCategoriesAxis::setRange(const QString& minCategory, const QString& maxCategory)
288 {
288 {
289 Q_D(QBarCategoriesAxis);
289 Q_D(QBarCategoriesAxis);
290
290
291 int minIndex = d->m_categories.indexOf(minCategory);
291 int minIndex = d->m_categories.indexOf(minCategory);
292 if (minIndex == -1) {
292 if (minIndex == -1) {
293 return;
293 return;
294 }
294 }
295 int maxIndex = d->m_categories.indexOf(maxCategory);
295 int maxIndex = d->m_categories.indexOf(maxCategory);
296 if (maxIndex == -1) {
296 if (maxIndex == -1) {
297 return;
297 return;
298 }
298 }
299
299
300 if (maxIndex <= minIndex) {
300 if (maxIndex <= minIndex) {
301 // max must be greater than min
301 // max must be greater than min
302 return;
302 return;
303 }
303 }
304
304
305 bool changed = false;
305 bool changed = false;
306 if (!qFuzzyIsNull(d->m_min - (minIndex))||d->m_minCategory!=minCategory) {
306 if (!qFuzzyIsNull(d->m_min - (minIndex))||d->m_minCategory!=minCategory) {
307 d->m_minCategory = minCategory;
307 d->m_minCategory = minCategory;
308 d->m_min = minIndex;
308 d->m_min = minIndex;
309 emit minChanged(minCategory);
309 emit minChanged(minCategory);
310 changed = true;
310 changed = true;
311 }
311 }
312
312
313 if (!qFuzzyIsNull(d->m_max - (maxIndex))||d->m_maxCategory!=maxCategory ) {
313 if (!qFuzzyIsNull(d->m_max - (maxIndex))||d->m_maxCategory!=maxCategory ) {
314 d->m_max = maxIndex;
314 d->m_max = maxIndex;
315 d->m_maxCategory = maxCategory;
315 d->m_maxCategory = maxCategory;
316 emit maxChanged(maxCategory);
316 emit maxChanged(maxCategory);
317 changed = true;
317 changed = true;
318 }
318 }
319
319
320 if (changed) {
320 if (changed) {
321 d->emitRange();
321 d->emitRange();
322 }
322 }
323 }
323 }
324
324
325 /*!
325 /*!
326 Returns the type of the axis
326 Returns the type of the axis
327 */
327 */
328 QAbstractAxis::AxisType QBarCategoriesAxis::type() const
328 QAbstractAxis::AxisType QBarCategoriesAxis::type() const
329 {
329 {
330 return AxisTypeCategories;
330 return AxisTypeCategories;
331 }
331 }
332
332
333 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
333 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
334
334
335 QBarCategoriesAxisPrivate::QBarCategoriesAxisPrivate(QBarCategoriesAxis* q):
335 QBarCategoriesAxisPrivate::QBarCategoriesAxisPrivate(QBarCategoriesAxis* q):
336 QAbstractAxisPrivate(q)
336 QAbstractAxisPrivate(q)
337 {
337 {
338
338
339 }
339 }
340
340
341 QBarCategoriesAxisPrivate::~QBarCategoriesAxisPrivate()
341 QBarCategoriesAxisPrivate::~QBarCategoriesAxisPrivate()
342 {
342 {
343
343
344 }
344 }
345
345
346 void QBarCategoriesAxisPrivate::setMin(const QVariant &min)
346 void QBarCategoriesAxisPrivate::setMin(const QVariant &min)
347 {
347 {
348 setRange(min,m_maxCategory);
348 setRange(min,m_maxCategory);
349 }
349 }
350
350
351 void QBarCategoriesAxisPrivate::setMax(const QVariant &max)
351 void QBarCategoriesAxisPrivate::setMax(const QVariant &max)
352 {
352 {
353 setRange(m_minCategory,max);
353 setRange(m_minCategory,max);
354 }
354 }
355
355
356 void QBarCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max)
356 void QBarCategoriesAxisPrivate::setRange(const QVariant &min, const QVariant &max)
357 {
357 {
358 Q_Q(QBarCategoriesAxis);
358 Q_Q(QBarCategoriesAxis);
359 QString value1 = min.toString();
359 QString value1 = min.toString();
360 QString value2 = max.toString();
360 QString value2 = max.toString();
361 q->setRange(value1,value2);
361 q->setRange(value1,value2);
362 }
362 }
363
363
364 int QBarCategoriesAxisPrivate::ticksCount() const
364 int QBarCategoriesAxisPrivate::ticksCount() const
365 {
365 {
366 return m_categories.count()+1;
366 return m_categories.count()+1;
367 }
367 }
368
368
369 void QBarCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count)
369 void QBarCategoriesAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count)
370 {
370 {
371 Q_Q(QBarCategoriesAxis);
371 // Q_Q(QBarCategoriesAxis);
372 Q_UNUSED(count);
373 m_min = min;
372 m_min = min;
374 m_max = max;
373 m_max = max;
374 m_ticksCount = count;
375 // TODO: causes crash in some situations. added to known issues
376 /*
375 int minIndex = qFloor(min);
377 int minIndex = qFloor(min);
376 int maxIndex = qFloor(max);
378 int maxIndex = qFloor(max);
377
379
378 if (minIndex < 0) {
380 if (minIndex < 0) {
379 minIndex = 0;
381 minIndex = 0;
380 }
382 }
381 if (maxIndex > m_categories.count()-1){
383 if (maxIndex > m_categories.count()-1){
382 maxIndex = m_categories.count()-1;
384 maxIndex = m_categories.count()-1;
385 if (maxIndex<0) {
386 maxIndex = 0;
387 }
383 }
388 }
384
389
385 bool changed = false;
390 bool changed = false;
386 if (m_minCategory != m_categories.at(minIndex)) {
391 if (m_minCategory != m_categories.at(minIndex)) {
387 m_minCategory = m_categories.at(minIndex);
392 m_minCategory = m_categories.at(minIndex);
388 emit q->minChanged(m_minCategory);
393 emit q->minChanged(m_minCategory);
389 changed = true;
394 changed = true;
390 }
395 }
391
396
392 if (m_maxCategory != m_categories.at(maxIndex)) {
397 if (m_maxCategory != m_categories.at(maxIndex)) {
393 m_maxCategory = m_categories.at(maxIndex);
398 m_maxCategory = m_categories.at(maxIndex);
394 emit q->maxChanged(m_maxCategory);
399 emit q->maxChanged(m_maxCategory);
395 changed = true;
400 changed = true;
396 }
401 }
397
402
398 if (changed) {
403 if (changed) {
399 emit q->rangeChanged(m_minCategory, m_maxCategory);
404 emit q->rangeChanged(m_minCategory, m_maxCategory);
400 }
405 }
406 */
401 }
407 }
402
408
403 ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter)
409 ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter)
404 {
410 {
405 Q_Q(QBarCategoriesAxis);
411 Q_Q(QBarCategoriesAxis);
406 if(m_orientation == Qt::Vertical){
412 if(m_orientation == Qt::Vertical){
407 return new ChartCategoriesAxisY(q,presenter);
413 return new ChartCategoriesAxisY(q,presenter);
408 }else{
414 }else{
409 return new ChartCategoriesAxisX(q,presenter);
415 return new ChartCategoriesAxisX(q,presenter);
410 }
416 }
411 }
417 }
412
418
413 void QBarCategoriesAxisPrivate::emitRange()
419 void QBarCategoriesAxisPrivate::emitRange()
414 {
420 {
415 emit changed(m_min -0.5, m_max +0.5, qCeil(m_max + 0.5) -qCeil(m_min - 0.5) +1, false);
421 emit changed(m_min -0.5, m_max +0.5, qCeil(m_max + 0.5) -qCeil(m_min - 0.5) +1, false);
416 }
422 }
417
423
418 void QBarCategoriesAxisPrivate::initialize(Domain* domain)
424 void QBarCategoriesAxisPrivate::initialize(Domain* domain)
419 {
425 {
426 Q_UNUSED(domain);
427 // TODO: this causes crash now. added to known issues.
428 /*
420 if (qFuzzyCompare(m_max, m_min)) {
429 if (qFuzzyCompare(m_max, m_min)) {
421 if(m_orientation==Qt::Vertical){
430 if(m_orientation==Qt::Vertical){
422 handleAxisRangeChanged(domain->minY(),domain->maxY(),domain->tickXCount());
431 handleAxisRangeChanged(domain->minY(),domain->maxY(),domain->tickXCount());
423 }else{
432 }else{
424 handleAxisRangeChanged(domain->minX(),domain->maxX(),domain->tickYCount());
433 handleAxisRangeChanged(domain->minX(),domain->maxX(),domain->tickYCount());
425 }
434 }
426 }
435 }
436 */
427 }
437 }
428
438
429 #include "moc_qbarcategoriesaxis.cpp"
439 #include "moc_qbarcategoriesaxis.cpp"
430 #include "moc_qbarcategoriesaxis_p.cpp"
440 #include "moc_qbarcategoriesaxis_p.cpp"
431
441
432 QTCOMMERCIALCHART_END_NAMESPACE
442 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now