##// 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 210 series->add(i, column.at(i));
211 211 }
212 212 m_chartView->addSeries(series);
213 setCurrentSeries(series);
214 213 }
215 } if (seriesName == "Area") {
214 } else if (seriesName == "Area") {
216 215 // TODO: lower series for the area?
217 216 for (int j(0); j < data.count(); j ++) {
218 217 QList<qreal> column = data.at(j);
@@ -222,7 +221,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
222 221 }
223 222 QAreaSeries *areaSeries = new QAreaSeries(lineSeries);
224 223 m_chartView->addSeries(areaSeries);
225 setCurrentSeries(areaSeries);
226 224 }
227 225 } else if (seriesName == "Scatter") {
228 226 for (int j(0); j < data.count(); j++) {
@@ -232,7 +230,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
232 230 (*series) << QPointF(i, column.at(i));
233 231 }
234 232 m_chartView->addSeries(series);
235 setCurrentSeries(series);
236 233 }
237 234 } else if (seriesName == "Pie") {
238 235 QStringList labels = generateLabels(rowCount);
@@ -243,7 +240,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
243 240 series->add(column.at(i), labels.at(i));
244 241 }
245 242 m_chartView->addSeries(series);
246 setCurrentSeries(series);
247 243 }
248 244 } else if (seriesName == "Bar"
249 245 || seriesName == "Stacked bar"
@@ -274,7 +270,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
274 270 series->setToolTipEnabled(true);
275 271 series->setSeparatorsVisible(false);
276 272 m_chartView->addSeries(series);
277 setCurrentSeries(series);
278 273 } else if (seriesName == "Spline") {
279 274 for (int j(0); j < data.count(); j ++) {
280 275 QList<qreal> column = data.at(j);
@@ -283,38 +278,6 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS
283 278 series->add(i, column.at(i));
284 279 }
285 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 38 void yMinChanged(int value);
39 39 void yMaxChanged(int value);
40 40 void antiAliasToggled(bool enabled);
41 void setCurrentSeries(QSeries *series);
42 41 void changeChartTheme(int themeIndex);
43 42 QList<RealList> generateTestData(int columnCount, int rowCount, QString dataCharacteristics);
44 43 QStringList generateLabels(int count);
@@ -52,7 +51,6 private:
52 51 QSpinBox *m_yMinSpin;
53 52 QSpinBox *m_yMaxSpin;
54 53 QString m_defaultSeriesName;
55 QSeries *m_currentSeries;
56 54 QGridLayout *m_scatterLayout;
57 55 };
58 56
General Comments 0
You need to be logged in to leave comments. Login now