##// END OF EJS Templates
Fixed compilation of test/example apps
Tero Ahola -
r27:cdbe8dbbb49f
parent child
Show More
@@ -3,7 +3,6
3 #include <qchartwidget.h>
3 #include <qchartwidget.h>
4 #include <qxychartseries.h>
4 #include <qxychartseries.h>
5 #include <qchart.h>
5 #include <qchart.h>
6 #include "chartview.h"
7 #include <cmath>
6 #include <cmath>
8
7
9 QCHART_USE_NAMESPACE
8 QCHART_USE_NAMESPACE
@@ -28,6 +28,7 DataSerieDialog::DataSerieDialog(QString defaultType, QWidget *parent) :
28 // Combo box for selecting data for the new series
28 // Combo box for selecting data for the new series
29 m_testDataCombo = new QComboBox(this);
29 m_testDataCombo = new QComboBox(this);
30 m_testDataCombo->addItem("linear");
30 m_testDataCombo->addItem("linear");
31 m_testDataCombo->addItem("linear, 1M");
31 m_testDataCombo->addItem("SIN");
32 m_testDataCombo->addItem("SIN");
32 m_testDataCombo->addItem("SIN + random");
33 m_testDataCombo->addItem("SIN + random");
33 m_testDataCombo->addItem("TODO From file...");
34 m_testDataCombo->addItem("TODO From file...");
@@ -1,6 +1,6
1 #include "mainwidget.h"
1 #include "mainwidget.h"
2 #include "dataseriedialog.h"
2 #include "dataseriedialog.h"
3 #include <qxyseries.h>
3 #include <qxychartseries.h>
4 #include <QPushButton>
4 #include <QPushButton>
5 #include <QComboBox>
5 #include <QComboBox>
6 #include <QSpinBox>
6 #include <QSpinBox>
@@ -101,18 +101,21 void MainWidget::addSeries(QString series, QString data)
101 qDebug() << "addSeries: " << series << " data: " << data;
101 qDebug() << "addSeries: " << series << " data: " << data;
102 m_defaultSeries = series;
102 m_defaultSeries = series;
103
103
104 QXYChartSeries* series0 = new QXYChartSeries();
104 // TODO: color of the series
105 QXYChartSeries* series0 = QXYChartSeries::create();
105
106
106 if (data == "linear") {
107 if (data == "linear") {
107 // TODO
108 for (int i = 0; i < 10; i++)
109 series0->add(i, 10);
110 } else if (data == "linear, 1M") {
111 for (int i = 0; i < 1000000; i++)
112 series0->add(i, 20);
108 } else if (data == "SIN") {
113 } else if (data == "SIN") {
109 series0->setColor(Qt::blue);
110 for (int x = 0; x < 100; x++)
114 for (int x = 0; x < 100; x++)
111 series0->add(x, abs(sin(3.14159265358979 / 50 * x) * 100));
115 series0->add(x, abs(sin(3.14159265358979 / 50 * x) * 100));
112 QList<QXYChartSeries*> dataset;
116 QList<QXYChartSeries*> dataset;
113 dataset << series0;
117 dataset << series0;
114 } else if (data == "SIN + random") {
118 } else if (data == "SIN + random") {
115 series0->setColor(Qt::blue);
116 for (qreal x = 0; x < 100; x += 0.1) {
119 for (qreal x = 0; x < 100; x += 0.1) {
117 series0->add(x + (rand() % 5),
120 series0->add(x + (rand() % 5),
118 abs(sin(3.14159265358979 / 50 * x) * 100) + (rand() % 5));
121 abs(sin(3.14159265358979 / 50 * x) * 100) + (rand() % 5));
@@ -121,13 +124,10 void MainWidget::addSeries(QString series, QString data)
121 // TODO: check if data has a valid file name
124 // TODO: check if data has a valid file name
122 }
125 }
123
126
124 QList<QXYChartSeries*> dataset;
125 dataset << series0;
126
127 if (series == "Scatter") {
127 if (series == "Scatter") {
128 m_chartWidget->addDataSeries(QChart::DataSeriesTypeScatter, dataset);
128 m_chartWidget->addSeries(series0);
129 } else if (series == "Line") {
129 } else if (series == "Line") {
130 m_chartWidget->addDataSeries(QChart::DataSeriesTypeLine, dataset);
130 m_chartWidget->addSeries(series0);
131 } else {
131 } else {
132 // TODO
132 // TODO
133 }
133 }
General Comments 0
You need to be logged in to leave comments. Login now