##// END OF EJS Templates
Default numbering for empty categories in barseries
Michal Klocek -
r1595:f1564e476801
parent child
Show More
@@ -214,13 +214,6 QChart* ThemeWidget::createBarChart(int valueCount) const
214 //TODO: chart->axisY()->setNiceNumbersEnabled(true);
214 //TODO: chart->axisY()->setNiceNumbersEnabled(true);
215 chart->setTitle("Bar chart");
215 chart->setTitle("Bar chart");
216
216
217 QStringList categories;
218 for (int i(0); i < valueCount; i++)
219 categories << QString::number(i);
220
221 QCategoriesAxis* axis = new QCategoriesAxis();
222 axis->append(categories);
223
224 QStackedBarSeries* series = new QStackedBarSeries(chart);
217 QStackedBarSeries* series = new QStackedBarSeries(chart);
225 for (int i(0); i < m_dataTable.count(); i++) {
218 for (int i(0); i < m_dataTable.count(); i++) {
226 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
219 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
@@ -230,7 +223,6 QChart* ThemeWidget::createBarChart(int valueCount) const
230 }
223 }
231 chart->addSeries(series);
224 chart->addSeries(series);
232 chart->createDefaultAxes();
225 chart->createDefaultAxes();
233 chart->setAxisX(axis, series);
234
226
235 return chart;
227 return chart;
236 }
228 }
@@ -710,7 +710,15 bool QAbstractBarSeriesPrivate::insert(int index, QBarSet *set)
710
710
711 void QAbstractBarSeriesPrivate::initializeAxisX(QAbstractAxis* axis)
711 void QAbstractBarSeriesPrivate::initializeAxisX(QAbstractAxis* axis)
712 {
712 {
713 Q_UNUSED(axis);
713 if(axis->type()==QAbstractAxis::AxisTypeCategories)
714 {
715 QCategoriesAxis* cataxis = qobject_cast<QCategoriesAxis*>(axis);
716 Q_ASSERT(cataxis);
717 QStringList categories;
718 for (int i(1); i < categoryCount()+1; i++)
719 categories << QString::number(i);
720 cataxis->append(categories);
721 }
714 }
722 }
715
723
716 void QAbstractBarSeriesPrivate::initializeAxisY(QAbstractAxis* axis)
724 void QAbstractBarSeriesPrivate::initializeAxisY(QAbstractAxis* axis)
General Comments 0
You need to be logged in to leave comments. Login now