##// END OF EJS Templates
Fix compilation issue of chartdesigner
Michal Klocek -
r1199:84c5353058e3
parent child
Show More
@@ -21,6 +21,9
21 21 #include "engine.h"
22 22 #include <QItemSelectionModel>
23 23 #include <QStandardItemModel>
24 #include <QXYModelMapper>
25 #include <QBarModelMapper>
26 #include <QPieModelMapper>
24 27 #include <QLineSeries>
25 28 #include <QSplineSeries>
26 29 #include <QScatterSeries>
@@ -32,6 +35,7
32 35 #include <QChart>
33 36 #include <QBarSet>
34 37
38
35 39 const qint32 MAGIC_NUMBER = 0x66666666;
36 40
37 41 Engine::Engine(QObject* parent) :
@@ -116,21 +120,21 QList<QAbstractSeries*> Engine::addSeries(QAbstractSeries::SeriesType type)
116 120 case QAbstractSeries::SeriesTypeBar:
117 121 {
118 122 //TODO: fix me
119 QBarSeries *bar = new QBarSeries(QBarCategories() << "temp");
123 QBarSeries *bar = new QBarSeries();
120 124 setupBarSeries(bar,keys,minRow,maxRow);
121 125 result << bar;
122 126 break;
123 127 }
124 128 case QAbstractSeries::SeriesTypePercentBar:
125 129 {
126 QPercentBarSeries *bar = new QPercentBarSeries(QBarCategories() << "temp");
130 QPercentBarSeries *bar = new QPercentBarSeries();
127 131 setupBarSeries(bar,keys,minRow,maxRow);
128 132 result << bar;
129 133 break;
130 134 }
131 135 case QAbstractSeries::SeriesTypeStackedBar:
132 136 {
133 QStackedBarSeries *bar = new QStackedBarSeries(QBarCategories() << "temp");
137 QStackedBarSeries *bar = new QStackedBarSeries();
134 138 setupBarSeries(bar,keys,minRow,maxRow);
135 139 result << bar;
136 140 break;
@@ -252,8 +256,13 bool Engine::load(const QString &filename)
252 256 void Engine::setupXYSeries(QXYSeries *xyseries, const QList<int>& columns, int column, int minRow, int maxRow)
253 257 {
254 258 xyseries->setModel(m_model);
255 xyseries->setModelMapping(columns.first(), columns.at(column), Qt::Vertical);
256 xyseries->setModelMappingRange(minRow, maxRow - minRow + 1);
259 QXYModelMapper* mapper = new QXYModelMapper(xyseries);
260 xyseries->setModelMapper(mapper);
261 mapper->setMapX(columns.first());
262 mapper->setMapY(columns.at(column));
263 mapper->setOrientation(Qt::Vertical);
264 mapper->setFirst(minRow);
265 mapper->setCount(maxRow - minRow + 1);
257 266 m_chart->addSeries(xyseries);
258 267 xyseries->setName(QString("Series %1").arg(m_chart->series().count()));
259 268 QObject::connect(xyseries,SIGNAL(clicked(const QPointF&)),this,SIGNAL(selected()));
@@ -271,8 +280,14 void Engine::setupXYSeries(QXYSeries *xyseries, const QList<int>& columns, int c
271 280 void Engine::setupBarSeries(QBarSeries *bar, const QList<int>& columns, int minRow, int maxRow)
272 281 {
273 282 bar->setModel(m_model);
274 bar->setModelMapping(columns.first(), columns.at(1), columns.last(), Qt::Vertical);
275 bar->setModelMappingRange(minRow, maxRow - minRow + 1);
283 QBarModelMapper* mapper = new QBarModelMapper(bar);
284 bar->setModelMapper(mapper);
285 mapper->setMapCategories(columns.first());
286 mapper->setMapBarTop(columns.last());
287 mapper->setMapBarBottom(columns.at(1));
288 mapper->setOrientation(Qt::Vertical);
289 mapper->setFirst(minRow);
290 mapper->setCount(maxRow - minRow + 1);
276 291 m_chart->addSeries(bar);
277 292 bar->setName(QString("Series %1").arg(m_chart->series().count()));
278 293
@@ -287,8 +302,13 void Engine::setupBarSeries(QBarSeries *bar, const QList<int>& columns, int minR
287 302 void Engine::setupPieSeries(QPieSeries *pie, const QList<int>& columns, int minRow, int maxRow)
288 303 {
289 304 pie->setModel(m_model);
290 pie->setModelMapping(columns.at(1),columns.first() ,Qt::Vertical);
291 pie->setModelMappingRange(minRow, maxRow - minRow + 1);
305 QPieModelMapper* mapper = new QPieModelMapper(pie);
306 pie->setModelMapper(mapper);
307 mapper->setMapValues(columns.at(1));
308 mapper->setMapLabels(columns.first());
309 mapper->setOrientation(Qt::Vertical);
310 mapper->setFirst(minRow);
311 mapper->setCount(maxRow - minRow + 1);
292 312 m_chart->addSeries(pie);
293 313 pie->setName(QString("Series %1").arg(m_chart->series().count()));
294 314
@@ -302,10 +322,20 void Engine::setupAreaSeries(QAreaSeries *series, const QList<int>& columns, int
302 322 {
303 323 series->lowerSeries()->setModel(m_model);
304 324 series->upperSeries()->setModel(m_model);
305 series->upperSeries()->setModelMapping(columns.first(), columns.at(1), Qt::Vertical);
306 series->lowerSeries()->setModelMapping(columns.first(), columns.at(2), Qt::Vertical);
307 series->upperSeries()->setModelMappingRange(minRow, maxRow - minRow + 1);
308 series->lowerSeries()->setModelMappingRange(minRow, maxRow - minRow + 1);
325 QXYModelMapper* umapper = new QXYModelMapper(series);
326 umapper->setMapX(columns.first());
327 umapper->setMapY(columns.at(1));
328 umapper->setOrientation(Qt::Vertical);
329 umapper->setFirst(minRow);
330 umapper->setCount(maxRow - minRow + 1);
331 QXYModelMapper* lmapper = new QXYModelMapper(series);
332 lmapper->setMapX(columns.first());
333 lmapper->setMapY(columns.at(2));
334 lmapper->setOrientation(Qt::Vertical);
335 lmapper->setFirst(minRow);
336 lmapper->setCount(maxRow - minRow + 1);
337 series->upperSeries()->setModelMapper(umapper);
338 series->lowerSeries()->setModelMapper(lmapper);
309 339 m_chart->addSeries(series);
310 340 series->setName(QString("Series %1").arg(m_chart->series().count()));
311 341
General Comments 0
You need to be logged in to leave comments. Login now