@@ -214,13 +214,6 QChart* ThemeWidget::createBarChart(int valueCount) const | |||
|
214 | 214 | //TODO: chart->axisY()->setNiceNumbersEnabled(true); |
|
215 | 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 | 217 | QStackedBarSeries* series = new QStackedBarSeries(chart); |
|
225 | 218 | for (int i(0); i < m_dataTable.count(); i++) { |
|
226 | 219 | QBarSet *set = new QBarSet("Bar set " + QString::number(i)); |
@@ -230,7 +223,6 QChart* ThemeWidget::createBarChart(int valueCount) const | |||
|
230 | 223 | } |
|
231 | 224 | chart->addSeries(series); |
|
232 | 225 | chart->createDefaultAxes(); |
|
233 | chart->setAxisX(axis, series); | |
|
234 | 226 | |
|
235 | 227 | return chart; |
|
236 | 228 | } |
@@ -710,7 +710,15 bool QAbstractBarSeriesPrivate::insert(int index, QBarSet *set) | |||
|
710 | 710 | |
|
711 | 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 | 724 | void QAbstractBarSeriesPrivate::initializeAxisY(QAbstractAxis* axis) |
General Comments 0
You need to be logged in to leave comments.
Login now