##// END OF EJS Templates
Minor fix to QXYModelMapper
Marek Rosa -
r1310:3b689b88a3df
parent child
Show More
@@ -5,6 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 QHXYModelMapper::QHXYModelMapper(QObject *parent) :
5 QHXYModelMapper::QHXYModelMapper(QObject *parent) :
6 QXYModelMapper(parent)
6 QXYModelMapper(parent)
7 {
7 {
8 QXYModelMapper::setOrientation(Qt::Horizontal);
8 }
9 }
9
10
10 int QHXYModelMapper::xRow() const
11 int QHXYModelMapper::xRow() const
@@ -5,6 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 QVXYModelMapper::QVXYModelMapper(QObject *parent) :
5 QVXYModelMapper::QVXYModelMapper(QObject *parent) :
6 QXYModelMapper(parent)
6 QXYModelMapper(parent)
7 {
7 {
8 QXYModelMapper::setOrientation(Qt::Vertical);
8 }
9 }
9
10
10 int QVXYModelMapper::xColumn() const
11 int QVXYModelMapper::xColumn() const
@@ -27,6 +27,7
27 #include <QSplineSeries>
27 #include <QSplineSeries>
28 #include <QScatterSeries>
28 #include <QScatterSeries>
29 #include <QVXYModelMapper>
29 #include <QVXYModelMapper>
30 #include <QHXYModelMapper>
30 #include "customtablemodel.h"
31 #include "customtablemodel.h"
31 #include <QPieSeries>
32 #include <QPieSeries>
32 #include <QVPieModelMapper>
33 #include <QVPieModelMapper>
@@ -135,7 +136,7 TableWidget::TableWidget(QWidget *parent)
135 connect(m_pieRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType(bool)));
136 connect(m_pieRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType(bool)));
136 connect(m_areaRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType(bool)));
137 connect(m_areaRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType(bool)));
137 connect(m_barRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType(bool)));
138 connect(m_barRadioButton, SIGNAL(toggled(bool)), this, SLOT(updateChartType(bool)));
138 m_barRadioButton->setChecked(true);
139 m_lineRadioButton->setChecked(true);
139
140
140 // radio buttons layout
141 // radio buttons layout
141 QVBoxLayout* radioLayout = new QVBoxLayout;
142 QVBoxLayout* radioLayout = new QVBoxLayout;
@@ -240,14 +241,22 void TableWidget::updateChartType(bool toggle)
240 // series 1
241 // series 1
241 m_series = new QLineSeries;
242 m_series = new QLineSeries;
242
243
243 m_mapper = new QVXYModelMapper;
244 m_mapper = new QHXYModelMapper;
244 m_mapper->setModel(m_model);
245 m_mapper->setModel(m_model);
245 m_mapper->setSeries(m_series);
246 m_mapper->setSeries(m_series);
246 m_mapper->setXColumn(0);
247 m_mapper->setXRow(0);
247 m_mapper->setYColumn(1);
248 m_mapper->setYRow(1);
248 m_mapper->setFirst(3);
249 m_mapper->setFirst(3);
249 m_mapper->setCount(4);
250 m_mapper->setCount(4);
250
251
252 // m_mapper = new QVXYModelMapper;
253 // m_mapper->setModel(m_model);
254 // m_mapper->setSeries(m_series);
255 // m_mapper->setXColumn(0);
256 // m_mapper->setYColumn(1);
257 // m_mapper->setFirst(3);
258 // m_mapper->setCount(4);
259
251 // m_series->setModelMapping(0,1, Qt::Vertical);
260 // m_series->setModelMapping(0,1, Qt::Vertical);
252 // m_series->setModelMappingRange(3, 4);
261 // m_series->setModelMappingRange(3, 4);
253 m_chart->addSeries(m_series);
262 m_chart->addSeries(m_series);
@@ -293,13 +302,13 void TableWidget::updateChartType(bool toggle)
293 m_series = new QSplineSeries;
302 m_series = new QSplineSeries;
294 // m_series->setModel(m_model);
303 // m_series->setModel(m_model);
295
304
296 m_mapper = new QVXYModelMapper;
305 // m_mapper = new QVXYModelMapper;
297 m_mapper->setSeries(m_series);
306 // m_mapper->setSeries(m_series);
298 m_mapper->setModel(m_model);
307 // m_mapper->setModel(m_model);
299 m_mapper->setXColumn(0);
308 // m_mapper->setXColumn(0);
300 m_mapper->setYColumn(1);
309 // m_mapper->setYColumn(1);
301 m_mapper->setFirst(0);
310 // m_mapper->setFirst(0);
302 m_mapper->setCount(-1);
311 // m_mapper->setCount(-1);
303
312
304 // m_series->setModelMapper(mapper);
313 // m_series->setModelMapper(mapper);
305
314
@@ -345,13 +354,13 void TableWidget::updateChartType(bool toggle)
345 // series 1
354 // series 1
346 m_series = new QScatterSeries;
355 m_series = new QScatterSeries;
347
356
348 m_mapper = new QVXYModelMapper;
357 // m_mapper = new QVXYModelMapper;
349 m_mapper->setSeries(m_series);
358 // m_mapper->setSeries(m_series);
350 m_mapper->setModel(m_model);
359 // m_mapper->setModel(m_model);
351 m_mapper->setXColumn(0);
360 // m_mapper->setXColumn(0);
352 m_mapper->setYColumn(1);
361 // m_mapper->setYColumn(1);
353 m_mapper->setFirst(0);
362 // m_mapper->setFirst(0);
354 m_mapper->setCount(-1);
363 // m_mapper->setCount(-1);
355
364
356 m_chart->addSeries(m_series);
365 m_chart->addSeries(m_series);
357 seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper();
366 seriesColorHex = "#" + QString::number(m_series->brush().color().rgb(), 16).right(6).toUpper();
@@ -28,6 +28,7
28 #include <QPieSeries>
28 #include <QPieSeries>
29 #include <QVPieModelMapper>
29 #include <QVPieModelMapper>
30 #include <QVXYModelMapper>
30 #include <QVXYModelMapper>
31 #include <QHXYModelMapper>
31
32
32 class CustomTableModel;
33 class CustomTableModel;
33 class QTableView;
34 class QTableView;
@@ -62,7 +63,7 public:
62 QChartView* m_chartView;
63 QChartView* m_chartView;
63 QChart* m_chart;
64 QChart* m_chart;
64 QXYSeries* m_series;
65 QXYSeries* m_series;
65 QVXYModelMapper *m_mapper;
66 QHXYModelMapper *m_mapper;
66 CustomTableModel* m_model;
67 CustomTableModel* m_model;
67 QTableView* m_tableView;
68 QTableView* m_tableView;
68 QRadioButton* m_lineRadioButton;
69 QRadioButton* m_lineRadioButton;
General Comments 0
You need to be logged in to leave comments. Login now