@@ -0,0 +1,63 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "chart.h" | |
|
22 | #include <QGesture> | |
|
23 | #include <QGraphicsScene> | |
|
24 | #include <QGraphicsView> | |
|
25 | ||
|
26 | Chart::Chart(QGraphicsItem *parent, Qt::WindowFlags wFlags) | |
|
27 | :QChart(parent, wFlags) | |
|
28 | { | |
|
29 | // Seems that QGraphicsView (QChartView) does not grab gestures. | |
|
30 | // They can only be grabbed here in the QGraphicsWidget (QChart). | |
|
31 | grabGesture(Qt::PanGesture); | |
|
32 | grabGesture(Qt::PinchGesture); | |
|
33 | } | |
|
34 | ||
|
35 | Chart::~Chart() | |
|
36 | { | |
|
37 | ||
|
38 | } | |
|
39 | ||
|
40 | //![1] | |
|
41 | bool Chart::sceneEvent(QEvent *event) | |
|
42 | { | |
|
43 | if (event->type() == QEvent::Gesture) | |
|
44 | return gestureEvent(static_cast<QGestureEvent*>(event)); | |
|
45 | return QChart::event(event); | |
|
46 | } | |
|
47 | ||
|
48 | bool Chart::gestureEvent(QGestureEvent* event) | |
|
49 | { | |
|
50 | if (QGesture *gesture = event->gesture(Qt::PanGesture)) { | |
|
51 | QPanGesture *pan = static_cast<QPanGesture *>(gesture); | |
|
52 | QChart::scroll(pan->delta().x(),pan->delta().y()); | |
|
53 | } | |
|
54 | ||
|
55 | if (QGesture *gesture = event->gesture(Qt::PinchGesture)) { | |
|
56 | QPinchGesture *pinch = static_cast<QPinchGesture *>(gesture); | |
|
57 | if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged) | |
|
58 | QChart::zoom(pinch->scaleFactor()); | |
|
59 | } | |
|
60 | ||
|
61 | return true; | |
|
62 | } | |
|
63 | //![1] |
@@ -0,0 +1,46 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #ifndef CHART_H | |
|
22 | #define CHART_H | |
|
23 | ||
|
24 | #include <QChart> | |
|
25 | ||
|
26 | QTCOMMERCIALCHART_USE_NAMESPACE | |
|
27 | ||
|
28 | //![1] | |
|
29 | class Chart : public QChart | |
|
30 | //![1] | |
|
31 | { | |
|
32 | public: | |
|
33 | explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); | |
|
34 | ~Chart(); | |
|
35 | ||
|
36 | protected: | |
|
37 | bool sceneEvent(QEvent *event); | |
|
38 | ||
|
39 | private: | |
|
40 | bool gestureEvent(QGestureEvent* event); | |
|
41 | ||
|
42 | private: | |
|
43 | ||
|
44 | }; | |
|
45 | ||
|
46 | #endif // CHART_H |
@@ -0,0 +1,111 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "chartview.h" | |
|
22 | #include <QMouseEvent> | |
|
23 | #include <QDebug> | |
|
24 | ||
|
25 | ChartView::ChartView(QChart *chart, QWidget *parent) : | |
|
26 | QChartView(chart, parent), m_rubberBand(QRubberBand::Rectangle, this), m_isScrolling( | |
|
27 | false) | |
|
28 | { | |
|
29 | // setRubberBand(QChartView::RectangleRubberBand); | |
|
30 | this->chart()->setAnimationOptions(QChart::NoAnimation); | |
|
31 | } | |
|
32 | ||
|
33 | void ChartView::mousePressEvent(QMouseEvent *event) | |
|
34 | { | |
|
35 | if (event->button() == Qt::RightButton) { | |
|
36 | ||
|
37 | QRectF rect = chart()->plotArea(); | |
|
38 | ||
|
39 | m_origin = event->pos(); | |
|
40 | ||
|
41 | if (!rect.contains(m_origin)) | |
|
42 | return; | |
|
43 | ||
|
44 | m_rubberBand.setGeometry(QRect(m_origin, QSize())); | |
|
45 | m_rubberBand.show(); | |
|
46 | } | |
|
47 | ||
|
48 | if (event->button() == Qt::LeftButton) { | |
|
49 | m_origin = event->pos(); | |
|
50 | m_isScrolling = true; | |
|
51 | } | |
|
52 | ||
|
53 | event->accept(); | |
|
54 | } | |
|
55 | ||
|
56 | void ChartView::mouseMoveEvent(QMouseEvent *event) | |
|
57 | { | |
|
58 | if (m_rubberBand.isVisible()) | |
|
59 | m_rubberBand.setGeometry(QRect(m_origin, event->pos()).normalized()); | |
|
60 | ||
|
61 | if (m_isScrolling) { | |
|
62 | QPointF delta = m_origin - event->pos(); | |
|
63 | chart()->scroll(delta.x(),-delta.y()); | |
|
64 | m_origin = event->pos(); | |
|
65 | } | |
|
66 | ||
|
67 | } | |
|
68 | ||
|
69 | void ChartView::mouseReleaseEvent(QMouseEvent *event) | |
|
70 | { | |
|
71 | if (event->button() == Qt::RightButton && m_rubberBand.isVisible()) { | |
|
72 | m_rubberBand.hide(); | |
|
73 | ||
|
74 | QRect rect = m_rubberBand.geometry(); | |
|
75 | chart()->zoomIn(rect); | |
|
76 | event->accept(); | |
|
77 | } | |
|
78 | ||
|
79 | if (event->button() == Qt::LeftButton) { | |
|
80 | m_isScrolling = false; | |
|
81 | } | |
|
82 | } | |
|
83 | ||
|
84 | //![1] | |
|
85 | void ChartView::keyPressEvent(QKeyEvent *event) | |
|
86 | { | |
|
87 | switch (event->key()) { | |
|
88 | case Qt::Key_Plus: | |
|
89 | chart()->zoomIn(); | |
|
90 | break; | |
|
91 | case Qt::Key_Minus: | |
|
92 | chart()->zoomOut(); | |
|
93 | break; | |
|
94 | //![1] | |
|
95 | case Qt::Key_Left: | |
|
96 | chart()->scroll(-10, 0); | |
|
97 | break; | |
|
98 | case Qt::Key_Right: | |
|
99 | chart()->scroll(10, 0); | |
|
100 | break; | |
|
101 | case Qt::Key_Up: | |
|
102 | chart()->scroll(0, 10); | |
|
103 | break; | |
|
104 | case Qt::Key_Down: | |
|
105 | chart()->scroll(0, -10); | |
|
106 | break; | |
|
107 | default: | |
|
108 | QGraphicsView::keyPressEvent(event); | |
|
109 | break; | |
|
110 | } | |
|
111 | } |
@@ -0,0 +1,46 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #ifndef CHARTVIEW_H | |
|
22 | #define CHARTVIEW_H | |
|
23 | ||
|
24 | #include <QChartView> | |
|
25 | #include <QRubberBand> | |
|
26 | ||
|
27 | QTCOMMERCIALCHART_USE_NAMESPACE | |
|
28 | ||
|
29 | class ChartView : public QChartView | |
|
30 | { | |
|
31 | public: | |
|
32 | ChartView(QChart *chart, QWidget *parent = 0); | |
|
33 | protected: | |
|
34 | void mousePressEvent(QMouseEvent *event); | |
|
35 | void mouseMoveEvent(QMouseEvent *event); | |
|
36 | void mouseReleaseEvent(QMouseEvent *event); | |
|
37 | void keyPressEvent(QKeyEvent *event); | |
|
38 | ||
|
39 | private: | |
|
40 | bool m_isScrolling; | |
|
41 | bool m_isRubberBandShown; | |
|
42 | QRubberBand m_rubberBand; | |
|
43 | QPoint m_origin; | |
|
44 | }; | |
|
45 | ||
|
46 | #endif |
@@ -0,0 +1,89 | |||
|
1 | /**************************************************************************** | |
|
2 | ** | |
|
3 | ** Copyright (C) 2012 Digia Plc | |
|
4 | ** All rights reserved. | |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
|
6 | ** | |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
|
8 | ** | |
|
9 | ** $QT_BEGIN_LICENSE$ | |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
|
13 | ** a written agreement between you and Digia. | |
|
14 | ** | |
|
15 | ** If you have questions regarding the use of this file, please use | |
|
16 | ** contact form at http://qt.digia.com | |
|
17 | ** $QT_END_LICENSE$ | |
|
18 | ** | |
|
19 | ****************************************************************************/ | |
|
20 | ||
|
21 | #include "chart.h" | |
|
22 | #include "chartview.h" | |
|
23 | #include <QApplication> | |
|
24 | #include <QMainWindow> | |
|
25 | #include <qmath.h> | |
|
26 | #include <QBarSeries> | |
|
27 | #include <QBarSet> | |
|
28 | #include <QBarCategoriesAxis> | |
|
29 | #include <QLineSeries> | |
|
30 | #include <QHorizontalBarSeries> | |
|
31 | ||
|
32 | QTCOMMERCIALCHART_USE_NAMESPACE | |
|
33 | ||
|
34 | int main(int argc, char *argv[]) | |
|
35 | { | |
|
36 | QApplication a(argc, argv); | |
|
37 | ||
|
38 | QLineSeries* series = new QLineSeries(); | |
|
39 | for (int i = 0; i < 500; i++) { | |
|
40 | QPointF p((qreal) i, qSin(M_PI / 50 * i) * 100); | |
|
41 | p.ry() += qrand() % 20; | |
|
42 | *series << p; | |
|
43 | } | |
|
44 | ||
|
45 | QBarSet *set0 = new QBarSet("Jane"); | |
|
46 | QBarSet *set1 = new QBarSet("John"); | |
|
47 | QBarSet *set2 = new QBarSet("Axel"); | |
|
48 | QBarSet *set3 = new QBarSet("Mary"); | |
|
49 | QBarSet *set4 = new QBarSet("Samantha"); | |
|
50 | ||
|
51 | *set0 << 1 << 2 << 3 << 4 << 5 << 6; | |
|
52 | *set1 << 5 << 0 << 0 << 4 << 0 << 7; | |
|
53 | *set2 << 3 << 5 << 8 << 13 << 8 << 5; | |
|
54 | *set3 << 5 << 6 << 7 << 3 << 4 << 5; | |
|
55 | *set4 << 9 << 7 << 5 << 3 << 1 << 2; | |
|
56 | ||
|
57 | //QHorizontalBarSeries* series2 = new QHorizontalBarSeries(); | |
|
58 | QBarSeries* series2 = new QBarSeries(); | |
|
59 | series2->append(set0); | |
|
60 | series2->append(set1); | |
|
61 | series2->append(set2); | |
|
62 | series2->append(set3); | |
|
63 | series2->append(set4); | |
|
64 | ||
|
65 | Chart* chart = new Chart(); | |
|
66 | // chart->addSeries(series); | |
|
67 | chart->addSeries(series2); | |
|
68 | chart->setTitle("Scroll in/out example"); | |
|
69 | chart->legend()->hide(); | |
|
70 | chart->createDefaultAxes(); | |
|
71 | ||
|
72 | QStringList categories; | |
|
73 | categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; | |
|
74 | QBarCategoriesAxis* axis = new QBarCategoriesAxis(); | |
|
75 | axis->append(categories); | |
|
76 | chart->setAxisX(axis, series2); | |
|
77 | ||
|
78 | ChartView* chartView = new ChartView(chart); | |
|
79 | chartView->setRenderHint(QPainter::Antialiasing); | |
|
80 | ||
|
81 | QMainWindow window; | |
|
82 | window.setCentralWidget(chartView); | |
|
83 | window.resize(400, 300); | |
|
84 | window.grabGesture(Qt::PanGesture); | |
|
85 | window.grabGesture(Qt::PinchGesture); | |
|
86 | window.show(); | |
|
87 | ||
|
88 | return a.exec(); | |
|
89 | } |
@@ -0,0 +1,7 | |||
|
1 | !include( ../examples.pri ) { | |
|
2 | error( "Couldn't find the examples.pri file!" ) | |
|
3 | } | |
|
4 | TARGET = scrollchart | |
|
5 | HEADERS += chart.h chartview.h | |
|
6 | ||
|
7 | SOURCES += main.cpp chart.cpp chartview.cpp |
@@ -28,4 +28,5 SUBDIRS += \ | |||
|
28 | 28 | horizontalstackedbarchart \ |
|
29 | 29 | horizontalpercentbarchart \ |
|
30 | 30 | donut \ |
|
31 | donutdrilldown | |
|
31 | donutdrilldown \ | |
|
32 | scrollchart |
@@ -21,9 +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 | #include <QVXYModelMapper> | |
|
25 | #include <QHBarModelMapper> | |
|
26 | #include <QVPieModelMapper> | |
|
27 | 27 | #include <QLineSeries> |
|
28 | 28 | #include <QSplineSeries> |
|
29 | 29 | #include <QScatterSeries> |
@@ -49,7 +49,6 Engine::~Engine() | |||
|
49 | 49 | delete m_chart; |
|
50 | 50 | delete m_selection; |
|
51 | 51 | delete m_model; |
|
52 | ||
|
53 | 52 | } |
|
54 | 53 | |
|
55 | 54 | void Engine::createModels() |
@@ -155,6 +154,8 QList<QAbstractSeries*> Engine::addSeries(QAbstractSeries::SeriesType type) | |||
|
155 | 154 | break; |
|
156 | 155 | } |
|
157 | 156 | } |
|
157 | ||
|
158 | m_chart->createDefaultAxes(); | |
|
158 | 159 | return result; |
|
159 | 160 | } |
|
160 | 161 | |
@@ -255,14 +256,13 bool Engine::load(const QString &filename) | |||
|
255 | 256 | |
|
256 | 257 | void Engine::setupXYSeries(QXYSeries *xyseries, const QList<int>& columns, int column, int minRow, int maxRow) |
|
257 | 258 | { |
|
258 | xyseries->setModel(m_model); | |
|
259 | QXYModelMapper* mapper = new QXYModelMapper(xyseries); | |
|
260 |
|
|
|
261 |
mapper->set |
|
|
262 |
mapper->set |
|
|
263 | mapper->setOrientation(Qt::Vertical); | |
|
264 |
mapper->set |
|
|
265 | mapper->setCount(maxRow - minRow + 1); | |
|
259 | QVXYModelMapper* mapper = new QVXYModelMapper(xyseries); | |
|
260 | mapper->setSeries(xyseries); | |
|
261 | mapper->setModel(m_model); | |
|
262 | mapper->setXColumn(columns.first()); | |
|
263 | mapper->setYColumn(columns.at(column)); | |
|
264 | mapper->setFirstRow(minRow); | |
|
265 | mapper->setRowCount(maxRow - minRow + 1); | |
|
266 | 266 | m_chart->addSeries(xyseries); |
|
267 | 267 | xyseries->setName(QString("Series %1").arg(m_chart->series().count())); |
|
268 | 268 | QObject::connect(xyseries,SIGNAL(clicked(const QPointF&)),this,SIGNAL(selected())); |
@@ -277,17 +277,15 void Engine::setupXYSeries(QXYSeries *xyseries, const QList<int>& columns, int c | |||
|
277 | 277 | m_seriesModelIndex.insert(xyseries,result); |
|
278 | 278 | } |
|
279 | 279 | |
|
280 | void Engine::setupBarSeries(QBarSeries *bar, const QList<int>& columns, int minRow, int maxRow) | |
|
280 | void Engine::setupBarSeries(QAbstractBarSeries *bar, const QList<int>& columns, int minRow, int maxRow) | |
|
281 | 281 | { |
|
282 | bar->setModel(m_model); | |
|
283 | QBarModelMapper* mapper = new QBarModelMapper(bar); | |
|
284 |
|
|
|
285 | mapper->setMapCategories(columns.first()); | |
|
286 | mapper->setMapBarTop(columns.last()); | |
|
287 |
mapper->set |
|
|
288 | mapper->setOrientation(Qt::Vertical); | |
|
289 | mapper->setFirst(minRow); | |
|
290 | mapper->setCount(maxRow - minRow + 1); | |
|
282 | QHBarModelMapper* mapper = new QHBarModelMapper(bar); | |
|
283 | mapper->setSeries(bar); | |
|
284 | mapper->setModel(m_model); | |
|
285 | mapper->setFirstColumn(minRow); | |
|
286 | mapper->setColumnCount(maxRow - minRow + 1); | |
|
287 | mapper->setFirstBarSetRow(columns.at(1)); | |
|
288 | mapper->setLastBarSetRow(columns.last()); | |
|
291 | 289 | m_chart->addSeries(bar); |
|
292 | 290 | bar->setName(QString("Series %1").arg(m_chart->series().count())); |
|
293 | 291 | |
@@ -301,14 +299,13 void Engine::setupBarSeries(QBarSeries *bar, const QList<int>& columns, int minR | |||
|
301 | 299 | |
|
302 | 300 | void Engine::setupPieSeries(QPieSeries *pie, const QList<int>& columns, int minRow, int maxRow) |
|
303 | 301 | { |
|
304 | pie->setModel(m_model); | |
|
305 | QPieModelMapper* mapper = new QPieModelMapper(pie); | |
|
306 |
p |
|
|
307 |
mapper->set |
|
|
308 |
mapper->set |
|
|
309 | mapper->setOrientation(Qt::Vertical); | |
|
310 |
mapper->set |
|
|
311 | mapper->setCount(maxRow - minRow + 1); | |
|
302 | QVPieModelMapper* mapper = new QVPieModelMapper(pie); | |
|
303 | mapper->setSeries(pie); | |
|
304 | mapper->setModel(m_model); | |
|
305 | mapper->setValuesColumn(columns.at(1)); | |
|
306 | mapper->setLabelsColumn(columns.first()); | |
|
307 | mapper->setFirstRow(minRow); | |
|
308 | mapper->setRowCount(maxRow - minRow + 1); | |
|
312 | 309 | m_chart->addSeries(pie); |
|
313 | 310 | pie->setName(QString("Series %1").arg(m_chart->series().count())); |
|
314 | 311 | |
@@ -320,22 +317,22 void Engine::setupPieSeries(QPieSeries *pie, const QList<int>& columns, int minR | |||
|
320 | 317 | |
|
321 | 318 | void Engine::setupAreaSeries(QAreaSeries *series, const QList<int>& columns, int minRow, int maxRow) |
|
322 | 319 | { |
|
323 | series->lowerSeries()->setModel(m_model); | |
|
324 | series->upperSeries()->setModel(m_model); | |
|
325 | QXYModelMapper* umapper = new QXYModelMapper(series); | |
|
326 |
umapper->set |
|
|
327 |
umapper->set |
|
|
328 | umapper->setOrientation(Qt::Vertical); | |
|
329 |
umapper->set |
|
|
330 | umapper->setCount(maxRow - minRow + 1); | |
|
331 | QXYModelMapper* lmapper = new QXYModelMapper(series); | |
|
332 | lmapper->setMapX(columns.first()); | |
|
333 |
lmapper->setM |
|
|
334 | lmapper->setOrientation(Qt::Vertical); | |
|
335 |
lmapper->set |
|
|
336 |
lmapper->set |
|
|
337 | series->upperSeries()->setModelMapper(umapper); | |
|
338 | series->lowerSeries()->setModelMapper(lmapper); | |
|
320 | QVXYModelMapper* umapper = new QVXYModelMapper(series); | |
|
321 | umapper->setSeries(series->upperSeries()); | |
|
322 | umapper->setModel(m_model); | |
|
323 | umapper->setXColumn(columns.first()); | |
|
324 | umapper->setYColumn(columns.at(1)); | |
|
325 | umapper->setFirstRow(minRow); | |
|
326 | umapper->setRowCount(maxRow - minRow + 1); | |
|
327 | ||
|
328 | QVXYModelMapper* lmapper = new QVXYModelMapper(series); | |
|
329 | lmapper->setSeries(series->lowerSeries()); | |
|
330 | lmapper->setModel(m_model); | |
|
331 | lmapper->setXColumn(columns.first()); | |
|
332 | lmapper->setYColumn(columns.at(2)); | |
|
333 | lmapper->setFirstRow(minRow); | |
|
334 | lmapper->setRowCount(maxRow - minRow + 1); | |
|
335 | ||
|
339 | 336 | m_chart->addSeries(series); |
|
340 | 337 | series->setName(QString("Series %1").arg(m_chart->series().count())); |
|
341 | 338 |
@@ -32,7 +32,7 class QItemSelectionModel; | |||
|
32 | 32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
33 | 33 | class QChart; |
|
34 | 34 | class QXYSeries; |
|
35 | class QBarSeries; | |
|
35 | class QAbstractBarSeries; | |
|
36 | 36 | class QPieSeries; |
|
37 | 37 | class QAreaSeries; |
|
38 | 38 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -61,7 +61,7 signals: | |||
|
61 | 61 | private: |
|
62 | 62 | void createModels(); |
|
63 | 63 | void setupXYSeries(QXYSeries *xyseries, const QList<int>& columns, int column, int minRow, int maxRow); |
|
64 | void setupBarSeries(QBarSeries *series, const QList<int>& columns, int minRow, int maxRow); | |
|
64 | void setupBarSeries(QAbstractBarSeries *series, const QList<int>& columns, int minRow, int maxRow); | |
|
65 | 65 | void setupPieSeries(QPieSeries *pie, const QList<int>& columns, int minRow, int maxRow); |
|
66 | 66 | void setupAreaSeries(QAreaSeries *series, const QList<int>& columns, int minRow, int maxRow); |
|
67 | 67 |
General Comments 0
You need to be logged in to leave comments.
Login now