@@ -1,49 +1,49 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | #ifndef DATASOURCE_H |
|
19 | #ifndef DATASOURCE_H | |
20 | #define DATASOURCE_H |
|
20 | #define DATASOURCE_H | |
21 |
|
21 | |||
22 | #include <QtCore/QObject> |
|
22 | #include <QtCore/QObject> | |
23 | #include <QtCharts/QAbstractSeries> |
|
23 | #include <QtCharts/QAbstractSeries> | |
24 |
|
24 | |||
25 | QT_BEGIN_NAMESPACE |
|
25 | QT_BEGIN_NAMESPACE | |
26 | class QQuickView; |
|
26 | class QQuickView; | |
27 | QT_END_NAMESPACE |
|
27 | QT_END_NAMESPACE | |
28 |
|
28 | |||
29 | QT_CHARTS_USE_NAMESPACE |
|
29 | QT_CHARTS_USE_NAMESPACE | |
30 |
|
30 | |||
31 | class DataSource : public QObject |
|
31 | class DataSource : public QObject | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | public: |
|
34 | public: | |
35 | explicit DataSource(QQuickView *appViewer, QObject *parent = 0); |
|
35 | explicit DataSource(QQuickView *appViewer, QObject *parent = 0); | |
36 |
|
36 | |||
37 | signals: |
|
37 | Q_SIGNALS: | |
38 |
|
38 | |||
39 | public slots: |
|
39 | public slots: | |
40 | void generateData(int type, int rowCount, int colCount); |
|
40 | void generateData(int type, int rowCount, int colCount); | |
41 | void update(QAbstractSeries *series); |
|
41 | void update(QAbstractSeries *series); | |
42 |
|
42 | |||
43 | private: |
|
43 | private: | |
44 | QQuickView *m_appViewer; |
|
44 | QQuickView *m_appViewer; | |
45 | QList<QList<QPointF> > m_data; |
|
45 | QList<QList<QPointF> > m_data; | |
46 | int m_index; |
|
46 | int m_index; | |
47 | }; |
|
47 | }; | |
48 |
|
48 | |||
49 | #endif // DATASOURCE_H |
|
49 | #endif // DATASOURCE_H |
@@ -1,100 +1,100 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | #include "qchartsplugin.h" |
|
19 | #include "qchartsplugin.h" | |
20 | #include <QtCharts/QChartView> |
|
20 | #include <QtCharts/QChartView> | |
21 | #include <QtCore/QtPlugin> |
|
21 | #include <QtCore/QtPlugin> | |
22 |
|
22 | |||
23 | QT_CHARTS_USE_NAMESPACE |
|
23 | QT_CHARTS_USE_NAMESPACE | |
24 |
|
24 | |||
25 | QChartsPlugin::QChartsPlugin(QObject *parent) : |
|
25 | QChartsPlugin::QChartsPlugin(QObject *parent) : | |
26 | QObject(parent) |
|
26 | QObject(parent) | |
27 | { |
|
27 | { | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | QChartsPlugin::~QChartsPlugin() |
|
30 | QChartsPlugin::~QChartsPlugin() | |
31 | { |
|
31 | { | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | QString QChartsPlugin::name() const |
|
34 | QString QChartsPlugin::name() const | |
35 | { |
|
35 | { | |
36 | return QStringLiteral("QtCharts::QChartView"); |
|
36 | return QStringLiteral("QtCharts::QChartView"); | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | QString QChartsPlugin::includeFile() const |
|
39 | QString QChartsPlugin::includeFile() const | |
40 | { |
|
40 | { | |
41 | #ifdef linux |
|
41 | #ifdef linux | |
42 | QString myNewLine = QStringLiteral("\n"); |
|
42 | QString myNewLine = QStringLiteral("\n"); | |
43 | #endif |
|
43 | #endif | |
44 | #ifdef WIN32 |
|
44 | #ifdef WIN32 | |
45 | QString myNewLine = QStringLiteral("\n\r"); |
|
45 | QString myNewLine = QStringLiteral("\n\r"); | |
46 | #endif |
|
46 | #endif | |
47 | #ifdef __APPLE__ |
|
47 | #ifdef __APPLE__ | |
48 | QString myNewLine = QStringLiteral("\n"); |
|
48 | QString myNewLine = QStringLiteral("\n"); | |
49 | #endif |
|
49 | #endif | |
50 | return QStringLiteral("<QtCharts/QChartView>") + myNewLine |
|
50 | return QStringLiteral("<QtCharts/QChartView>") + myNewLine | |
51 | + QStringLiteral("#include <chartsnamespace.h>"); |
|
51 | + QStringLiteral("#include <QtCharts/chartsnamespace.h>"); | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | QString QChartsPlugin::group() const |
|
54 | QString QChartsPlugin::group() const | |
55 | { |
|
55 | { | |
56 | return tr("Qt Charts Widgets"); |
|
56 | return tr("Qt Charts Widgets"); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | QIcon QChartsPlugin::icon() const |
|
59 | QIcon QChartsPlugin::icon() const | |
60 | { |
|
60 | { | |
61 | return QIcon(QStringLiteral(":/images/qcharts.png")); |
|
61 | return QIcon(QStringLiteral(":/images/qcharts.png")); | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | QString QChartsPlugin::toolTip() const |
|
64 | QString QChartsPlugin::toolTip() const | |
65 | { |
|
65 | { | |
66 | return tr("A Qt Charts view widget"); |
|
66 | return tr("A Qt Charts view widget"); | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | QString QChartsPlugin::whatsThis() const |
|
69 | QString QChartsPlugin::whatsThis() const | |
70 | { |
|
70 | { | |
71 | return tr("This widget is presents QChartView widget"); |
|
71 | return tr("This widget is presents QChartView widget"); | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | bool QChartsPlugin::isContainer() const |
|
74 | bool QChartsPlugin::isContainer() const | |
75 | { |
|
75 | { | |
76 | return false; |
|
76 | return false; | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | QWidget *QChartsPlugin::createWidget(QWidget *parent) |
|
79 | QWidget *QChartsPlugin::createWidget(QWidget *parent) | |
80 | { |
|
80 | { | |
81 | return new QChartView(new QChart(), parent); |
|
81 | return new QChartView(new QChart(), parent); | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | QString QChartsPlugin::domXml() const |
|
84 | QString QChartsPlugin::domXml() const | |
85 | { |
|
85 | { | |
86 | return QStringLiteral("\ |
|
86 | return QStringLiteral("\ | |
87 | <ui language=\"c++\">\ |
|
87 | <ui language=\"c++\">\ | |
88 | <widget class=\"QtCharts::QChartView\" name=\"chartview\">\ |
|
88 | <widget class=\"QtCharts::QChartView\" name=\"chartview\">\ | |
89 | <property name=\"geometry\">\ |
|
89 | <property name=\"geometry\">\ | |
90 | <rect>\ |
|
90 | <rect>\ | |
91 | <x>0</x>\ |
|
91 | <x>0</x>\ | |
92 | <y>0</y>\ |
|
92 | <y>0</y>\ | |
93 | <width>200</width>\ |
|
93 | <width>200</width>\ | |
94 | <height>200</height>\ |
|
94 | <height>200</height>\ | |
95 | </rect>\ |
|
95 | </rect>\ | |
96 | </property>\ |
|
96 | </property>\ | |
97 | </widget>\ |
|
97 | </widget>\ | |
98 | </ui>"); |
|
98 | </ui>"); | |
99 | } |
|
99 | } | |
100 |
|
100 |
@@ -1,55 +1,55 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | // W A R N I N G |
|
19 | // W A R N I N G | |
20 | // ------------- |
|
20 | // ------------- | |
21 | // |
|
21 | // | |
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | |
23 | // implementation detail. This header file may change from version to |
|
23 | // implementation detail. This header file may change from version to | |
24 | // version without notice, or even be removed. |
|
24 | // version without notice, or even be removed. | |
25 | // |
|
25 | // | |
26 | // We mean it. |
|
26 | // We mean it. | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | #ifndef BARCHARTITEM_H |
|
29 | #ifndef BARCHARTITEM_H | |
30 | #define BARCHARTITEM_H |
|
30 | #define BARCHARTITEM_H | |
31 |
|
31 | |||
32 | #include <private/abstractbarchartitem_p.h> |
|
32 | #include <private/abstractbarchartitem_p.h> | |
33 | #include <QtCharts/QStackedBarSeries> |
|
33 | #include <QtCharts/QStackedBarSeries> | |
34 | #include <QtWidgets/QGraphicsItem> |
|
34 | #include <QtWidgets/QGraphicsItem> | |
35 |
|
35 | |||
36 | QT_CHARTS_BEGIN_NAMESPACE |
|
36 | QT_CHARTS_BEGIN_NAMESPACE | |
37 |
|
37 | |||
38 | class BarChartItem : public AbstractBarChartItem |
|
38 | class BarChartItem : public AbstractBarChartItem | |
39 | { |
|
39 | { | |
40 | Q_OBJECT |
|
40 | Q_OBJECT | |
41 | public: |
|
41 | public: | |
42 | BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0); |
|
42 | BarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0); | |
43 |
|
43 | |||
44 |
private |
|
44 | private Q_SLOTS: | |
45 | void handleLabelsPositionChanged(); |
|
45 | void handleLabelsPositionChanged(); | |
46 | void positionLabels(); |
|
46 | void positionLabels(); | |
47 |
|
47 | |||
48 | private: |
|
48 | private: | |
49 | virtual QVector<QRectF> calculateLayout(); |
|
49 | virtual QVector<QRectF> calculateLayout(); | |
50 | void initializeLayout(); |
|
50 | void initializeLayout(); | |
51 | }; |
|
51 | }; | |
52 |
|
52 | |||
53 | QT_CHARTS_END_NAMESPACE |
|
53 | QT_CHARTS_END_NAMESPACE | |
54 |
|
54 | |||
55 | #endif // BARCHARTITEM_H |
|
55 | #endif // BARCHARTITEM_H |
@@ -1,57 +1,57 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | // W A R N I N G |
|
19 | // W A R N I N G | |
20 | // ------------- |
|
20 | // ------------- | |
21 | // |
|
21 | // | |
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | |
23 | // implementation detail. This header file may change from version to |
|
23 | // implementation detail. This header file may change from version to | |
24 | // version without notice, or even be removed. |
|
24 | // version without notice, or even be removed. | |
25 | // |
|
25 | // | |
26 | // We mean it. |
|
26 | // We mean it. | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | #ifndef PERCENTBARCHARTITEM_H |
|
29 | #ifndef PERCENTBARCHARTITEM_H | |
30 | #define PERCENTBARCHARTITEM_H |
|
30 | #define PERCENTBARCHARTITEM_H | |
31 |
|
31 | |||
32 | #include <private/abstractbarchartitem_p.h> |
|
32 | #include <private/abstractbarchartitem_p.h> | |
33 | #include <QtWidgets/QGraphicsItem> |
|
33 | #include <QtWidgets/QGraphicsItem> | |
34 |
|
34 | |||
35 | QT_CHARTS_BEGIN_NAMESPACE |
|
35 | QT_CHARTS_BEGIN_NAMESPACE | |
36 |
|
36 | |||
37 | class QAbstractBarSeries; |
|
37 | class QAbstractBarSeries; | |
38 |
|
38 | |||
39 | class PercentBarChartItem : public AbstractBarChartItem |
|
39 | class PercentBarChartItem : public AbstractBarChartItem | |
40 | { |
|
40 | { | |
41 | Q_OBJECT |
|
41 | Q_OBJECT | |
42 | public: |
|
42 | public: | |
43 | PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0); |
|
43 | PercentBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item = 0); | |
44 | void handleUpdatedBars(); |
|
44 | void handleUpdatedBars(); | |
45 |
|
45 | |||
46 |
private |
|
46 | private Q_SLOTS: | |
47 | void handleLabelsPositionChanged(); |
|
47 | void handleLabelsPositionChanged(); | |
48 | void positionLabels(); |
|
48 | void positionLabels(); | |
49 |
|
49 | |||
50 | private: |
|
50 | private: | |
51 | virtual QVector<QRectF> calculateLayout(); |
|
51 | virtual QVector<QRectF> calculateLayout(); | |
52 | void initializeLayout(); |
|
52 | void initializeLayout(); | |
53 | }; |
|
53 | }; | |
54 |
|
54 | |||
55 | QT_CHARTS_END_NAMESPACE |
|
55 | QT_CHARTS_END_NAMESPACE | |
56 |
|
56 | |||
57 | #endif // PERCENTBARCHARTITEM_H |
|
57 | #endif // PERCENTBARCHARTITEM_H |
@@ -1,56 +1,56 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | // W A R N I N G |
|
19 | // W A R N I N G | |
20 | // ------------- |
|
20 | // ------------- | |
21 | // |
|
21 | // | |
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | |
23 | // implementation detail. This header file may change from version to |
|
23 | // implementation detail. This header file may change from version to | |
24 | // version without notice, or even be removed. |
|
24 | // version without notice, or even be removed. | |
25 | // |
|
25 | // | |
26 | // We mean it. |
|
26 | // We mean it. | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | #ifndef STACKEDBARCHARTITEM_H |
|
29 | #ifndef STACKEDBARCHARTITEM_H | |
30 | #define STACKEDBARCHARTITEM_H |
|
30 | #define STACKEDBARCHARTITEM_H | |
31 |
|
31 | |||
32 | #include <private/abstractbarchartitem_p.h> |
|
32 | #include <private/abstractbarchartitem_p.h> | |
33 | #include <QtCharts/QStackedBarSeries> |
|
33 | #include <QtCharts/QStackedBarSeries> | |
34 | #include <QtWidgets/QGraphicsItem> |
|
34 | #include <QtWidgets/QGraphicsItem> | |
35 |
|
35 | |||
36 | QT_CHARTS_BEGIN_NAMESPACE |
|
36 | QT_CHARTS_BEGIN_NAMESPACE | |
37 |
|
37 | |||
38 | class StackedBarChartItem : public AbstractBarChartItem |
|
38 | class StackedBarChartItem : public AbstractBarChartItem | |
39 | { |
|
39 | { | |
40 | Q_OBJECT |
|
40 | Q_OBJECT | |
41 | public: |
|
41 | public: | |
42 | StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item =0); |
|
42 | StackedBarChartItem(QAbstractBarSeries *series, QGraphicsItem* item =0); | |
43 |
|
43 | |||
44 |
private |
|
44 | private Q_SLOTS: | |
45 | void handleLabelsPositionChanged(); |
|
45 | void handleLabelsPositionChanged(); | |
46 | void positionLabels(); |
|
46 | void positionLabels(); | |
47 |
|
47 | |||
48 | private: |
|
48 | private: | |
49 | virtual QVector<QRectF> calculateLayout(); |
|
49 | virtual QVector<QRectF> calculateLayout(); | |
50 | void initializeLayout(); |
|
50 | void initializeLayout(); | |
51 |
|
51 | |||
52 | }; |
|
52 | }; | |
53 |
|
53 | |||
54 | QT_CHARTS_END_NAMESPACE |
|
54 | QT_CHARTS_END_NAMESPACE | |
55 |
|
55 | |||
56 | #endif // STACKEDBARCHARTITEM_H |
|
56 | #endif // STACKEDBARCHARTITEM_H |
@@ -1,101 +1,101 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | // W A R N I N G |
|
19 | // W A R N I N G | |
20 | // ------------- |
|
20 | // ------------- | |
21 | // |
|
21 | // | |
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | |
23 | // implementation detail. This header file may change from version to |
|
23 | // implementation detail. This header file may change from version to | |
24 | // version without notice, or even be removed. |
|
24 | // version without notice, or even be removed. | |
25 | // |
|
25 | // | |
26 | // We mean it. |
|
26 | // We mean it. | |
27 |
|
27 | |||
28 | #ifndef QBOXPLOTSERIES_P_H |
|
28 | #ifndef QBOXPLOTSERIES_P_H | |
29 | #define QBOXPLOTSERIES_P_H |
|
29 | #define QBOXPLOTSERIES_P_H | |
30 |
|
30 | |||
31 | #include <QtCharts/QBoxPlotSeries> |
|
31 | #include <QtCharts/QBoxPlotSeries> | |
32 | #include <private/qabstractbarseries_p.h> |
|
32 | #include <private/qabstractbarseries_p.h> | |
33 | #include <private/abstractdomain_p.h> |
|
33 | #include <private/abstractdomain_p.h> | |
34 | #include <QtCharts/QBarSet> |
|
34 | #include <QtCharts/QBarSet> | |
35 |
|
35 | |||
36 | QT_CHARTS_BEGIN_NAMESPACE |
|
36 | QT_CHARTS_BEGIN_NAMESPACE | |
37 |
|
37 | |||
38 | class BoxPlotAnimation; |
|
38 | class BoxPlotAnimation; | |
39 |
|
39 | |||
40 | class QBoxPlotSeriesPrivate : public QAbstractSeriesPrivate |
|
40 | class QBoxPlotSeriesPrivate : public QAbstractSeriesPrivate | |
41 | { |
|
41 | { | |
42 | Q_OBJECT |
|
42 | Q_OBJECT | |
43 |
|
43 | |||
44 | public: |
|
44 | public: | |
45 | QBoxPlotSeriesPrivate(QBoxPlotSeries *q); |
|
45 | QBoxPlotSeriesPrivate(QBoxPlotSeries *q); | |
46 | ~QBoxPlotSeriesPrivate(); |
|
46 | ~QBoxPlotSeriesPrivate(); | |
47 |
|
47 | |||
48 | void initializeGraphics(QGraphicsItem *parent); |
|
48 | void initializeGraphics(QGraphicsItem *parent); | |
49 | void initializeDomain(); |
|
49 | void initializeDomain(); | |
50 | void initializeAxes(); |
|
50 | void initializeAxes(); | |
51 | void initializeAnimations(QChart::AnimationOptions options); |
|
51 | void initializeAnimations(QChart::AnimationOptions options); | |
52 | void initializeTheme(int index, ChartTheme *theme, bool forced = false); |
|
52 | void initializeTheme(int index, ChartTheme *theme, bool forced = false); | |
53 |
|
53 | |||
54 | QList<QLegendMarker*> createLegendMarkers(QLegend *legend); |
|
54 | QList<QLegendMarker*> createLegendMarkers(QLegend *legend); | |
55 |
|
55 | |||
56 | virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; |
|
56 | virtual QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; | |
57 | QAbstractAxis *createDefaultAxis(Qt::Orientation orientation) const; |
|
57 | QAbstractAxis *createDefaultAxis(Qt::Orientation orientation) const; | |
58 |
|
58 | |||
59 | bool append(QBoxSet *set); |
|
59 | bool append(QBoxSet *set); | |
60 | bool remove(QBoxSet *set); |
|
60 | bool remove(QBoxSet *set); | |
61 | bool append(QList<QBoxSet *> sets); |
|
61 | bool append(QList<QBoxSet *> sets); | |
62 | bool remove(QList<QBoxSet *> sets); |
|
62 | bool remove(QList<QBoxSet *> sets); | |
63 | bool insert(int index, QBoxSet *set); |
|
63 | bool insert(int index, QBoxSet *set); | |
64 | QBoxSet *boxSetAt(int index); |
|
64 | QBoxSet *boxSetAt(int index); | |
65 |
|
65 | |||
66 | qreal max(); |
|
66 | qreal max(); | |
67 | qreal min(); |
|
67 | qreal min(); | |
68 |
|
68 | |||
69 | private: |
|
69 | private: | |
70 | void populateCategories(QBarCategoryAxis *axis); |
|
70 | void populateCategories(QBarCategoryAxis *axis); | |
71 |
|
71 | |||
72 | Q_SIGNALS: |
|
72 | Q_SIGNALS: | |
73 | void updated(); |
|
73 | void updated(); | |
74 | void clicked(int index, QBoxSet *barset); |
|
74 | void clicked(int index, QBoxSet *barset); | |
75 | void pressed(int index, QBoxSet *barset); |
|
75 | void pressed(int index, QBoxSet *barset); | |
76 | void released(int index, QBoxSet *barset); |
|
76 | void released(int index, QBoxSet *barset); | |
77 | void doubleClicked(int index, QBoxSet *barset); |
|
77 | void doubleClicked(int index, QBoxSet *barset); | |
78 | void updatedBoxes(); |
|
78 | void updatedBoxes(); | |
79 | void updatedLayout(); |
|
79 | void updatedLayout(); | |
80 | void restructuredBoxes(); |
|
80 | void restructuredBoxes(); | |
81 |
|
81 | |||
82 |
private |
|
82 | private Q_SLOTS: | |
83 | void handleSeriesChange(QAbstractSeries *series); |
|
83 | void handleSeriesChange(QAbstractSeries *series); | |
84 | void handleSeriesRemove(QAbstractSeries *series); |
|
84 | void handleSeriesRemove(QAbstractSeries *series); | |
85 |
|
85 | |||
86 | protected: |
|
86 | protected: | |
87 | QList<QBoxSet *> m_boxSets; |
|
87 | QList<QBoxSet *> m_boxSets; | |
88 | QPen m_pen; |
|
88 | QPen m_pen; | |
89 | QBrush m_brush; |
|
89 | QBrush m_brush; | |
90 | bool m_boxOutlineVisible; |
|
90 | bool m_boxOutlineVisible; | |
91 | int m_index; |
|
91 | int m_index; | |
92 | BoxPlotAnimation *m_animation; |
|
92 | BoxPlotAnimation *m_animation; | |
93 | qreal m_boxWidth; |
|
93 | qreal m_boxWidth; | |
94 |
|
94 | |||
95 | private: |
|
95 | private: | |
96 | Q_DECLARE_PUBLIC(QBoxPlotSeries) |
|
96 | Q_DECLARE_PUBLIC(QBoxPlotSeries) | |
97 | }; |
|
97 | }; | |
98 |
|
98 | |||
99 | QT_CHARTS_END_NAMESPACE |
|
99 | QT_CHARTS_END_NAMESPACE | |
100 |
|
100 | |||
101 | #endif |
|
101 | #endif |
@@ -1,193 +1,193 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | // W A R N I N G |
|
19 | // W A R N I N G | |
20 | // ------------- |
|
20 | // ------------- | |
21 | // |
|
21 | // | |
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | |
23 | // implementation detail. This header file may change from version to |
|
23 | // implementation detail. This header file may change from version to | |
24 | // version without notice, or even be removed. |
|
24 | // version without notice, or even be removed. | |
25 | // |
|
25 | // | |
26 | // We mean it. |
|
26 | // We mean it. | |
27 |
|
27 | |||
28 | #ifndef CHARTPRESENTER_H |
|
28 | #ifndef CHARTPRESENTER_H | |
29 | #define CHARTPRESENTER_H |
|
29 | #define CHARTPRESENTER_H | |
30 |
|
30 | |||
31 | #include <QtCharts/QChartGlobal> |
|
31 | #include <QtCharts/QChartGlobal> | |
32 | #include <QtCharts/QChart> //because of QChart::ChartThemeId |
|
32 | #include <QtCharts/QChart> //because of QChart::ChartThemeId | |
33 | #include <QtCore/QRectF> |
|
33 | #include <QtCore/QRectF> | |
34 | #include <QtCore/QMargins> |
|
34 | #include <QtCore/QMargins> | |
35 | #include <QtCore/QLocale> |
|
35 | #include <QtCore/QLocale> | |
36 |
|
36 | |||
37 | QT_CHARTS_BEGIN_NAMESPACE |
|
37 | QT_CHARTS_BEGIN_NAMESPACE | |
38 |
|
38 | |||
39 | class ChartItem; |
|
39 | class ChartItem; | |
40 | class AxisItem; |
|
40 | class AxisItem; | |
41 | class QAbstractSeries; |
|
41 | class QAbstractSeries; | |
42 | class ChartDataSet; |
|
42 | class ChartDataSet; | |
43 | class AbstractDomain; |
|
43 | class AbstractDomain; | |
44 | class ChartAxisElement; |
|
44 | class ChartAxisElement; | |
45 | class ChartAnimator; |
|
45 | class ChartAnimator; | |
46 | class ChartBackground; |
|
46 | class ChartBackground; | |
47 | class ChartTitle; |
|
47 | class ChartTitle; | |
48 | class ChartAnimation; |
|
48 | class ChartAnimation; | |
49 | class AbstractChartLayout; |
|
49 | class AbstractChartLayout; | |
50 |
|
50 | |||
51 | class ChartPresenter: public QObject |
|
51 | class ChartPresenter: public QObject | |
52 | { |
|
52 | { | |
53 | Q_OBJECT |
|
53 | Q_OBJECT | |
54 | public: |
|
54 | public: | |
55 | enum ZValues { |
|
55 | enum ZValues { | |
56 | BackgroundZValue = -1, |
|
56 | BackgroundZValue = -1, | |
57 | PlotAreaZValue, |
|
57 | PlotAreaZValue, | |
58 | ShadesZValue, |
|
58 | ShadesZValue, | |
59 | GridZValue, |
|
59 | GridZValue, | |
60 | AxisZValue, |
|
60 | AxisZValue, | |
61 | SeriesZValue, |
|
61 | SeriesZValue, | |
62 | LineChartZValue = SeriesZValue, |
|
62 | LineChartZValue = SeriesZValue, | |
63 | SplineChartZValue = SeriesZValue, |
|
63 | SplineChartZValue = SeriesZValue, | |
64 | BarSeriesZValue = SeriesZValue, |
|
64 | BarSeriesZValue = SeriesZValue, | |
65 | ScatterSeriesZValue = SeriesZValue, |
|
65 | ScatterSeriesZValue = SeriesZValue, | |
66 | PieSeriesZValue = SeriesZValue, |
|
66 | PieSeriesZValue = SeriesZValue, | |
67 | BoxPlotSeriesZValue = SeriesZValue, |
|
67 | BoxPlotSeriesZValue = SeriesZValue, | |
68 | LegendZValue, |
|
68 | LegendZValue, | |
69 | TopMostZValue |
|
69 | TopMostZValue | |
70 | }; |
|
70 | }; | |
71 |
|
71 | |||
72 | enum State { |
|
72 | enum State { | |
73 | ShowState, |
|
73 | ShowState, | |
74 | ScrollUpState, |
|
74 | ScrollUpState, | |
75 | ScrollDownState, |
|
75 | ScrollDownState, | |
76 | ScrollLeftState, |
|
76 | ScrollLeftState, | |
77 | ScrollRightState, |
|
77 | ScrollRightState, | |
78 | ZoomInState, |
|
78 | ZoomInState, | |
79 | ZoomOutState |
|
79 | ZoomOutState | |
80 | }; |
|
80 | }; | |
81 |
|
81 | |||
82 | ChartPresenter(QChart *chart, QChart::ChartType type); |
|
82 | ChartPresenter(QChart *chart, QChart::ChartType type); | |
83 | virtual ~ChartPresenter(); |
|
83 | virtual ~ChartPresenter(); | |
84 |
|
84 | |||
85 |
|
85 | |||
86 | void setGeometry(QRectF rect); |
|
86 | void setGeometry(QRectF rect); | |
87 | QRectF geometry() const; |
|
87 | QRectF geometry() const; | |
88 |
|
88 | |||
89 | QGraphicsItem *rootItem(){ return m_chart; } |
|
89 | QGraphicsItem *rootItem(){ return m_chart; } | |
90 | ChartBackground *backgroundElement(); |
|
90 | ChartBackground *backgroundElement(); | |
91 | QAbstractGraphicsShapeItem *plotAreaElement(); |
|
91 | QAbstractGraphicsShapeItem *plotAreaElement(); | |
92 | ChartTitle *titleElement(); |
|
92 | ChartTitle *titleElement(); | |
93 | QList<ChartAxisElement *> axisItems() const; |
|
93 | QList<ChartAxisElement *> axisItems() const; | |
94 | QList<ChartItem *> chartItems() const; |
|
94 | QList<ChartItem *> chartItems() const; | |
95 |
|
95 | |||
96 | QLegend *legend(); |
|
96 | QLegend *legend(); | |
97 |
|
97 | |||
98 | void setBackgroundBrush(const QBrush &brush); |
|
98 | void setBackgroundBrush(const QBrush &brush); | |
99 | QBrush backgroundBrush() const; |
|
99 | QBrush backgroundBrush() const; | |
100 |
|
100 | |||
101 | void setBackgroundPen(const QPen &pen); |
|
101 | void setBackgroundPen(const QPen &pen); | |
102 | QPen backgroundPen() const; |
|
102 | QPen backgroundPen() const; | |
103 |
|
103 | |||
104 | void setBackgroundRoundness(qreal diameter); |
|
104 | void setBackgroundRoundness(qreal diameter); | |
105 | qreal backgroundRoundness() const; |
|
105 | qreal backgroundRoundness() const; | |
106 |
|
106 | |||
107 | void setPlotAreaBackgroundBrush(const QBrush &brush); |
|
107 | void setPlotAreaBackgroundBrush(const QBrush &brush); | |
108 | QBrush plotAreaBackgroundBrush() const; |
|
108 | QBrush plotAreaBackgroundBrush() const; | |
109 |
|
109 | |||
110 | void setPlotAreaBackgroundPen(const QPen &pen); |
|
110 | void setPlotAreaBackgroundPen(const QPen &pen); | |
111 | QPen plotAreaBackgroundPen() const; |
|
111 | QPen plotAreaBackgroundPen() const; | |
112 |
|
112 | |||
113 | void setTitle(const QString &title); |
|
113 | void setTitle(const QString &title); | |
114 | QString title() const; |
|
114 | QString title() const; | |
115 |
|
115 | |||
116 | void setTitleFont(const QFont &font); |
|
116 | void setTitleFont(const QFont &font); | |
117 | QFont titleFont() const; |
|
117 | QFont titleFont() const; | |
118 |
|
118 | |||
119 | void setTitleBrush(const QBrush &brush); |
|
119 | void setTitleBrush(const QBrush &brush); | |
120 | QBrush titleBrush() const; |
|
120 | QBrush titleBrush() const; | |
121 |
|
121 | |||
122 | void setBackgroundVisible(bool visible); |
|
122 | void setBackgroundVisible(bool visible); | |
123 | bool isBackgroundVisible() const; |
|
123 | bool isBackgroundVisible() const; | |
124 |
|
124 | |||
125 | void setPlotAreaBackgroundVisible(bool visible); |
|
125 | void setPlotAreaBackgroundVisible(bool visible); | |
126 | bool isPlotAreaBackgroundVisible() const; |
|
126 | bool isPlotAreaBackgroundVisible() const; | |
127 |
|
127 | |||
128 | void setBackgroundDropShadowEnabled(bool enabled); |
|
128 | void setBackgroundDropShadowEnabled(bool enabled); | |
129 | bool isBackgroundDropShadowEnabled() const; |
|
129 | bool isBackgroundDropShadowEnabled() const; | |
130 |
|
130 | |||
131 | void setLocalizeNumbers(bool localize); |
|
131 | void setLocalizeNumbers(bool localize); | |
132 | inline bool localizeNumbers() const { return m_localizeNumbers; } |
|
132 | inline bool localizeNumbers() const { return m_localizeNumbers; } | |
133 | void setLocale(const QLocale &locale); |
|
133 | void setLocale(const QLocale &locale); | |
134 | inline const QLocale &locale() const { return m_locale; } |
|
134 | inline const QLocale &locale() const { return m_locale; } | |
135 |
|
135 | |||
136 | void setVisible(bool visible); |
|
136 | void setVisible(bool visible); | |
137 |
|
137 | |||
138 | void setAnimationOptions(QChart::AnimationOptions options); |
|
138 | void setAnimationOptions(QChart::AnimationOptions options); | |
139 | QChart::AnimationOptions animationOptions() const; |
|
139 | QChart::AnimationOptions animationOptions() const; | |
140 |
|
140 | |||
141 | void startAnimation(ChartAnimation *animation); |
|
141 | void startAnimation(ChartAnimation *animation); | |
142 |
|
142 | |||
143 | void setState(State state,QPointF point); |
|
143 | void setState(State state,QPointF point); | |
144 | State state() const { return m_state; } |
|
144 | State state() const { return m_state; } | |
145 | QPointF statePoint() const { return m_statePoint; } |
|
145 | QPointF statePoint() const { return m_statePoint; } | |
146 | AbstractChartLayout *layout(); |
|
146 | AbstractChartLayout *layout(); | |
147 |
|
147 | |||
148 | QChart::ChartType chartType() const { return m_chart->chartType(); } |
|
148 | QChart::ChartType chartType() const { return m_chart->chartType(); } | |
149 | QChart *chart() { return m_chart; } |
|
149 | QChart *chart() { return m_chart; } | |
150 |
|
150 | |||
151 | static QRectF textBoundingRect(const QFont &font, const QString &text, qreal angle = 0.0); |
|
151 | static QRectF textBoundingRect(const QFont &font, const QString &text, qreal angle = 0.0); | |
152 | static QString truncatedText(const QFont &font, const QString &text, qreal angle, |
|
152 | static QString truncatedText(const QFont &font, const QString &text, qreal angle, | |
153 | qreal maxWidth, qreal maxHeight, QRectF &boundingRect); |
|
153 | qreal maxWidth, qreal maxHeight, QRectF &boundingRect); | |
154 | inline static qreal textMargin() { return qreal(0.5); } |
|
154 | inline static qreal textMargin() { return qreal(0.5); } | |
155 |
|
155 | |||
156 | QString numberToString(double value, char f = 'g', int prec = 6); |
|
156 | QString numberToString(double value, char f = 'g', int prec = 6); | |
157 | QString numberToString(int value); |
|
157 | QString numberToString(int value); | |
158 |
|
158 | |||
159 | private: |
|
159 | private: | |
160 | void createBackgroundItem(); |
|
160 | void createBackgroundItem(); | |
161 | void createPlotAreaBackgroundItem(); |
|
161 | void createPlotAreaBackgroundItem(); | |
162 | void createTitleItem(); |
|
162 | void createTitleItem(); | |
163 |
|
163 | |||
164 | public Q_SLOTS: |
|
164 | public Q_SLOTS: | |
165 | void handleSeriesAdded(QAbstractSeries *series); |
|
165 | void handleSeriesAdded(QAbstractSeries *series); | |
166 | void handleSeriesRemoved(QAbstractSeries *series); |
|
166 | void handleSeriesRemoved(QAbstractSeries *series); | |
167 | void handleAxisAdded(QAbstractAxis *axis); |
|
167 | void handleAxisAdded(QAbstractAxis *axis); | |
168 | void handleAxisRemoved(QAbstractAxis *axis); |
|
168 | void handleAxisRemoved(QAbstractAxis *axis); | |
169 |
|
169 | |||
170 | signals: |
|
170 | Q_SIGNALS: | |
171 | void plotAreaChanged(const QRectF &plotArea); |
|
171 | void plotAreaChanged(const QRectF &plotArea); | |
172 |
|
172 | |||
173 | private: |
|
173 | private: | |
174 | QChart *m_chart; |
|
174 | QChart *m_chart; | |
175 | QList<ChartItem *> m_chartItems; |
|
175 | QList<ChartItem *> m_chartItems; | |
176 | QList<ChartAxisElement *> m_axisItems; |
|
176 | QList<ChartAxisElement *> m_axisItems; | |
177 | QList<QAbstractSeries *> m_series; |
|
177 | QList<QAbstractSeries *> m_series; | |
178 | QList<QAbstractAxis *> m_axes; |
|
178 | QList<QAbstractAxis *> m_axes; | |
179 | QChart::AnimationOptions m_options; |
|
179 | QChart::AnimationOptions m_options; | |
180 | State m_state; |
|
180 | State m_state; | |
181 | QPointF m_statePoint; |
|
181 | QPointF m_statePoint; | |
182 | AbstractChartLayout *m_layout; |
|
182 | AbstractChartLayout *m_layout; | |
183 | ChartBackground *m_background; |
|
183 | ChartBackground *m_background; | |
184 | QAbstractGraphicsShapeItem *m_plotAreaBackground; |
|
184 | QAbstractGraphicsShapeItem *m_plotAreaBackground; | |
185 | ChartTitle *m_title; |
|
185 | ChartTitle *m_title; | |
186 | QRectF m_rect; |
|
186 | QRectF m_rect; | |
187 | bool m_localizeNumbers; |
|
187 | bool m_localizeNumbers; | |
188 | QLocale m_locale; |
|
188 | QLocale m_locale; | |
189 | }; |
|
189 | }; | |
190 |
|
190 | |||
191 | QT_CHARTS_END_NAMESPACE |
|
191 | QT_CHARTS_END_NAMESPACE | |
192 |
|
192 | |||
193 | #endif /* CHARTPRESENTER_H */ |
|
193 | #endif /* CHARTPRESENTER_H */ |
@@ -1,26 +1,29 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | #ifndef CHARTSNAMESPACE_H |
|
19 | #ifndef CHARTSNAMESPACE_H | |
20 | #define CHARTSNAMESPACE_H |
|
20 | #define CHARTSNAMESPACE_H | |
21 |
|
21 | |||
22 | // this is needed by the designer plugin. |
|
22 | // this is needed by the designer plugin. | |
23 |
|
23 | |||
|
24 | #ifdef QT_CHARTS_USE_NAMESPACE | |||
24 | QT_CHARTS_USE_NAMESPACE |
|
25 | QT_CHARTS_USE_NAMESPACE | |
|
26 | #endif | |||
|
27 | ||||
25 |
|
28 | |||
26 | #endif /* CHARTSNAMESPACE_H */ |
|
29 | #endif /* CHARTSNAMESPACE_H */ |
@@ -1,94 +1,94 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | // W A R N I N G |
|
19 | // W A R N I N G | |
20 | // ------------- |
|
20 | // ------------- | |
21 | // |
|
21 | // | |
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an |
|
22 | // This file is not part of the Qt Enterprise Chart API. It exists purely as an | |
23 | // implementation detail. This header file may change from version to |
|
23 | // implementation detail. This header file may change from version to | |
24 | // version without notice, or even be removed. |
|
24 | // version without notice, or even be removed. | |
25 | // |
|
25 | // | |
26 | // We mean it. |
|
26 | // We mean it. | |
27 |
|
27 | |||
28 | #ifndef QPIESERIES_P_H |
|
28 | #ifndef QPIESERIES_P_H | |
29 | #define QPIESERIES_P_H |
|
29 | #define QPIESERIES_P_H | |
30 |
|
30 | |||
31 | #include <QtCharts/QPieSeries> |
|
31 | #include <QtCharts/QPieSeries> | |
32 | #include <private/qabstractseries_p.h> |
|
32 | #include <private/qabstractseries_p.h> | |
33 |
|
33 | |||
34 | QT_CHARTS_BEGIN_NAMESPACE |
|
34 | QT_CHARTS_BEGIN_NAMESPACE | |
35 | class QLegendPrivate; |
|
35 | class QLegendPrivate; | |
36 |
|
36 | |||
37 | class QPieSeriesPrivate : public QAbstractSeriesPrivate |
|
37 | class QPieSeriesPrivate : public QAbstractSeriesPrivate | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 |
|
40 | |||
41 | public: |
|
41 | public: | |
42 | QPieSeriesPrivate(QPieSeries *parent); |
|
42 | QPieSeriesPrivate(QPieSeries *parent); | |
43 | ~QPieSeriesPrivate(); |
|
43 | ~QPieSeriesPrivate(); | |
44 |
|
44 | |||
45 | void initializeDomain(); |
|
45 | void initializeDomain(); | |
46 | void initializeAxes(); |
|
46 | void initializeAxes(); | |
47 | void initializeGraphics(QGraphicsItem* parent); |
|
47 | void initializeGraphics(QGraphicsItem* parent); | |
48 | void initializeAnimations(QtCharts::QChart::AnimationOptions options); |
|
48 | void initializeAnimations(QtCharts::QChart::AnimationOptions options); | |
49 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); |
|
49 | void initializeTheme(int index, ChartTheme* theme, bool forced = false); | |
50 |
|
50 | |||
51 | QList<QLegendMarker *> createLegendMarkers(QLegend *legend); |
|
51 | QList<QLegendMarker *> createLegendMarkers(QLegend *legend); | |
52 |
|
52 | |||
53 | QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; |
|
53 | QAbstractAxis::AxisType defaultAxisType(Qt::Orientation orientation) const; | |
54 | QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const; |
|
54 | QAbstractAxis* createDefaultAxis(Qt::Orientation orientation) const; | |
55 |
|
55 | |||
56 | void updateDerivativeData(); |
|
56 | void updateDerivativeData(); | |
57 | void setSizes(qreal innerSize, qreal outerSize); |
|
57 | void setSizes(qreal innerSize, qreal outerSize); | |
58 |
|
58 | |||
59 | static QPieSeriesPrivate *fromSeries(QPieSeries *series); |
|
59 | static QPieSeriesPrivate *fromSeries(QPieSeries *series); | |
60 |
|
60 | |||
61 | signals: |
|
61 | Q_SIGNALS: | |
62 | void calculatedDataChanged(); |
|
62 | void calculatedDataChanged(); | |
63 | void pieSizeChanged(); |
|
63 | void pieSizeChanged(); | |
64 | void pieStartAngleChanged(); |
|
64 | void pieStartAngleChanged(); | |
65 | void pieEndAngleChanged(); |
|
65 | void pieEndAngleChanged(); | |
66 | void horizontalPositionChanged(); |
|
66 | void horizontalPositionChanged(); | |
67 | void verticalPositionChanged(); |
|
67 | void verticalPositionChanged(); | |
68 |
|
68 | |||
69 | public Q_SLOTS: |
|
69 | public Q_SLOTS: | |
70 | void sliceValueChanged(); |
|
70 | void sliceValueChanged(); | |
71 | void sliceClicked(); |
|
71 | void sliceClicked(); | |
72 | void sliceHovered(bool state); |
|
72 | void sliceHovered(bool state); | |
73 | void slicePressed(); |
|
73 | void slicePressed(); | |
74 | void sliceReleased(); |
|
74 | void sliceReleased(); | |
75 | void sliceDoubleClicked(); |
|
75 | void sliceDoubleClicked(); | |
76 |
|
76 | |||
77 | private: |
|
77 | private: | |
78 | QList<QPieSlice *> m_slices; |
|
78 | QList<QPieSlice *> m_slices; | |
79 | qreal m_pieRelativeHorPos; |
|
79 | qreal m_pieRelativeHorPos; | |
80 | qreal m_pieRelativeVerPos; |
|
80 | qreal m_pieRelativeVerPos; | |
81 | qreal m_pieRelativeSize; |
|
81 | qreal m_pieRelativeSize; | |
82 | qreal m_pieStartAngle; |
|
82 | qreal m_pieStartAngle; | |
83 | qreal m_pieEndAngle; |
|
83 | qreal m_pieEndAngle; | |
84 | qreal m_sum; |
|
84 | qreal m_sum; | |
85 | qreal m_holeRelativeSize; |
|
85 | qreal m_holeRelativeSize; | |
86 |
|
86 | |||
87 | public: |
|
87 | public: | |
88 | friend class QLegendPrivate; |
|
88 | friend class QLegendPrivate; | |
89 | Q_DECLARE_PUBLIC(QPieSeries) |
|
89 | Q_DECLARE_PUBLIC(QPieSeries) | |
90 | }; |
|
90 | }; | |
91 |
|
91 | |||
92 | QT_CHARTS_END_NAMESPACE |
|
92 | QT_CHARTS_END_NAMESPACE | |
93 |
|
93 | |||
94 | #endif // QPIESERIES_P_H |
|
94 | #endif // QPIESERIES_P_H |
@@ -1,185 +1,185 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | #ifndef QCHART_H |
|
19 | #ifndef QCHART_H | |
20 | #define QCHART_H |
|
20 | #define QCHART_H | |
21 |
|
21 | |||
22 | #include <QtCharts/QAbstractSeries> |
|
22 | #include <QtCharts/QAbstractSeries> | |
23 | #include <QtCharts/QLegend> |
|
23 | #include <QtCharts/QLegend> | |
24 | #include <QtWidgets/QGraphicsWidget> |
|
24 | #include <QtWidgets/QGraphicsWidget> | |
25 | #include <QtCore/QMargins> |
|
25 | #include <QtCore/QMargins> | |
26 |
|
26 | |||
27 | QT_BEGIN_NAMESPACE |
|
27 | QT_BEGIN_NAMESPACE | |
28 | class QGraphicsSceneResizeEvent; |
|
28 | class QGraphicsSceneResizeEvent; | |
29 | QT_END_NAMESPACE |
|
29 | QT_END_NAMESPACE | |
30 |
|
30 | |||
31 | QT_CHARTS_BEGIN_NAMESPACE |
|
31 | QT_CHARTS_BEGIN_NAMESPACE | |
32 |
|
32 | |||
33 | class QAbstractSeries; |
|
33 | class QAbstractSeries; | |
34 | class QAbstractAxis; |
|
34 | class QAbstractAxis; | |
35 | class QLegend; |
|
35 | class QLegend; | |
36 | class QChartPrivate; |
|
36 | class QChartPrivate; | |
37 | class QBoxPlotSeries; |
|
37 | class QBoxPlotSeries; | |
38 |
|
38 | |||
39 | class QT_CHARTS_EXPORT QChart : public QGraphicsWidget |
|
39 | class QT_CHARTS_EXPORT QChart : public QGraphicsWidget | |
40 | { |
|
40 | { | |
41 | Q_OBJECT |
|
41 | Q_OBJECT | |
42 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) |
|
42 | Q_PROPERTY(QChart::ChartTheme theme READ theme WRITE setTheme) | |
43 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
43 | Q_PROPERTY(QString title READ title WRITE setTitle) | |
44 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible) |
|
44 | Q_PROPERTY(bool backgroundVisible READ isBackgroundVisible WRITE setBackgroundVisible) | |
45 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) |
|
45 | Q_PROPERTY(bool dropShadowEnabled READ isDropShadowEnabled WRITE setDropShadowEnabled) | |
46 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness) |
|
46 | Q_PROPERTY(qreal backgroundRoundness READ backgroundRoundness WRITE setBackgroundRoundness) | |
47 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) |
|
47 | Q_PROPERTY(QChart::AnimationOptions animationOptions READ animationOptions WRITE setAnimationOptions) | |
48 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) |
|
48 | Q_PROPERTY(QMargins margins READ margins WRITE setMargins) | |
49 | Q_PROPERTY(QChart::ChartType chartType READ chartType) |
|
49 | Q_PROPERTY(QChart::ChartType chartType READ chartType) | |
50 | Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) |
|
50 | Q_PROPERTY(bool plotAreaBackgroundVisible READ isPlotAreaBackgroundVisible WRITE setPlotAreaBackgroundVisible) | |
51 | Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers) |
|
51 | Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers) | |
52 | Q_PROPERTY(QLocale locale READ locale WRITE setLocale) |
|
52 | Q_PROPERTY(QLocale locale READ locale WRITE setLocale) | |
53 | Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged) |
|
53 | Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged) | |
54 | Q_ENUMS(ChartTheme) |
|
54 | Q_ENUMS(ChartTheme) | |
55 | Q_ENUMS(AnimationOption) |
|
55 | Q_ENUMS(AnimationOption) | |
56 | Q_ENUMS(ChartType) |
|
56 | Q_ENUMS(ChartType) | |
57 |
|
57 | |||
58 | public: |
|
58 | public: | |
59 | enum ChartType { |
|
59 | enum ChartType { | |
60 | ChartTypeUndefined = 0, |
|
60 | ChartTypeUndefined = 0, | |
61 | ChartTypeCartesian, |
|
61 | ChartTypeCartesian, | |
62 | ChartTypePolar |
|
62 | ChartTypePolar | |
63 | }; |
|
63 | }; | |
64 |
|
64 | |||
65 | enum ChartTheme { |
|
65 | enum ChartTheme { | |
66 | ChartThemeLight = 0, |
|
66 | ChartThemeLight = 0, | |
67 | ChartThemeBlueCerulean, |
|
67 | ChartThemeBlueCerulean, | |
68 | ChartThemeDark, |
|
68 | ChartThemeDark, | |
69 | ChartThemeBrownSand, |
|
69 | ChartThemeBrownSand, | |
70 | ChartThemeBlueNcs, |
|
70 | ChartThemeBlueNcs, | |
71 | ChartThemeHighContrast, |
|
71 | ChartThemeHighContrast, | |
72 | ChartThemeBlueIcy, |
|
72 | ChartThemeBlueIcy, | |
73 | ChartThemeQt |
|
73 | ChartThemeQt | |
74 | }; |
|
74 | }; | |
75 |
|
75 | |||
76 | enum AnimationOption { |
|
76 | enum AnimationOption { | |
77 | NoAnimation = 0x0, |
|
77 | NoAnimation = 0x0, | |
78 | GridAxisAnimations = 0x1, |
|
78 | GridAxisAnimations = 0x1, | |
79 | SeriesAnimations = 0x2, |
|
79 | SeriesAnimations = 0x2, | |
80 | AllAnimations = 0x3 |
|
80 | AllAnimations = 0x3 | |
81 | }; |
|
81 | }; | |
82 |
|
82 | |||
83 | Q_DECLARE_FLAGS(AnimationOptions, AnimationOption) |
|
83 | Q_DECLARE_FLAGS(AnimationOptions, AnimationOption) | |
84 |
|
84 | |||
85 | public: |
|
85 | public: | |
86 | explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); |
|
86 | explicit QChart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); | |
87 | ~QChart(); |
|
87 | ~QChart(); | |
88 |
|
88 | |||
89 | void addSeries(QAbstractSeries *series); |
|
89 | void addSeries(QAbstractSeries *series); | |
90 | void removeSeries(QAbstractSeries *series); |
|
90 | void removeSeries(QAbstractSeries *series); | |
91 | void removeAllSeries(); |
|
91 | void removeAllSeries(); | |
92 | QList<QAbstractSeries *> series() const; |
|
92 | QList<QAbstractSeries *> series() const; | |
93 |
|
93 | |||
94 | // *** deprecated *** |
|
94 | // *** deprecated *** | |
95 | void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
95 | void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); | |
96 | void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
96 | void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); | |
97 | QAbstractAxis *axisX(QAbstractSeries *series = 0) const; |
|
97 | QAbstractAxis *axisX(QAbstractSeries *series = 0) const; | |
98 | QAbstractAxis *axisY(QAbstractSeries *series = 0) const; |
|
98 | QAbstractAxis *axisY(QAbstractSeries *series = 0) const; | |
99 | // ****************** |
|
99 | // ****************** | |
100 |
|
100 | |||
101 | void addAxis(QAbstractAxis *axis, Qt::Alignment alignment); |
|
101 | void addAxis(QAbstractAxis *axis, Qt::Alignment alignment); | |
102 | void removeAxis(QAbstractAxis *axis); |
|
102 | void removeAxis(QAbstractAxis *axis); | |
103 | QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const; |
|
103 | QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = 0) const; | |
104 |
|
104 | |||
105 | void createDefaultAxes(); |
|
105 | void createDefaultAxes(); | |
106 |
|
106 | |||
107 | void setTheme(QChart::ChartTheme theme); |
|
107 | void setTheme(QChart::ChartTheme theme); | |
108 | QChart::ChartTheme theme() const; |
|
108 | QChart::ChartTheme theme() const; | |
109 |
|
109 | |||
110 | void setTitle(const QString &title); |
|
110 | void setTitle(const QString &title); | |
111 | QString title() const; |
|
111 | QString title() const; | |
112 | void setTitleFont(const QFont &font); |
|
112 | void setTitleFont(const QFont &font); | |
113 | QFont titleFont() const; |
|
113 | QFont titleFont() const; | |
114 | void setTitleBrush(const QBrush &brush); |
|
114 | void setTitleBrush(const QBrush &brush); | |
115 | QBrush titleBrush() const; |
|
115 | QBrush titleBrush() const; | |
116 |
|
116 | |||
117 | void setBackgroundBrush(const QBrush &brush); |
|
117 | void setBackgroundBrush(const QBrush &brush); | |
118 | QBrush backgroundBrush() const; |
|
118 | QBrush backgroundBrush() const; | |
119 | void setBackgroundPen(const QPen &pen); |
|
119 | void setBackgroundPen(const QPen &pen); | |
120 | QPen backgroundPen() const; |
|
120 | QPen backgroundPen() const; | |
121 | void setBackgroundVisible(bool visible = true); |
|
121 | void setBackgroundVisible(bool visible = true); | |
122 | bool isBackgroundVisible() const; |
|
122 | bool isBackgroundVisible() const; | |
123 |
|
123 | |||
124 | void setDropShadowEnabled(bool enabled = true); |
|
124 | void setDropShadowEnabled(bool enabled = true); | |
125 | bool isDropShadowEnabled() const; |
|
125 | bool isDropShadowEnabled() const; | |
126 | void setBackgroundRoundness(qreal diameter); |
|
126 | void setBackgroundRoundness(qreal diameter); | |
127 | qreal backgroundRoundness() const; |
|
127 | qreal backgroundRoundness() const; | |
128 | void setAnimationOptions(AnimationOptions options); |
|
128 | void setAnimationOptions(AnimationOptions options); | |
129 | AnimationOptions animationOptions() const; |
|
129 | AnimationOptions animationOptions() const; | |
130 |
|
130 | |||
131 | void zoomIn(); |
|
131 | void zoomIn(); | |
132 | void zoomOut(); |
|
132 | void zoomOut(); | |
133 |
|
133 | |||
134 | void zoomIn(const QRectF &rect); |
|
134 | void zoomIn(const QRectF &rect); | |
135 | void zoom(qreal factor); |
|
135 | void zoom(qreal factor); | |
136 | void zoomReset(); |
|
136 | void zoomReset(); | |
137 | bool isZoomed(); |
|
137 | bool isZoomed(); | |
138 |
|
138 | |||
139 | void scroll(qreal dx, qreal dy); |
|
139 | void scroll(qreal dx, qreal dy); | |
140 |
|
140 | |||
141 | QLegend *legend() const; |
|
141 | QLegend *legend() const; | |
142 |
|
142 | |||
143 | void setMargins(const QMargins &margins); |
|
143 | void setMargins(const QMargins &margins); | |
144 | QMargins margins() const; |
|
144 | QMargins margins() const; | |
145 |
|
145 | |||
146 | QRectF plotArea() const; |
|
146 | QRectF plotArea() const; | |
147 | void setPlotAreaBackgroundBrush(const QBrush &brush); |
|
147 | void setPlotAreaBackgroundBrush(const QBrush &brush); | |
148 | QBrush plotAreaBackgroundBrush() const; |
|
148 | QBrush plotAreaBackgroundBrush() const; | |
149 | void setPlotAreaBackgroundPen(const QPen &pen); |
|
149 | void setPlotAreaBackgroundPen(const QPen &pen); | |
150 | QPen plotAreaBackgroundPen() const; |
|
150 | QPen plotAreaBackgroundPen() const; | |
151 | void setPlotAreaBackgroundVisible(bool visible = true); |
|
151 | void setPlotAreaBackgroundVisible(bool visible = true); | |
152 | bool isPlotAreaBackgroundVisible() const; |
|
152 | bool isPlotAreaBackgroundVisible() const; | |
153 | void setLocalizeNumbers(bool localize); |
|
153 | void setLocalizeNumbers(bool localize); | |
154 | bool localizeNumbers() const; |
|
154 | bool localizeNumbers() const; | |
155 | void setLocale(const QLocale &locale); |
|
155 | void setLocale(const QLocale &locale); | |
156 | QLocale locale() const; |
|
156 | QLocale locale() const; | |
157 |
|
157 | |||
158 | QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0); |
|
158 | QPointF mapToValue(const QPointF &position, QAbstractSeries *series = 0); | |
159 | QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0); |
|
159 | QPointF mapToPosition(const QPointF &value, QAbstractSeries *series = 0); | |
160 |
|
160 | |||
161 | ChartType chartType() const; |
|
161 | ChartType chartType() const; | |
162 |
|
162 | |||
163 | signals: |
|
163 | Q_SIGNALS: | |
164 | void plotAreaChanged(const QRectF &plotArea); |
|
164 | void plotAreaChanged(const QRectF &plotArea); | |
165 |
|
165 | |||
166 | protected: |
|
166 | protected: | |
167 | explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags); |
|
167 | explicit QChart(QChart::ChartType type, QGraphicsItem *parent, Qt::WindowFlags wFlags); | |
168 | QScopedPointer<QChartPrivate> d_ptr; |
|
168 | QScopedPointer<QChartPrivate> d_ptr; | |
169 | friend class QLegend; |
|
169 | friend class QLegend; | |
170 | friend class DeclarativeChart; |
|
170 | friend class DeclarativeChart; | |
171 | friend class ChartDataSet; |
|
171 | friend class ChartDataSet; | |
172 | friend class ChartPresenter; |
|
172 | friend class ChartPresenter; | |
173 | friend class ChartThemeManager; |
|
173 | friend class ChartThemeManager; | |
174 | friend class QAbstractSeries; |
|
174 | friend class QAbstractSeries; | |
175 | friend class QBoxPlotSeriesPrivate; |
|
175 | friend class QBoxPlotSeriesPrivate; | |
176 |
|
176 | |||
177 | private: |
|
177 | private: | |
178 | Q_DISABLE_COPY(QChart) |
|
178 | Q_DISABLE_COPY(QChart) | |
179 | }; |
|
179 | }; | |
180 |
|
180 | |||
181 | QT_CHARTS_END_NAMESPACE |
|
181 | QT_CHARTS_END_NAMESPACE | |
182 |
|
182 | |||
183 | Q_DECLARE_OPERATORS_FOR_FLAGS(QT_CHARTS_NAMESPACE::QChart::AnimationOptions) |
|
183 | Q_DECLARE_OPERATORS_FOR_FLAGS(QT_CHARTS_NAMESPACE::QChart::AnimationOptions) | |
184 |
|
184 | |||
185 | #endif // QCHART_H |
|
185 | #endif // QCHART_H |
@@ -1,70 +1,70 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2015 The Qt Company Ltd |
|
3 | ** Copyright (C) 2015 The Qt Company Ltd | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io |
|
5 | ** For any questions to The Qt Company, please use contact form at http://qt.io | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Charts module. |
|
7 | ** This file is part of the Qt Charts module. | |
8 | ** |
|
8 | ** | |
9 | ** Licensees holding valid commercial license for Qt may use this file in |
|
9 | ** Licensees holding valid commercial license for Qt may use this file in | |
10 | ** accordance with the Qt License Agreement provided with the Software |
|
10 | ** accordance with the Qt License Agreement provided with the Software | |
11 | ** or, alternatively, in accordance with the terms contained in a written |
|
11 | ** or, alternatively, in accordance with the terms contained in a written | |
12 | ** agreement between you and The Qt Company. |
|
12 | ** agreement between you and The Qt Company. | |
13 | ** |
|
13 | ** | |
14 | ** If you have questions regarding the use of this file, please use |
|
14 | ** If you have questions regarding the use of this file, please use | |
15 | ** contact form at http://qt.io |
|
15 | ** contact form at http://qt.io | |
16 | ** |
|
16 | ** | |
17 | ****************************************************************************/ |
|
17 | ****************************************************************************/ | |
18 |
|
18 | |||
19 | #ifndef DECLARATIVEAXES_H |
|
19 | #ifndef DECLARATIVEAXES_H | |
20 | #define DECLARATIVEAXES_H |
|
20 | #define DECLARATIVEAXES_H | |
21 |
|
21 | |||
22 | #include <QtCharts/QChartGlobal> |
|
22 | #include <QtCharts/QChartGlobal> | |
23 | #include <QtCore/QObject> |
|
23 | #include <QtCore/QObject> | |
24 |
|
24 | |||
25 | QT_CHARTS_BEGIN_NAMESPACE |
|
25 | QT_CHARTS_BEGIN_NAMESPACE | |
26 |
|
26 | |||
27 | class QAbstractAxis; |
|
27 | class QAbstractAxis; | |
28 |
|
28 | |||
29 | class DeclarativeAxes : public QObject |
|
29 | class DeclarativeAxes : public QObject | |
30 | { |
|
30 | { | |
31 | Q_OBJECT |
|
31 | Q_OBJECT | |
32 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) |
|
32 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged) | |
33 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) |
|
33 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged) | |
34 | Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) |
|
34 | Q_PROPERTY(QAbstractAxis *axisXTop READ axisXTop WRITE setAxisXTop NOTIFY axisXTopChanged) | |
35 | Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) |
|
35 | Q_PROPERTY(QAbstractAxis *axisYRight READ axisYRight WRITE setAxisYRight NOTIFY axisYRightChanged) | |
36 |
|
36 | |||
37 | public: |
|
37 | public: | |
38 | explicit DeclarativeAxes(QObject *parent = 0); |
|
38 | explicit DeclarativeAxes(QObject *parent = 0); | |
39 |
|
39 | |||
40 | QAbstractAxis *axisX() { return m_axisX; } |
|
40 | QAbstractAxis *axisX() { return m_axisX; } | |
41 | void setAxisX(QAbstractAxis *axis); |
|
41 | void setAxisX(QAbstractAxis *axis); | |
42 | QAbstractAxis *axisY() { return m_axisY; } |
|
42 | QAbstractAxis *axisY() { return m_axisY; } | |
43 | void setAxisY(QAbstractAxis *axis); |
|
43 | void setAxisY(QAbstractAxis *axis); | |
44 | QAbstractAxis *axisXTop() { return m_axisXTop; } |
|
44 | QAbstractAxis *axisXTop() { return m_axisXTop; } | |
45 | void setAxisXTop(QAbstractAxis *axis); |
|
45 | void setAxisXTop(QAbstractAxis *axis); | |
46 | QAbstractAxis *axisYRight() { return m_axisYRight; } |
|
46 | QAbstractAxis *axisYRight() { return m_axisYRight; } | |
47 | void setAxisYRight(QAbstractAxis *axis); |
|
47 | void setAxisYRight(QAbstractAxis *axis); | |
48 |
|
48 | |||
49 | public: |
|
49 | public: | |
50 | void emitAxisXChanged() { emit axisXChanged(m_axisX); } |
|
50 | void emitAxisXChanged() { emit axisXChanged(m_axisX); } | |
51 | void emitAxisYChanged() { emit axisYChanged(m_axisY); } |
|
51 | void emitAxisYChanged() { emit axisYChanged(m_axisY); } | |
52 | void emitAxisXTopChanged() { emit axisXTopChanged(m_axisXTop); } |
|
52 | void emitAxisXTopChanged() { emit axisXTopChanged(m_axisXTop); } | |
53 | void emitAxisYRightChanged() { emit axisYRightChanged(m_axisYRight); } |
|
53 | void emitAxisYRightChanged() { emit axisYRightChanged(m_axisYRight); } | |
54 |
|
54 | |||
55 | signals: |
|
55 | Q_SIGNALS: | |
56 | void axisXChanged(QAbstractAxis *axis); |
|
56 | void axisXChanged(QAbstractAxis *axis); | |
57 | void axisYChanged(QAbstractAxis *axis); |
|
57 | void axisYChanged(QAbstractAxis *axis); | |
58 | void axisXTopChanged(QAbstractAxis *axis); |
|
58 | void axisXTopChanged(QAbstractAxis *axis); | |
59 | void axisYRightChanged(QAbstractAxis *axis); |
|
59 | void axisYRightChanged(QAbstractAxis *axis); | |
60 |
|
60 | |||
61 | private: |
|
61 | private: | |
62 | QAbstractAxis *m_axisX; |
|
62 | QAbstractAxis *m_axisX; | |
63 | QAbstractAxis *m_axisY; |
|
63 | QAbstractAxis *m_axisY; | |
64 | QAbstractAxis *m_axisXTop; |
|
64 | QAbstractAxis *m_axisXTop; | |
65 | QAbstractAxis *m_axisYRight; |
|
65 | QAbstractAxis *m_axisYRight; | |
66 | }; |
|
66 | }; | |
67 |
|
67 | |||
68 | QT_CHARTS_END_NAMESPACE |
|
68 | QT_CHARTS_END_NAMESPACE | |
69 |
|
69 | |||
70 | #endif // DECLARATIVEAXES_H |
|
70 | #endif // DECLARATIVEAXES_H |
General Comments 0
You need to be logged in to leave comments.
Login now