@@ -66,8 +66,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
66 | 66 | Constructs empty series object which is a child of \a parent. |
|
67 | 67 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
68 | 68 | */ |
|
69 |
QLineSeries::QLineSeries(QObject* parent):QXYSeries(parent) |
|
|
70 | m_pointsVisible(false) | |
|
69 | QLineSeries::QLineSeries(QObject* parent):QXYSeries(parent) | |
|
71 | 70 | { |
|
72 | 71 | } |
|
73 | 72 | /*! |
@@ -78,28 +77,6 QLineSeries::~QLineSeries() | |||
|
78 | 77 | { |
|
79 | 78 | } |
|
80 | 79 | |
|
81 | /*! | |
|
82 | Sets \a pen used for drawing given series.. | |
|
83 | */ | |
|
84 | void QLineSeries::setPen(const QPen& pen) | |
|
85 | { | |
|
86 | if(pen!=m_pen){ | |
|
87 | m_pen=pen; | |
|
88 | emit updated(); | |
|
89 | } | |
|
90 | } | |
|
91 | ||
|
92 | /*! | |
|
93 | Sets if data points are \a visible and should be drawn on line. | |
|
94 | */ | |
|
95 | void QLineSeries::setPointsVisible(bool visible) | |
|
96 | { | |
|
97 | if(m_pointsVisible!=visible){ | |
|
98 | m_pointsVisible=visible; | |
|
99 | emit updated(); | |
|
100 | } | |
|
101 | } | |
|
102 | ||
|
103 | 80 | QDebug operator<< (QDebug debug, const QLineSeries series) |
|
104 | 81 | { |
|
105 | 82 | Q_ASSERT(series.m_x.size() == series.m_y.size()); |
@@ -18,16 +18,8 public: | |||
|
18 | 18 | |
|
19 | 19 | public: // from QChartSeries |
|
20 | 20 | virtual QSeriesType type() const {return QSeries::SeriesTypeLine;} |
|
21 | void setPen(const QPen& pen); | |
|
22 | QPen pen() const {return m_pen;} | |
|
23 | ||
|
24 | void setPointsVisible(bool visible); | |
|
25 | bool pointsVisible() const {return m_pointsVisible;} | |
|
26 | ||
|
27 | 21 | friend QDebug operator<< (QDebug d, const QLineSeries series); |
|
28 | private: | |
|
29 | QPen m_pen; | |
|
30 | bool m_pointsVisible; | |
|
22 | ||
|
31 | 23 | }; |
|
32 | 24 | |
|
33 | 25 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -26,7 +26,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
26 | 26 | */ |
|
27 | 27 | |
|
28 | 28 | QSplineSeries::QSplineSeries(QObject *parent) : |
|
29 |
Q |
|
|
29 | QXYSeries(parent) | |
|
30 | 30 | { |
|
31 | 31 | connect(this,SIGNAL(pointAdded(int)), this, SLOT(updateControlPoints())); |
|
32 | 32 | connect(this,SIGNAL(pointRemoved(int)), this, SLOT(updateControlPoints())); |
@@ -3,13 +3,13 | |||
|
3 | 3 | |
|
4 | 4 | #include "qchartglobal.h" |
|
5 | 5 | #include <QtGlobal> |
|
6 |
#include "q |
|
|
6 | #include "qxyseries.h" | |
|
7 | 7 | #include <QList> |
|
8 | 8 | #include <QPointF> |
|
9 | 9 | |
|
10 | 10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | 11 | |
|
12 |
class QSplineSeries : public Q |
|
|
12 | class QTCOMMERCIALCHART_EXPORT QSplineSeries : public QXYSeries | |
|
13 | 13 | { |
|
14 | 14 | Q_OBJECT |
|
15 | 15 |
|
@@ -25,6 +25,7 class QSplineSeries : public QLineSeries | |||
|
25 | 25 | // bool calculateControlPointsAutomatically(); |
|
26 | 26 | // void setCalculateControlPointsAutomatically(); |
|
27 | 27 | |
|
28 | ||
|
28 | 29 |
|
|
29 | 30 | void calculateControlPoints(); |
|
30 | 31 | QList<qreal> getFirstControlPoints(QList<qreal> rhs); |
@@ -66,7 +66,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
66 | 66 | Constructs empty series object which is a child of \a parent. |
|
67 | 67 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
68 | 68 | */ |
|
69 | QXYSeries::QXYSeries(QObject* parent):QSeries(parent) | |
|
69 | QXYSeries::QXYSeries(QObject* parent):QSeries(parent), | |
|
70 | m_pointsVisible(false) | |
|
70 | 71 | { |
|
71 | 72 | } |
|
72 | 73 | /*! |
@@ -173,6 +174,29 int QXYSeries::count() const | |||
|
173 | 174 | } |
|
174 | 175 | |
|
175 | 176 | /*! |
|
177 | Sets \a pen used for drawing given series.. | |
|
178 | */ | |
|
179 | void QXYSeries::setPen(const QPen& pen) | |
|
180 | { | |
|
181 | if(pen!=m_pen){ | |
|
182 | m_pen=pen; | |
|
183 | emit updated(); | |
|
184 | } | |
|
185 | } | |
|
186 | ||
|
187 | /*! | |
|
188 | Sets if data points are \a visible and should be drawn on line. | |
|
189 | */ | |
|
190 | void QXYSeries::setPointsVisible(bool visible) | |
|
191 | { | |
|
192 | if(m_pointsVisible!=visible){ | |
|
193 | m_pointsVisible=visible; | |
|
194 | emit updated(); | |
|
195 | } | |
|
196 | } | |
|
197 | ||
|
198 | ||
|
199 | /*! | |
|
176 | 200 | Stream operator for adding a data \a point to the series. |
|
177 | 201 | \sa add() |
|
178 | 202 | */ |
@@ -31,6 +31,12 public: | |||
|
31 | 31 | |
|
32 | 32 | QXYSeries& operator << (const QPointF &point); |
|
33 | 33 | |
|
34 | void setPen(const QPen& pen); | |
|
35 | QPen pen() const {return m_pen;} | |
|
36 | ||
|
37 | void setPointsVisible(bool visible); | |
|
38 | bool pointsVisible() const {return m_pointsVisible;} | |
|
39 | ||
|
34 | 40 | signals: |
|
35 | 41 | void updated(); |
|
36 | 42 | void pointReplaced(int index); |
@@ -42,6 +48,9 protected: | |||
|
42 | 48 | QVector<qreal> m_x; |
|
43 | 49 | QVector<qreal> m_y; |
|
44 | 50 | |
|
51 | QPen m_pen; | |
|
52 | bool m_pointsVisible; | |
|
53 | ||
|
45 | 54 | }; |
|
46 | 55 | |
|
47 | 56 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now