##// END OF EJS Templates
Fixed area series handling in chartwidgettest
Tero Ahola -
r517:ff848436837e
parent child
Show More
@@ -210,9 +210,8 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
210 series->add(i, column.at(i));
210 series->add(i, column.at(i));
211 }
211 }
212 m_chartView->addSeries(series);
212 m_chartView->addSeries(series);
213 setCurrentSeries(series);
214 }
213 }
215 } if (seriesName == "Area") {
214 } else if (seriesName == "Area") {
216 // TODO: lower series for the area?
215 // TODO: lower series for the area?
217 for (int j(0); j < data.count(); j ++) {
216 for (int j(0); j < data.count(); j ++) {
218 QList<qreal> column = data.at(j);
217 QList<qreal> column = data.at(j);
@@ -222,7 +221,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
222 }
221 }
223 QAreaSeries *areaSeries = new QAreaSeries(lineSeries);
222 QAreaSeries *areaSeries = new QAreaSeries(lineSeries);
224 m_chartView->addSeries(areaSeries);
223 m_chartView->addSeries(areaSeries);
225 setCurrentSeries(areaSeries);
226 }
224 }
227 } else if (seriesName == "Scatter") {
225 } else if (seriesName == "Scatter") {
228 for (int j(0); j < data.count(); j++) {
226 for (int j(0); j < data.count(); j++) {
@@ -232,7 +230,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
232 (*series) << QPointF(i, column.at(i));
230 (*series) << QPointF(i, column.at(i));
233 }
231 }
234 m_chartView->addSeries(series);
232 m_chartView->addSeries(series);
235 setCurrentSeries(series);
236 }
233 }
237 } else if (seriesName == "Pie") {
234 } else if (seriesName == "Pie") {
238 QStringList labels = generateLabels(rowCount);
235 QStringList labels = generateLabels(rowCount);
@@ -243,7 +240,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
243 series->add(column.at(i), labels.at(i));
240 series->add(column.at(i), labels.at(i));
244 }
241 }
245 m_chartView->addSeries(series);
242 m_chartView->addSeries(series);
246 setCurrentSeries(series);
247 }
243 }
248 } else if (seriesName == "Bar"
244 } else if (seriesName == "Bar"
249 || seriesName == "Stacked bar"
245 || seriesName == "Stacked bar"
@@ -274,7 +270,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
274 series->setToolTipEnabled(true);
270 series->setToolTipEnabled(true);
275 series->setSeparatorsVisible(false);
271 series->setSeparatorsVisible(false);
276 m_chartView->addSeries(series);
272 m_chartView->addSeries(series);
277 setCurrentSeries(series);
278 } else if (seriesName == "Spline") {
273 } else if (seriesName == "Spline") {
279 for (int j(0); j < data.count(); j ++) {
274 for (int j(0); j < data.count(); j ++) {
280 QList<qreal> column = data.at(j);
275 QList<qreal> column = data.at(j);
@@ -283,38 +278,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
283 series->add(i, column.at(i));
278 series->add(i, column.at(i));
284 }
279 }
285 m_chartView->addSeries(series);
280 m_chartView->addSeries(series);
286 setCurrentSeries(series);
287 }
288
289 // TODO: area
290 }
291 }
292
293 void MainWidget::setCurrentSeries(QSeries *series)
294 {
295 if (series) {
296 m_currentSeries = series;
297 switch (m_currentSeries->type()) {
298 case QSeries::SeriesTypeLine:
299 break;
300 case QSeries::SeriesTypeScatter:
301 break;
302 case QSeries::SeriesTypePie:
303 break;
304 case QSeries::SeriesTypeBar:
305 qDebug() << "setCurrentSeries (bar)";
306 break;
307 case QSeries::SeriesTypeStackedBar:
308 qDebug() << "setCurrentSeries (Stackedbar)";
309 break;
310 case QSeries::SeriesTypePercentBar:
311 qDebug() << "setCurrentSeries (Percentbar)";
312 break;
313 case QSeries::SeriesTypeSpline:
314 break;
315 default:
316 Q_ASSERT(false);
317 break;
318 }
281 }
319 }
282 }
320 }
283 }
@@ -38,7 +38,6 private slots:
38 void yMinChanged(int value);
38 void yMinChanged(int value);
39 void yMaxChanged(int value);
39 void yMaxChanged(int value);
40 void antiAliasToggled(bool enabled);
40 void antiAliasToggled(bool enabled);
41 void setCurrentSeries(QSeries *series);
42 void changeChartTheme(int themeIndex);
41 void changeChartTheme(int themeIndex);
43 QList<RealList> generateTestData(int columnCount, int rowCount, QString dataCharacteristics);
42 QList<RealList> generateTestData(int columnCount, int rowCount, QString dataCharacteristics);
44 QStringList generateLabels(int count);
43 QStringList generateLabels(int count);
@@ -52,7 +51,6 private:
52 QSpinBox *m_yMinSpin;
51 QSpinBox *m_yMinSpin;
53 QSpinBox *m_yMaxSpin;
52 QSpinBox *m_yMaxSpin;
54 QString m_defaultSeriesName;
53 QString m_defaultSeriesName;
55 QSeries *m_currentSeries;
56 QGridLayout *m_scatterLayout;
54 QGridLayout *m_scatterLayout;
57 };
55 };
58
56
General Comments 0
You need to be logged in to leave comments. Login now