@@ -1,9 +1,10 | |||||
1 | #include "mainwidget.h" |
|
1 | #include "mainwidget.h" | |
2 | #include "dataseriedialog.h" |
|
2 | #include "dataseriedialog.h" | |
3 |
#include |
|
3 | #include <qpieseries.h> | |
4 |
#include |
|
4 | #include <qscatterseries.h> | |
5 | #include <qlineseries.h> |
|
5 | #include <qlineseries.h> | |
6 |
#include |
|
6 | #include <qareaseries.h> | |
|
7 | #include <qsplineseries.h> | |||
7 | #include <qbarset.h> |
|
8 | #include <qbarset.h> | |
8 | #include <qbarseries.h> |
|
9 | #include <qbarseries.h> | |
9 | #include <qstackedbarseries.h> |
|
10 | #include <qstackedbarseries.h> | |
@@ -201,7 +202,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
201 | QList<RealList> data = generateTestData(columnCount, rowCount, dataCharacteristics); |
|
202 | QList<RealList> data = generateTestData(columnCount, rowCount, dataCharacteristics); | |
202 |
|
203 | |||
203 | // Line series and scatter series use similar data |
|
204 | // Line series and scatter series use similar data | |
204 | if (seriesName.contains("qline", Qt::CaseInsensitive)) { |
|
205 | if (seriesName == "Line") { | |
205 | for (int j(0); j < data.count(); j ++) { |
|
206 | for (int j(0); j < data.count(); j ++) { | |
206 | QList<qreal> column = data.at(j); |
|
207 | QList<qreal> column = data.at(j); | |
207 | QLineSeries *series = new QLineSeries(); |
|
208 | QLineSeries *series = new QLineSeries(); | |
@@ -211,7 +212,19 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
211 | m_chartView->addSeries(series); |
|
212 | m_chartView->addSeries(series); | |
212 | setCurrentSeries(series); |
|
213 | setCurrentSeries(series); | |
213 | } |
|
214 | } | |
214 | } else if (seriesName.contains("scatter", Qt::CaseInsensitive)) { |
|
215 | } if (seriesName == "Area") { | |
|
216 | // TODO: lower series for the area? | |||
|
217 | for (int j(0); j < data.count(); j ++) { | |||
|
218 | QList<qreal> column = data.at(j); | |||
|
219 | QLineSeries *lineSeries = new QLineSeries(); | |||
|
220 | for (int i(0); i < column.count(); i++) { | |||
|
221 | lineSeries->add(i, column.at(i)); | |||
|
222 | } | |||
|
223 | QAreaSeries *areaSeries = new QAreaSeries(lineSeries); | |||
|
224 | m_chartView->addSeries(areaSeries); | |||
|
225 | setCurrentSeries(areaSeries); | |||
|
226 | } | |||
|
227 | } else if (seriesName == "Scatter") { | |||
215 | for (int j(0); j < data.count(); j++) { |
|
228 | for (int j(0); j < data.count(); j++) { | |
216 | QList<qreal> column = data.at(j); |
|
229 | QList<qreal> column = data.at(j); | |
217 | QScatterSeries *series = new QScatterSeries(); |
|
230 | QScatterSeries *series = new QScatterSeries(); | |
@@ -221,7 +234,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
221 | m_chartView->addSeries(series); |
|
234 | m_chartView->addSeries(series); | |
222 | setCurrentSeries(series); |
|
235 | setCurrentSeries(series); | |
223 | } |
|
236 | } | |
224 |
} else if (seriesName |
|
237 | } else if (seriesName == "Pie") { | |
225 | QStringList labels = generateLabels(rowCount); |
|
238 | QStringList labels = generateLabels(rowCount); | |
226 | for (int j(0); j < data.count(); j++) { |
|
239 | for (int j(0); j < data.count(); j++) { | |
227 | QPieSeries *series = new QPieSeries(); |
|
240 | QPieSeries *series = new QPieSeries(); | |
@@ -262,8 +275,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
262 | series->setSeparatorsEnabled(false); |
|
275 | series->setSeparatorsEnabled(false); | |
263 | m_chartView->addSeries(series); |
|
276 | m_chartView->addSeries(series); | |
264 | setCurrentSeries(series); |
|
277 | setCurrentSeries(series); | |
265 | } |
|
278 | } else if (seriesName == "Spline") { | |
266 | else if (seriesName.contains("spline", Qt::CaseInsensitive)) { |
|
|||
267 | for (int j(0); j < data.count(); j ++) { |
|
279 | for (int j(0); j < data.count(); j ++) { | |
268 | QList<qreal> column = data.at(j); |
|
280 | QList<qreal> column = data.at(j); | |
269 | QSplineSeries *series = new QSplineSeries(); |
|
281 | QSplineSeries *series = new QSplineSeries(); |
General Comments 0
You need to be logged in to leave comments.
Login now