From cdbe8dbbb49f5893e7e228d1aa232575c089e64c 2012-01-19 08:27:41 From: Tero Ahola Date: 2012-01-19 08:27:41 Subject: [PATCH] Fixed compilation of test/example apps --- diff --git a/example/linechart/main.cpp b/example/linechart/main.cpp index f90ed6d..d4ab7fc 100644 --- a/example/linechart/main.cpp +++ b/example/linechart/main.cpp @@ -3,7 +3,6 @@ #include #include #include -#include "chartview.h" #include QCHART_USE_NAMESPACE diff --git a/test/chartwidgettest/dataseriedialog.cpp b/test/chartwidgettest/dataseriedialog.cpp index b0a0047..5ae8175 100644 --- a/test/chartwidgettest/dataseriedialog.cpp +++ b/test/chartwidgettest/dataseriedialog.cpp @@ -28,6 +28,7 @@ DataSerieDialog::DataSerieDialog(QString defaultType, QWidget *parent) : // Combo box for selecting data for the new series m_testDataCombo = new QComboBox(this); m_testDataCombo->addItem("linear"); + m_testDataCombo->addItem("linear, 1M"); m_testDataCombo->addItem("SIN"); m_testDataCombo->addItem("SIN + random"); m_testDataCombo->addItem("TODO From file..."); diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index 7dfcac8..51e7b38 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -1,6 +1,6 @@ #include "mainwidget.h" #include "dataseriedialog.h" -#include +#include #include #include #include @@ -101,18 +101,21 @@ void MainWidget::addSeries(QString series, QString data) qDebug() << "addSeries: " << series << " data: " << data; m_defaultSeries = series; - QXYChartSeries* series0 = new QXYChartSeries(); + // TODO: color of the series + QXYChartSeries* series0 = QXYChartSeries::create(); if (data == "linear") { - // TODO + for (int i = 0; i < 10; i++) + series0->add(i, 10); + } else if (data == "linear, 1M") { + for (int i = 0; i < 1000000; i++) + series0->add(i, 20); } else if (data == "SIN") { - series0->setColor(Qt::blue); for (int x = 0; x < 100; x++) series0->add(x, abs(sin(3.14159265358979 / 50 * x) * 100)); QList dataset; dataset << series0; } else if (data == "SIN + random") { - series0->setColor(Qt::blue); for (qreal x = 0; x < 100; x += 0.1) { series0->add(x + (rand() % 5), abs(sin(3.14159265358979 / 50 * x) * 100) + (rand() % 5)); @@ -121,13 +124,10 @@ void MainWidget::addSeries(QString series, QString data) // TODO: check if data has a valid file name } - QList dataset; - dataset << series0; - if (series == "Scatter") { - m_chartWidget->addDataSeries(QChart::DataSeriesTypeScatter, dataset); + m_chartWidget->addSeries(series0); } else if (series == "Line") { - m_chartWidget->addDataSeries(QChart::DataSeriesTypeLine, dataset); + m_chartWidget->addSeries(series0); } else { // TODO }