@@ -1,99 +1,103 | |||
|
1 | 1 | #include "qscatterseries.h" |
|
2 | 2 | #include "qchart.h" |
|
3 | 3 | |
|
4 | 4 | /*! |
|
5 | 5 | \class QScatterSeries |
|
6 | 6 | \brief The QScatterSeries class is used for making scatter charts. |
|
7 | 7 | |
|
8 | 8 | \mainclass |
|
9 | 9 | |
|
10 | 10 | The scatter data is displayed as a collection of points on the chart. Each point determines the position on the horizontal axis |
|
11 | 11 | and the vertical axis. |
|
12 | 12 | |
|
13 | 13 | \image scatterchart.png |
|
14 | 14 | |
|
15 | 15 | Creating basic scatter chart is simple: |
|
16 | 16 | \code |
|
17 | 17 | QScatterSeries* series = new QScatterSeries(); |
|
18 | 18 | series->add(0, 6); |
|
19 | 19 | series->add(2, 4); |
|
20 | 20 | ... |
|
21 | 21 | chartView->addSeries(series); |
|
22 | 22 | \endcode |
|
23 | 23 | */ |
|
24 | 24 | |
|
25 | 25 | /*! |
|
26 | 26 | \enum QScatterSeries::MarkerShape |
|
27 | 27 | |
|
28 | 28 | This enum describes the shape used when rendering marker items. |
|
29 | 29 | |
|
30 | 30 | \value MarkerShapeCircle |
|
31 | 31 | \value MarkerShapeRectangle |
|
32 | 32 | */ |
|
33 | 33 | |
|
34 | 34 | /*! |
|
35 | 35 | \fn QChartSeriesType QScatterSeries::type() const |
|
36 | 36 | \brief Returns QChartSeries::SeriesTypeScatter. |
|
37 | 37 | \sa QSeries, QSeriesType |
|
38 | 38 | */ |
|
39 | 39 | |
|
40 | 40 | /*! |
|
41 | 41 | \fn void QScatterSeries::clicked(const QPointF& point) |
|
42 | 42 | \brief Signal is emitted when user clicks the \a point on scatter chart. |
|
43 | 43 | */ |
|
44 | 44 | |
|
45 | 45 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
46 | 46 | |
|
47 | 47 | /*! |
|
48 | 48 | Constructs a series object which is a child of \a parent. |
|
49 | 49 | */ |
|
50 | 50 | QScatterSeries::QScatterSeries(QObject *parent) : |
|
51 | 51 | QXYSeries(parent), |
|
52 | 52 | m_shape(QScatterSeries::MarkerShapeCircle), |
|
53 | 53 | m_size(9.0) |
|
54 | 54 | { |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | /*! |
|
58 | 58 | Destroys the object. Note that adding series to QChart transfers the ownership to the chart. |
|
59 | 59 | */ |
|
60 | 60 | QScatterSeries::~QScatterSeries() |
|
61 | 61 | { |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | /*! |
|
65 | 65 | Returns the shape used for drawing markers. |
|
66 | 66 | */ |
|
67 | 67 | QScatterSeries::MarkerShape QScatterSeries::shape() const |
|
68 | 68 | { |
|
69 | return (QScatterSeries::MarkerShape) m_shape; | |
|
69 | return m_shape; | |
|
70 | 70 | } |
|
71 | 71 | |
|
72 | 72 | /*! |
|
73 | 73 | Overrides the default shape of the marker items with a user defined \a shape. The default shape |
|
74 | 74 | is defined by chart theme setting. |
|
75 | 75 | */ |
|
76 | 76 | void QScatterSeries::setShape(MarkerShape shape) |
|
77 | 77 | { |
|
78 |
m_shape |
|
|
79 | emit updated(); | |
|
78 | if(m_shape!= shape){ | |
|
79 | m_shape=shape; | |
|
80 | emit QXYSeries::updated(); | |
|
81 | } | |
|
80 | 82 | } |
|
81 | 83 | |
|
82 | 84 | /*! |
|
83 | 85 | Returns the size of the marker items. |
|
84 | 86 | */ |
|
85 | 87 | qreal QScatterSeries::size() const |
|
86 | 88 | { |
|
87 | 89 | return m_size; |
|
88 | 90 | } |
|
89 | 91 | |
|
90 | 92 | /*! |
|
91 | 93 | Set the \a size of the marker items. The default size is 9.0. |
|
92 | 94 | */ |
|
93 | 95 | void QScatterSeries::setSize(qreal size) |
|
94 | 96 | { |
|
95 |
m_size = size |
|
|
96 | emit updated(); | |
|
97 | if(m_size != size){ | |
|
98 | m_size=size; | |
|
99 | emit updated(); | |
|
100 | } | |
|
97 | 101 | } |
|
98 | 102 | |
|
99 | 103 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now