@@ -1,170 +1,151 | |||||
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 "qareaseries.h" |
|
21 | #include "qareaseries.h" | |
22 | #include "qlineseries.h" |
|
22 | #include "qlineseries.h" | |
23 |
|
23 | |||
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
25 |
|
25 | |||
26 | /*! |
|
26 | /*! | |
27 | \class QAreaSeries |
|
27 | \class QAreaSeries | |
28 | \brief The QAreaSeries class is used for making area charts. |
|
28 | \brief The QAreaSeries class is used for making area charts. | |
29 |
|
29 | |||
30 | \mainclass |
|
30 | \mainclass | |
31 |
|
31 | |||
32 | An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line |
|
32 | An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line | |
33 | is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance, |
|
33 | is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance, | |
34 | which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line. |
|
34 | which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line. | |
35 | In that case QAreaSeries should be initiated with two QLineSerie instances. Please note terms "upper" and "lower" boundary can be misleading in cases |
|
35 | In that case QAreaSeries should be initiated with two QLineSerie instances. Please note terms "upper" and "lower" boundary can be misleading in cases | |
36 | where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled. |
|
36 | where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled. | |
37 |
|
37 | |||
38 | \image areachart.png |
|
38 | \image areachart.png | |
39 |
|
39 | |||
40 | Creating basic area chart is simple: |
|
40 | Creating basic area chart is simple: | |
41 | \code |
|
41 | \code | |
42 | QLineSeries* lineSeries = new QLineSeries(); |
|
42 | QLineSeries* lineSeries = new QLineSeries(); | |
43 | series->append(0, 6); |
|
43 | series->append(0, 6); | |
44 | series->append(2, 4); |
|
44 | series->append(2, 4); | |
45 | QAreaSeries* areaSeries = new QAreaSeries(lineSeries); |
|
45 | QAreaSeries* areaSeries = new QAreaSeries(lineSeries); | |
46 | ... |
|
46 | ... | |
47 | chartView->addSeries(areaSeries); |
|
47 | chartView->addSeries(areaSeries); | |
48 | \endcode |
|
48 | \endcode | |
49 | */ |
|
49 | */ | |
50 |
|
50 | |||
51 | /*! |
|
51 | /*! | |
52 | \fn virtual QSeriesType QAreaSeries::type() const |
|
52 | \fn virtual QSeriesType QAreaSeries::type() const | |
53 | \brief Returns type of series. |
|
53 | \brief Returns type of series. | |
54 | \sa QSeries, QSeriesType |
|
54 | \sa QSeries, QSeriesType | |
55 | */ |
|
55 | */ | |
56 |
|
56 | |||
57 | /*! |
|
57 | /*! | |
58 | \fn QLineSeries* QAreaSeries::upperSeries() const |
|
58 | \fn QLineSeries* QAreaSeries::upperSeries() const | |
59 | \brief Returns upperSeries used to define one of area boundaries. |
|
59 | \brief Returns upperSeries used to define one of area boundaries. | |
60 | */ |
|
60 | */ | |
61 |
|
61 | |||
62 | /*! |
|
62 | /*! | |
63 | \fn QLineSeries* QAreaSeries::lowerSeries() const |
|
63 | \fn QLineSeries* QAreaSeries::lowerSeries() const | |
64 | \brief Returns lowerSeries used to define one of area boundaries. Note if QAreaSeries where counstucted wihtout a\ lowerSeries |
|
64 | \brief Returns lowerSeries used to define one of area boundaries. Note if QAreaSeries where counstucted wihtout a\ lowerSeries | |
65 | this function return Null pointer. |
|
65 | this function return Null pointer. | |
66 | */ |
|
66 | */ | |
67 |
|
67 | |||
68 | /*! |
|
68 | /*! | |
69 | \fn QPen QAreaSeries::pen() const |
|
69 | \fn QPen QAreaSeries::pen() const | |
70 | \brief Returns the pen used to draw line for this series. |
|
70 | \brief Returns the pen used to draw line for this series. | |
71 | \sa setPen() |
|
71 | \sa setPen() | |
72 | */ |
|
72 | */ | |
73 |
|
73 | |||
74 | /*! |
|
74 | /*! | |
75 | \fn QPen QAreaSeries::brush() const |
|
75 | \fn QPen QAreaSeries::brush() const | |
76 | \brief Returns the brush used to draw line for this series. |
|
76 | \brief Returns the brush used to draw line for this series. | |
77 | \sa setBrush() |
|
77 | \sa setBrush() | |
78 | */ |
|
78 | */ | |
79 |
|
79 | |||
80 | /*! |
|
80 | /*! | |
81 | \fn bool QAreaSeries::pointsVisible() const |
|
81 | \fn bool QAreaSeries::pointsVisible() const | |
82 | \brief Returns if the points are drawn for this series. |
|
82 | \brief Returns if the points are drawn for this series. | |
83 | \sa setPointsVisible() |
|
83 | \sa setPointsVisible() | |
84 | */ |
|
84 | */ | |
85 |
|
85 | |||
86 | /*! |
|
86 | /*! | |
87 | \fn void QAreaSeries::clicked(const QPointF& point) |
|
87 | \fn void QAreaSeries::clicked(const QPointF& point) | |
88 | \brief Signal is emitted when user clicks the \a point on area chart. |
|
88 | \brief Signal is emitted when user clicks the \a point on area chart. | |
89 | */ |
|
89 | */ | |
90 |
|
90 | |||
91 | /*! |
|
91 | /*! | |
92 | \fn void QAreaSeries::updated() |
|
92 | \fn void QAreaSeries::updated() | |
93 | \brief \internal |
|
93 | \brief \internal | |
94 | */ |
|
94 | */ | |
95 |
|
95 | |||
96 | /*! |
|
96 | /*! | |
97 | Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a |
|
97 | Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a | |
98 | upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. |
|
98 | upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. | |
99 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
99 | When series object is added to QChartView or QChart instance ownerships is transfered. | |
100 | */ |
|
100 | */ | |
101 | QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries) |
|
101 | QAreaSeries::QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries) | |
102 | : QSeries(upperSeries), |
|
102 | : QSeries(upperSeries), | |
103 | m_upperSeries(upperSeries), |
|
103 | m_upperSeries(upperSeries), | |
104 | m_lowerSeries(lowerSeries), |
|
104 | m_lowerSeries(lowerSeries), | |
105 | m_pointsVisible(false) |
|
105 | m_pointsVisible(false) | |
106 | { |
|
106 | { | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | /*! |
|
109 | /*! | |
110 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
110 | Destroys the object. Series added to QChartView or QChart instances are owned by those, | |
111 | and are deleted when mentioned object are destroyed. |
|
111 | and are deleted when mentioned object are destroyed. | |
112 | */ |
|
112 | */ | |
113 | QAreaSeries::~QAreaSeries() |
|
113 | QAreaSeries::~QAreaSeries() | |
114 | { |
|
114 | { | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | /*! |
|
117 | /*! | |
118 | Sets \a pen used for drawing area outline. |
|
118 | Sets \a pen used for drawing area outline. | |
119 | */ |
|
119 | */ | |
120 | void QAreaSeries::setPen(const QPen &pen) |
|
120 | void QAreaSeries::setPen(const QPen &pen) | |
121 | { |
|
121 | { | |
122 | if (m_pen != pen) { |
|
122 | if (m_pen != pen) { | |
123 | m_pen = pen; |
|
123 | m_pen = pen; | |
124 | emit updated(); |
|
124 | emit updated(); | |
125 | } |
|
125 | } | |
126 | } |
|
126 | } | |
127 |
|
127 | |||
128 | /*! |
|
128 | /*! | |
129 | Sets \a brush used for filling the area. |
|
129 | Sets \a brush used for filling the area. | |
130 | */ |
|
130 | */ | |
131 | void QAreaSeries::setBrush(const QBrush &brush) |
|
131 | void QAreaSeries::setBrush(const QBrush &brush) | |
132 | { |
|
132 | { | |
133 | if (m_brush != brush) { |
|
133 | if (m_brush != brush) { | |
134 | m_brush = brush; |
|
134 | m_brush = brush; | |
135 | emit updated(); |
|
135 | emit updated(); | |
136 | } |
|
136 | } | |
137 | } |
|
137 | } | |
138 | /*! |
|
138 | /*! | |
139 | Sets if data points are \a visible and should be drawn on line. |
|
139 | Sets if data points are \a visible and should be drawn on line. | |
140 | */ |
|
140 | */ | |
141 | void QAreaSeries::setPointsVisible(bool visible) |
|
141 | void QAreaSeries::setPointsVisible(bool visible) | |
142 | { |
|
142 | { | |
143 | if (m_pointsVisible != visible) { |
|
143 | if (m_pointsVisible != visible) { | |
144 | m_pointsVisible = visible; |
|
144 | m_pointsVisible = visible; | |
145 | emit updated(); |
|
145 | emit updated(); | |
146 | } |
|
146 | } | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 | //bool QAreaSeries::setModel(QAbstractItemModel* model) |
|
|||
150 | //{ |
|
|||
151 | // m_upperSeries->setModel(model); |
|
|||
152 | // if (m_lowerSeries) |
|
|||
153 | // m_lowerSeries->setModel(model); |
|
|||
154 | // return true; |
|
|||
155 | //} |
|
|||
156 |
|
||||
157 | //void QAreaSeries::setModelMappingUpper(int modelX, int modelY, Qt::Orientation orientation) |
|
|||
158 | //{ |
|
|||
159 | // m_upperSeries->setModelMapping(modelX, modelY, orientation); |
|
|||
160 | //} |
|
|||
161 |
|
||||
162 | //void QAreaSeries::setModelMappingLower(int modelX, int modelY, Qt::Orientation orientation) |
|
|||
163 | //{ |
|
|||
164 | // if (m_lowerSeries) |
|
|||
165 | // m_lowerSeries->setModelMapping(modelX, modelY, orientation); |
|
|||
166 | //} |
|
|||
167 |
|
||||
168 | #include "moc_qareaseries.cpp" |
|
149 | #include "moc_qareaseries.cpp" | |
169 |
|
150 | |||
170 | QTCOMMERCIALCHART_END_NAMESPACE |
|
151 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,73 +1,69 | |||||
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 | #ifndef QAREASERIES_H_ |
|
21 | #ifndef QAREASERIES_H_ | |
22 | #define QAREASERIES_H_ |
|
22 | #define QAREASERIES_H_ | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qseries.h> |
|
25 | #include <qseries.h> | |
26 | #include <QPen> |
|
26 | #include <QPen> | |
27 | #include <QBrush> |
|
27 | #include <QBrush> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 | class QLineSeries; |
|
30 | class QLineSeries; | |
31 |
|
31 | |||
32 | class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QSeries |
|
32 | class QTCOMMERCIALCHART_EXPORT QAreaSeries : public QSeries | |
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | public: |
|
35 | public: | |
36 | QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0); |
|
36 | QAreaSeries(QLineSeries *upperSeries, QLineSeries *lowerSeries = 0); | |
37 | virtual ~QAreaSeries(); |
|
37 | virtual ~QAreaSeries(); | |
38 |
|
38 | |||
39 | public: // from QChartSeries |
|
39 | public: // from QChartSeries | |
40 | virtual QSeriesType type() const { return QSeries::SeriesTypeArea; } |
|
40 | virtual QSeriesType type() const { return QSeries::SeriesTypeArea; } | |
41 |
|
41 | |||
42 | QLineSeries* upperSeries() const { return m_upperSeries; } |
|
42 | QLineSeries* upperSeries() const { return m_upperSeries; } | |
43 | QLineSeries* lowerSeries() const { return m_lowerSeries; } |
|
43 | QLineSeries* lowerSeries() const { return m_lowerSeries; } | |
44 |
|
44 | |||
45 | void setPen(const QPen &pen); |
|
45 | void setPen(const QPen &pen); | |
46 | QPen pen() const { return m_pen;} |
|
46 | QPen pen() const { return m_pen;} | |
47 |
|
47 | |||
48 | void setBrush(const QBrush &brush); |
|
48 | void setBrush(const QBrush &brush); | |
49 | QBrush brush() const { return m_brush;} |
|
49 | QBrush brush() const { return m_brush;} | |
50 |
|
50 | |||
51 | void setPointsVisible(bool visible); |
|
51 | void setPointsVisible(bool visible); | |
52 | bool pointsVisible() const { return m_pointsVisible; } |
|
52 | bool pointsVisible() const { return m_pointsVisible; } | |
53 |
|
53 | |||
54 | // bool setModel(QAbstractItemModel* model); |
|
|||
55 | // void setModelMappingUpper(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); |
|
|||
56 | // void setModelMappingLower(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); |
|
|||
57 |
|
||||
58 | Q_SIGNALS: |
|
54 | Q_SIGNALS: | |
59 | void updated(); |
|
55 | void updated(); | |
60 | void clicked(const QPointF &point); |
|
56 | void clicked(const QPointF &point); | |
61 | void selected(); |
|
57 | void selected(); | |
62 |
|
58 | |||
63 | private: |
|
59 | private: | |
64 | QBrush m_brush; |
|
60 | QBrush m_brush; | |
65 | QPen m_pen; |
|
61 | QPen m_pen; | |
66 | QLineSeries* m_upperSeries; |
|
62 | QLineSeries* m_upperSeries; | |
67 | QLineSeries* m_lowerSeries; |
|
63 | QLineSeries* m_lowerSeries; | |
68 | bool m_pointsVisible; |
|
64 | bool m_pointsVisible; | |
69 | }; |
|
65 | }; | |
70 |
|
66 | |||
71 | QTCOMMERCIALCHART_END_NAMESPACE |
|
67 | QTCOMMERCIALCHART_END_NAMESPACE | |
72 |
|
68 | |||
73 | #endif |
|
69 | #endif |
@@ -1,67 +1,60 | |||||
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 | #ifndef QSPLINESERIES_H |
|
21 | #ifndef QSPLINESERIES_H | |
22 | #define QSPLINESERIES_H |
|
22 | #define QSPLINESERIES_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qlineseries.h> |
|
25 | #include <qlineseries.h> | |
26 | #include <QList> |
|
26 | #include <QList> | |
27 | #include <QPointF> |
|
27 | #include <QPointF> | |
28 | #include <QtGlobal> |
|
28 | #include <QtGlobal> | |
29 |
|
29 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QLineSeries |
|
32 | class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QLineSeries | |
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | public: |
|
35 | public: | |
36 |
|
36 | |||
37 | QSplineSeries(QObject *parent = 0); |
|
37 | QSplineSeries(QObject *parent = 0); | |
38 | QSeriesType type() const {return QSeries::SeriesTypeSpline;} |
|
38 | QSeriesType type() const {return QSeries::SeriesTypeSpline;} | |
39 |
|
39 | |||
40 | // int count() const { return m_x.size(); } |
|
|||
41 | QPointF controlPoint(int index) const {return m_controlPoints[index];} |
|
40 | QPointF controlPoint(int index) const {return m_controlPoints[index];} | |
42 | bool setModel(QAbstractItemModel *model); |
|
41 | bool setModel(QAbstractItemModel *model); | |
43 |
|
42 | |||
44 | void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); |
|
43 | void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); | |
45 | void setModelMappingShift(int first, int count); |
|
44 | void setModelMappingShift(int first, int count); | |
46 |
|
45 | |||
47 | // TODO: allow the user to set custom control points |
|
|||
48 | // void setCustomControlPoints(QList<QPointsF> controlPoints); |
|
|||
49 | // bool calculateControlPointsAutomatically(); |
|
|||
50 | // void setCalculateControlPointsAutomatically(); |
|
|||
51 |
|
||||
52 |
|
||||
53 | private: |
|
46 | private: | |
54 | void calculateControlPoints(); |
|
47 | void calculateControlPoints(); | |
55 | QList<qreal> getFirstControlPoints(QList<qreal> rhs); |
|
48 | QList<qreal> getFirstControlPoints(QList<qreal> rhs); | |
56 |
|
49 | |||
57 | private Q_SLOTS: |
|
50 | private Q_SLOTS: | |
58 | void updateControlPoints(); |
|
51 | void updateControlPoints(); | |
59 |
|
52 | |||
60 | private: |
|
53 | private: | |
61 | QList<QPointF> m_controlPoints; |
|
54 | QList<QPointF> m_controlPoints; | |
62 |
|
55 | |||
63 | }; |
|
56 | }; | |
64 |
|
57 | |||
65 | QTCOMMERCIALCHART_END_NAMESPACE |
|
58 | QTCOMMERCIALCHART_END_NAMESPACE | |
66 |
|
59 | |||
67 | #endif // QSPLINESERIES_H |
|
60 | #endif // QSPLINESERIES_H |
@@ -1,102 +1,102 | |||||
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 | #ifndef QXYSERIES_H_ |
|
21 | #ifndef QXYSERIES_H_ | |
22 | #define QXYSERIES_H_ |
|
22 | #define QXYSERIES_H_ | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qseries.h> |
|
25 | #include <qseries.h> | |
26 | #include <QPen> |
|
26 | #include <QPen> | |
27 | #include <QBrush> |
|
27 | #include <QBrush> | |
28 |
|
28 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries |
|
31 | class QTCOMMERCIALCHART_EXPORT QXYSeries : public QSeries | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | protected: |
|
34 | protected: | |
35 | QXYSeries(QObject *parent = 0); |
|
35 | QXYSeries(QObject *parent = 0); | |
36 | virtual ~QXYSeries(); |
|
36 | virtual ~QXYSeries(); | |
37 |
|
37 | |||
38 | public: |
|
38 | public: | |
39 | void append(qreal x, qreal y); |
|
39 | void append(qreal x, qreal y); | |
40 | void append(const QPointF &point); |
|
40 | void append(const QPointF &point); | |
41 | void append(const QList<QPointF> points); |
|
41 | void append(const QList<QPointF> points); | |
42 | void replace(qreal x,qreal y); |
|
42 | void replace(qreal x,qreal y); | |
43 | void replace(const QPointF &point); |
|
43 | void replace(const QPointF &point); | |
44 | void remove(qreal x); |
|
44 | void remove(qreal x); | |
45 | void remove(qreal x, qreal y); |
|
45 | void remove(qreal x, qreal y); | |
46 | void remove(const QPointF &point); |
|
46 | void remove(const QPointF &point); | |
47 | void removeAll(); |
|
47 | void removeAll(); | |
48 |
|
48 | |||
49 | int count() const; |
|
49 | int count() const; | |
50 | qreal x(int pos) const; |
|
50 | qreal x(int pos) const; | |
51 | qreal y(int pos) const; |
|
51 | qreal y(int pos) const; | |
52 | QList<QPointF> data(); |
|
52 | QList<QPointF> data(); | |
53 |
|
53 | |||
54 | QXYSeries& operator << (const QPointF &point); |
|
54 | QXYSeries& operator << (const QPointF &point); | |
55 | QXYSeries& operator << (const QList<QPointF> points); |
|
55 | QXYSeries& operator << (const QList<QPointF> points); | |
56 |
|
56 | |||
57 | void setPen(const QPen &pen); |
|
57 | void setPen(const QPen &pen); | |
58 | QPen pen() const {return m_pen;} |
|
58 | QPen pen() const {return m_pen;} | |
59 | void setBrush(const QBrush &brush); |
|
59 | void setBrush(const QBrush &brush); | |
60 | QBrush brush() const {return m_brush;} |
|
60 | QBrush brush() const {return m_brush;} | |
61 |
|
61 | |||
62 | bool setModel(QAbstractItemModel *model); |
|
62 | bool setModel(QAbstractItemModel *model); | |
63 | QAbstractItemModel* model() const { return m_model; } |
|
63 | QAbstractItemModel* model() const { return m_model; } | |
64 |
|
64 | |||
65 | virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); |
|
65 | virtual void setModelMapping(int modelX, int modelY, Qt::Orientation orientation = Qt::Vertical); | |
66 |
virtual void setModelMapping |
|
66 | virtual void setModelMappingRange(int first, int count = 0); | |
67 | int mapFirst() const { return m_mapFirst; } |
|
67 | int mapFirst() const { return m_mapFirst; } | |
68 |
|
68 | |||
69 | private Q_SLOTS: |
|
69 | private Q_SLOTS: | |
70 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); |
|
70 | void modelUpdated(QModelIndex topLeft, QModelIndex bottomRight); | |
71 | void modelDataAboutToBeAdded(QModelIndex parent, int start, int end); |
|
71 | void modelDataAboutToBeAdded(QModelIndex parent, int start, int end); | |
72 | void modelDataAdded(QModelIndex parent, int start, int end); |
|
72 | void modelDataAdded(QModelIndex parent, int start, int end); | |
73 | void modelDataAboutToBeRemoved(QModelIndex parent, int start, int end); |
|
73 | void modelDataAboutToBeRemoved(QModelIndex parent, int start, int end); | |
74 | void modelDataRemoved(QModelIndex parent, int start, int end); |
|
74 | void modelDataRemoved(QModelIndex parent, int start, int end); | |
75 |
|
75 | |||
76 | Q_SIGNALS: |
|
76 | Q_SIGNALS: | |
77 | void clicked(const QPointF &point); |
|
77 | void clicked(const QPointF &point); | |
78 | void selected(); |
|
78 | void selected(); | |
79 | void updated(); |
|
79 | void updated(); | |
80 | void pointReplaced(int index); |
|
80 | void pointReplaced(int index); | |
81 | void pointRemoved(int index); |
|
81 | void pointRemoved(int index); | |
82 | void pointAdded(int index); |
|
82 | void pointAdded(int index); | |
83 |
|
83 | |||
84 | protected: |
|
84 | protected: | |
85 | QVector<qreal> m_x; |
|
85 | QVector<qreal> m_x; | |
86 | QVector<qreal> m_y; |
|
86 | QVector<qreal> m_y; | |
87 |
|
87 | |||
88 | QPen m_pen; |
|
88 | QPen m_pen; | |
89 | QBrush m_brush; |
|
89 | QBrush m_brush; | |
90 |
|
90 | |||
91 | int m_mapX; |
|
91 | int m_mapX; | |
92 | int m_mapY; |
|
92 | int m_mapY; | |
93 | int m_mapFirst; |
|
93 | int m_mapFirst; | |
94 | int m_mapCount; |
|
94 | int m_mapCount; | |
95 | bool m_mapLimited; |
|
95 | bool m_mapLimited; | |
96 | Qt::Orientation m_mapOrientation; |
|
96 | Qt::Orientation m_mapOrientation; | |
97 | int tempItemsRemoved; |
|
97 | int tempItemsRemoved; | |
98 | }; |
|
98 | }; | |
99 |
|
99 | |||
100 | QTCOMMERCIALCHART_END_NAMESPACE |
|
100 | QTCOMMERCIALCHART_END_NAMESPACE | |
101 |
|
101 | |||
102 | #endif |
|
102 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now