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