@@ -40,20 +40,16 QGroupBox *DataSerieDialog::seriesTypeSelector() | |||||
40 | { |
|
40 | { | |
41 | QVBoxLayout *layout = new QVBoxLayout(); |
|
41 | QVBoxLayout *layout = new QVBoxLayout(); | |
42 |
|
42 | |||
43 |
QRadioButton *line = new QRadioButton(" |
|
43 | QRadioButton *line = new QRadioButton("Line"); | |
44 | QRadioButton *area = new QRadioButton("&Area"); |
|
|||
45 | QRadioButton *pie = new QRadioButton("&Pie"); |
|
|||
46 | QRadioButton *bar = new QRadioButton("&Bar"); |
|
|||
47 | QRadioButton *scatter = new QRadioButton("&Scatter"); |
|
|||
48 | QRadioButton *spline = new QRadioButton("Spl&ine"); |
|
|||
49 | line->setChecked(true); |
|
44 | line->setChecked(true); | |
50 |
|
||||
51 | layout->addWidget(line); |
|
45 | layout->addWidget(line); | |
52 | layout->addWidget(area); |
|
46 | layout->addWidget(new QRadioButton("Area")); | |
53 |
layout->addWidget( |
|
47 | layout->addWidget(new QRadioButton("Pie")); | |
54 |
layout->addWidget( |
|
48 | layout->addWidget(new QRadioButton("Bar")); | |
55 |
layout->addWidget( |
|
49 | layout->addWidget(new QRadioButton("Stacked bar")); | |
56 |
layout->addWidget( |
|
50 | layout->addWidget(new QRadioButton("Percent bar")); | |
|
51 | layout->addWidget(new QRadioButton("Scatter")); | |||
|
52 | layout->addWidget(new QRadioButton("Spline")); | |||
57 |
|
53 | |||
58 | QGroupBox *groupBox = new QGroupBox("Series type"); |
|
54 | QGroupBox *groupBox = new QGroupBox("Series type"); | |
59 | groupBox->setLayout(layout); |
|
55 | groupBox->setLayout(layout); |
@@ -247,9 +247,61 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
247 | m_chartWidget->addSeries(series); |
|
247 | m_chartWidget->addSeries(series); | |
248 | setCurrentSeries(series); |
|
248 | setCurrentSeries(series); | |
249 | } |
|
249 | } | |
|
250 | } else if (seriesName == "Bar") { | |||
|
251 | // TODO: replace QBarCategory with QStringList? | |||
|
252 | QBarCategory *category = new QBarCategory; | |||
|
253 | QStringList labels = generateLabels(rowCount); | |||
|
254 | foreach(QString label, labels) | |||
|
255 | *category << label; | |||
|
256 | QBarChartSeries* series = new QBarChartSeries(category, this); | |||
|
257 | ||||
|
258 | for (int j(0); j < data.count(); j++) { | |||
|
259 | QList<qreal> column = data.at(j); | |||
|
260 | QBarSet *set = new QBarSet; | |||
|
261 | for (int i(0); i < column.count(); i++) { | |||
|
262 | *set << column.at(i); | |||
|
263 | } | |||
|
264 | series->addBarSet(set); | |||
|
265 | } | |||
|
266 | m_chartWidget->addSeries(series); | |||
|
267 | setCurrentSeries(series); | |||
|
268 | } else if (seriesName == "Stacked bar") { | |||
|
269 | QBarCategory *category = new QBarCategory; | |||
|
270 | QStringList labels = generateLabels(rowCount); | |||
|
271 | foreach(QString label, labels) | |||
|
272 | *category << label; | |||
|
273 | QStackedBarChartSeries* series = new QStackedBarChartSeries(category, this); | |||
|
274 | ||||
|
275 | for (int j(0); j < data.count(); j++) { | |||
|
276 | QList<qreal> column = data.at(j); | |||
|
277 | QBarSet *set = new QBarSet; | |||
|
278 | for (int i(0); i < column.count(); i++) { | |||
|
279 | *set << column.at(i); | |||
|
280 | } | |||
|
281 | series->addBarSet(set); | |||
|
282 | } | |||
|
283 | m_chartWidget->addSeries(series); | |||
|
284 | setCurrentSeries(series); | |||
|
285 | } else if (seriesName == "Percent bar") { | |||
|
286 | QBarCategory *category = new QBarCategory; | |||
|
287 | QStringList labels = generateLabels(rowCount); | |||
|
288 | foreach(QString label, labels) | |||
|
289 | *category << label; | |||
|
290 | QPercentBarChartSeries* series = new QPercentBarChartSeries(category, this); | |||
|
291 | ||||
|
292 | for (int j(0); j < data.count(); j++) { | |||
|
293 | QList<qreal> column = data.at(j); | |||
|
294 | QBarSet *set = new QBarSet; | |||
|
295 | for (int i(0); i < column.count(); i++) { | |||
|
296 | *set << column.at(i); | |||
|
297 | } | |||
|
298 | series->addBarSet(set); | |||
|
299 | } | |||
|
300 | m_chartWidget->addSeries(series); | |||
|
301 | setCurrentSeries(series); | |||
250 | } |
|
302 | } | |
251 |
|
303 | |||
252 |
// TODO: |
|
304 | // TODO: spline and area | |
253 | } |
|
305 | } | |
254 |
|
306 | |||
255 | void MainWidget::setCurrentSeries(QChartSeries *series) |
|
307 | void MainWidget::setCurrentSeries(QChartSeries *series) |
General Comments 0
You need to be logged in to leave comments.
Login now