@@ -15,6 +15,7 m_dirtyData(false), | |||
|
15 | 15 | m_dirtyGeometry(false), |
|
16 | 16 | m_dirtyDomain(false) |
|
17 | 17 | { |
|
18 | ||
|
18 | 19 | } |
|
19 | 20 | |
|
20 | 21 | QRectF LineChartItem::boundingRect() const |
@@ -35,7 +36,7 void LineChartItem::addPoints(const QVector<QPointF>& points) | |||
|
35 | 36 | const QPointF& point =m_data[i]; |
|
36 | 37 | QGraphicsRectItem* item = new QGraphicsRectItem(0,0,3,3,this); |
|
37 | 38 | item->setPos(point.x()-1,point.y()-1);; |
|
38 | if(!m_clipRect.contains(point)) item->setVisible(false); | |
|
39 | if(!m_clipRect.contains(point) || !m_series->isPointsVisible()) item->setVisible(false); | |
|
39 | 40 | m_points << item; |
|
40 | 41 | } |
|
41 | 42 | } |
@@ -46,7 +47,7 void LineChartItem::addPoint(const QPointF& point) | |||
|
46 | 47 | QGraphicsRectItem* item = new QGraphicsRectItem(0,0,3,3,this); |
|
47 | 48 | m_clipRect.contains(point); |
|
48 | 49 | item->setPos(point.x()-1,point.y()-1); |
|
49 | if(!m_clipRect.contains(point)) item->setVisible(false); | |
|
50 | if(!m_clipRect.contains(point) || !m_series->isPointsVisible()) item->setVisible(false); | |
|
50 | 51 | m_points << item; |
|
51 | 52 | } |
|
52 | 53 |
@@ -31,6 +31,7 public: | |||
|
31 | 31 | virtual void removePoint(const QPointF& point); |
|
32 | 32 | virtual void setPoint(const QPointF& oldPoint, const QPointF& newPoint); |
|
33 | 33 | virtual void setPoint(int index,const QPointF& point); |
|
34 | void setPointsVisible(bool visible); | |
|
34 | 35 | void clear(); |
|
35 | 36 | void clearView(); |
|
36 | 37 | int count() const { return m_data.size();} |
@@ -2,7 +2,8 | |||
|
2 | 2 | |
|
3 | 3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | 4 | |
|
5 | QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent) | |
|
5 | QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent), | |
|
6 | m_pointsVisible(false) | |
|
6 | 7 | { |
|
7 | 8 | } |
|
8 | 9 |
@@ -18,8 +18,6 public: | |||
|
18 | 18 | |
|
19 | 19 | public: // from QChartSeries |
|
20 | 20 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;} |
|
21 | ||
|
22 | public: | |
|
23 | 21 | int add(qreal x, qreal y); |
|
24 | 22 | void set(int index,qreal x,qreal y); |
|
25 | 23 | void clear(); |
@@ -27,6 +25,9 public: | |||
|
27 | 25 | void setPen(const QPen& pen); |
|
28 | 26 | const QPen& pen() const { return m_pen;} |
|
29 | 27 | |
|
28 | void pointsVisible(bool visible); | |
|
29 | bool isPointsVisible() const {return m_pointsVisible;} | |
|
30 | ||
|
30 | 31 | int count() const; |
|
31 | 32 | qreal x(int pos) const; |
|
32 | 33 | qreal y(int pos) const; |
@@ -39,6 +40,7 private: | |||
|
39 | 40 | QVector<qreal> m_x; |
|
40 | 41 | QVector<qreal> m_y; |
|
41 | 42 | QPen m_pen; |
|
43 | bool m_pointsVisible; | |
|
42 | 44 | }; |
|
43 | 45 | |
|
44 | 46 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now