@@ -1,29 +1,29 | |||||
1 | TEMPLATE = subdirs |
|
1 | TEMPLATE = subdirs | |
2 | SUBDIRS += \ |
|
2 | SUBDIRS += \ | |
3 | areachart \ |
|
3 | areachart \ | |
4 | barchart \ |
|
4 | barchart \ | |
5 | #chartview \ |
|
5 | #chartview \ | |
6 | customchart \ |
|
6 | customchart \ | |
7 | #dynamiclinechart \ |
|
7 | #dynamiclinechart \ | |
8 | #ekgchart \ |
|
8 | #ekgchart \ | |
9 | linechart \ |
|
9 | linechart \ | |
10 | #multichart \ |
|
10 | #multichart \ | |
11 | percentbarchart \ |
|
11 | percentbarchart \ | |
12 | piechart \ |
|
12 | piechart \ | |
13 | piechartdrilldown \ |
|
13 | piechartdrilldown \ | |
14 | #presenterchart \ |
|
14 | #presenterchart \ | |
15 | scatterchart \ |
|
15 | scatterchart \ | |
16 |
|
|
16 | scatterinteractions \ | |
17 | #splinechart \ |
|
17 | #splinechart \ | |
18 | stackedbarchart \ |
|
18 | stackedbarchart \ | |
19 | stackedbarchartdrilldown \ |
|
19 | stackedbarchartdrilldown \ | |
20 | #tablemodelchart \ |
|
20 | #tablemodelchart \ | |
21 | zoomlinechart |
|
21 | zoomlinechart | |
22 |
|
22 | |||
23 |
|
23 | |||
24 |
|
24 | |||
25 |
|
25 | |||
26 |
|
26 | |||
27 |
|
27 | |||
28 |
|
28 | |||
29 |
|
29 |
@@ -1,58 +1,57 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "mainwindow.h" |
|
21 | #include "mainwindow.h" | |
22 |
#include < |
|
22 | #include <QChartView> | |
23 | #include <qchartview.h> |
|
|||
24 | #include <qchartaxis.h> |
|
|||
25 | #include <QDebug> |
|
|||
26 |
|
23 | |||
27 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
24 | QTCOMMERCIALCHART_USE_NAMESPACE | |
28 |
|
25 | |||
29 | MainWindow::MainWindow(QWidget *parent) |
|
26 | MainWindow::MainWindow(QWidget *parent) | |
30 | : QMainWindow(parent) |
|
27 | : QMainWindow(parent) | |
31 | { |
|
28 | { | |
32 |
QChart |
|
29 | QChart *chart = new QChart(); | |
33 |
chart |
|
30 | chart->setTitle("Click to remove scatter point"); | |
34 | chartView->setRenderHint(QPainter::Antialiasing); |
|
|||
35 | setCentralWidget(chartView); |
|
|||
36 |
|
31 | |||
37 | m_scatter = new QScatterSeries(); |
|
32 | m_scatter = new QScatterSeries(); | |
38 | for(qreal x(0.5); x <= 4.0; x += 0.5) { |
|
33 | for(qreal x(0.5); x <= 4.0; x += 0.5) { | |
39 | for(qreal y(0.5); y <= 4.0; y += 0.5) { |
|
34 | for(qreal y(0.5); y <= 4.0; y += 0.5) { | |
40 | *m_scatter << QPointF(x, y); |
|
35 | *m_scatter << QPointF(x, y); | |
41 | } |
|
36 | } | |
42 | } |
|
37 | } | |
43 |
|
38 | |||
44 |
chart |
|
39 | chart->addSeries(m_scatter); | |
45 |
chart |
|
40 | chart->axisX()->setRange(0, 4.5); | |
46 |
chart |
|
41 | chart->axisY()->setRange(0, 4.5); | |
47 |
|
42 | |||
48 | connect(m_scatter, SIGNAL(clicked(const QPointF&)), this, SLOT(handleClickedPoint(const QPointF&))); |
|
43 | connect(m_scatter, SIGNAL(clicked(const QPointF&)), this, SLOT(handleClickedPoint(const QPointF&))); | |
|
44 | ||||
|
45 | QChartView *chartView = new QChartView(chart); | |||
|
46 | chartView->setRenderHint(QPainter::Antialiasing); | |||
|
47 | setCentralWidget(chartView); | |||
49 | } |
|
48 | } | |
50 |
|
49 | |||
51 | MainWindow::~MainWindow() |
|
50 | MainWindow::~MainWindow() | |
52 | { |
|
51 | { | |
53 | } |
|
52 | } | |
54 |
|
53 | |||
55 | void MainWindow::handleClickedPoint(const QPointF& point) |
|
54 | void MainWindow::handleClickedPoint(const QPointF& point) | |
56 | { |
|
55 | { | |
57 | m_scatter->remove(point); |
|
56 | m_scatter->remove(point); | |
58 | } |
|
57 | } |
General Comments 0
You need to be logged in to leave comments.
Login now