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