@@ -368,10 +368,36 int QBarCategoriesAxisPrivate::ticksCount() const | |||||
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); | |||
|
372 | Q_UNUSED(count); | |||
371 | m_min = min; |
|
373 | m_min = min; | |
372 | m_max = max; |
|
374 | m_max = max; | |
373 | m_ticksCount = count; |
|
375 | int minIndex = qFloor(min); | |
374 | //TODO: |
|
376 | int maxIndex = qFloor(max); | |
|
377 | ||||
|
378 | if (minIndex < 0) { | |||
|
379 | minIndex = 0; | |||
|
380 | } | |||
|
381 | if (maxIndex > m_categories.count()-1){ | |||
|
382 | maxIndex = m_categories.count()-1; | |||
|
383 | } | |||
|
384 | ||||
|
385 | bool changed = false; | |||
|
386 | if (m_minCategory != m_categories.at(minIndex)) { | |||
|
387 | m_minCategory = m_categories.at(minIndex); | |||
|
388 | emit q->minChanged(m_minCategory); | |||
|
389 | changed = true; | |||
|
390 | } | |||
|
391 | ||||
|
392 | if (m_maxCategory != m_categories.at(maxIndex)) { | |||
|
393 | m_maxCategory = m_categories.at(maxIndex); | |||
|
394 | emit q->maxChanged(m_maxCategory); | |||
|
395 | changed = true; | |||
|
396 | } | |||
|
397 | ||||
|
398 | if (changed) { | |||
|
399 | emit q->rangeChanged(m_minCategory, m_maxCategory); | |||
|
400 | } | |||
375 | } |
|
401 | } | |
376 |
|
402 | |||
377 | ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) |
|
403 | ChartAxis* QBarCategoriesAxisPrivate::createGraphics(ChartPresenter* presenter) | |
@@ -391,8 +417,13 void QBarCategoriesAxisPrivate::emitRange() | |||||
391 |
|
417 | |||
392 | void QBarCategoriesAxisPrivate::initialize(Domain* domain) |
|
418 | void QBarCategoriesAxisPrivate::initialize(Domain* domain) | |
393 | { |
|
419 | { | |
394 | Q_UNUSED(domain); |
|
420 | if (qFuzzyCompare(m_max, m_min)) { | |
395 | //TODO: |
|
421 | if(m_orientation==Qt::Vertical){ | |
|
422 | handleAxisRangeChanged(domain->minY(),domain->maxY(),domain->tickXCount()); | |||
|
423 | }else{ | |||
|
424 | handleAxisRangeChanged(domain->minX(),domain->maxX(),domain->tickYCount()); | |||
|
425 | } | |||
|
426 | } | |||
396 | } |
|
427 | } | |
397 |
|
428 | |||
398 | #include "moc_qbarcategoriesaxis.cpp" |
|
429 | #include "moc_qbarcategoriesaxis.cpp" |
@@ -308,7 +308,7 void QValuesAxisPrivate::emitRange() | |||||
308 |
|
308 | |||
309 | void QValuesAxisPrivate::initialize(Domain* domain) |
|
309 | void QValuesAxisPrivate::initialize(Domain* domain) | |
310 | { |
|
310 | { | |
311 |
if(m_max |
|
311 | if(qFuzzyCompare(m_max,m_min)) { | |
312 | if(m_orientation==Qt::Vertical){ |
|
312 | if(m_orientation==Qt::Vertical){ | |
313 | handleAxisRangeChanged(domain->minY(),domain->maxY(),domain->tickXCount()); |
|
313 | handleAxisRangeChanged(domain->minY(),domain->maxY(),domain->tickXCount()); | |
314 | }else{ |
|
314 | }else{ |
General Comments 0
You need to be logged in to leave comments.
Login now