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