##// END OF EJS Templates
Fix default axes creation...
Titta Heikkala -
r2614:c8086b11eeb5
parent child
Show More
@@ -438,7 +438,7 QAbstractAxis::AxisType QAreaSeriesPrivate::defaultAxisType(Qt::Orientation orie
438 QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
438 QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
439 {
439 {
440 Q_UNUSED(orientation);
440 Q_UNUSED(orientation);
441 return 0;
441 return new QValueAxis;
442 }
442 }
443
443
444 void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
444 void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
@@ -852,8 +852,10 void QAbstractBarSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
852
852
853 QAbstractAxis* QAbstractBarSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
853 QAbstractAxis* QAbstractBarSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
854 {
854 {
855 Q_UNUSED(orientation);
855 if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
856 return 0;
856 return new QBarCategoryAxis;
857 else
858 return new QValueAxis;
857 }
859 }
858
860
859 void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
861 void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
@@ -394,9 +394,10 QAbstractAxis::AxisType QBoxPlotSeriesPrivate::defaultAxisType(Qt::Orientation o
394
394
395 QAbstractAxis* QBoxPlotSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
395 QAbstractAxis* QBoxPlotSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
396 {
396 {
397 Q_UNUSED(orientation);
397 if (defaultAxisType(orientation) == QAbstractAxis::AxisTypeBarCategory)
398
398 return new QBarCategoryAxis;
399 return 0;
399 else
400 return new QValueAxis;
400 }
401 }
401
402
402 void QBoxPlotSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
403 void QBoxPlotSeriesPrivate::populateCategories(QBarCategoryAxis *axis)
@@ -315,8 +315,20 void ChartDataSet::createDefaultAxes()
315 }
315 }
316
316
317 // Create the axes of the types selected
317 // Create the axes of the types selected
318 createAxes(typeX, Qt::Horizontal);
318 // As long as AxisType enum balues are sequential a check to see if there are series of
319 createAxes(typeY, Qt::Vertical);
319 // different types is needed. In such cases AxisTypeNoAxis is used to create separate axes
320 // for the types.
321 if (typeX != QAbstractAxis::AxisTypeNoAxis) {
322 if (typeX != m_seriesList.first()->d_ptr->defaultAxisType(Qt::Horizontal))
323 typeX = QAbstractAxis::AxisTypeNoAxis;
324 createAxes(typeX, Qt::Horizontal);
325 }
326
327 if (typeY != QAbstractAxis::AxisTypeNoAxis) {
328 if (typeY != m_seriesList.first()->d_ptr->defaultAxisType(Qt::Vertical))
329 typeY = QAbstractAxis::AxisTypeNoAxis;
330 createAxes(typeY, Qt::Vertical);
331 }
320
332
321 }
333 }
322
334
@@ -357,7 +369,7 void ChartDataSet::createAxes(QAbstractAxis::AxisTypes type, Qt::Orientation ori
357 }
369 }
358 axis->setRange(min,max);
370 axis->setRange(min,max);
359 }
371 }
360 else if (!type.testFlag(QAbstractAxis::AxisTypeNoAxis)) {
372 else if (type.testFlag(QAbstractAxis::AxisTypeNoAxis)) {
361 //create separate axis
373 //create separate axis
362 foreach(QAbstractSeries *s, m_seriesList) {
374 foreach(QAbstractSeries *s, m_seriesList) {
363 QAbstractAxis *axis = s->d_ptr->createDefaultAxis(orientation);
375 QAbstractAxis *axis = s->d_ptr->createDefaultAxis(orientation);
@@ -575,7 +575,7 QAbstractAxis::AxisType QXYSeriesPrivate::defaultAxisType(Qt::Orientation orient
575 QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
575 QAbstractAxis* QXYSeriesPrivate::createDefaultAxis(Qt::Orientation orientation) const
576 {
576 {
577 Q_UNUSED(orientation);
577 Q_UNUSED(orientation);
578 return 0;
578 return new QValueAxis;
579 }
579 }
580
580
581 void QXYSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options)
581 void QXYSeriesPrivate::initializeAnimations(QtCommercialChart::QChart::AnimationOptions options)
General Comments 0
You need to be logged in to leave comments. Login now