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