@@ -29,6 +29,7 | |||||
29 | <li><a href="qseries.html">QSeries</a></li> |
|
29 | <li><a href="qseries.html">QSeries</a></li> | |
30 | <li><a href="qsplineseries.html">QSplineSeries</a></li> |
|
30 | <li><a href="qsplineseries.html">QSplineSeries</a></li> | |
31 | <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li> |
|
31 | <li><a href="qstackedbarseries.html">QStackedBarSeries</a></li> | |
|
32 | <li><a href="qxyseries.html">QXYSeries</a></li> | |||
32 | </ul> |
|
33 | </ul> | |
33 | </td> |
|
34 | </td> | |
34 | </tr> |
|
35 | </tr> |
@@ -112,7 +112,7 void QChart::setChartBackgroundPen(const QPen& pen) | |||||
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 | /*! |
|
114 | /*! | |
115 |
Sets the chart \a title. The description text that is |
|
115 | Sets the chart \a title. The description text that is drawn above the chart. | |
116 | */ |
|
116 | */ | |
117 | void QChart::setChartTitle(const QString& title) |
|
117 | void QChart::setChartTitle(const QString& title) | |
118 | { |
|
118 | { | |
@@ -121,7 +121,7 void QChart::setChartTitle(const QString& title) | |||||
121 | } |
|
121 | } | |
122 |
|
122 | |||
123 | /*! |
|
123 | /*! | |
124 |
|
|
124 | Returns the chart title. The description text that is drawn above the chart. | |
125 | */ |
|
125 | */ | |
126 | QString QChart::chartTitle() const |
|
126 | QString QChart::chartTitle() const | |
127 | { |
|
127 | { |
@@ -134,7 +134,7 int QChartView::margin() const | |||||
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | /*! |
|
136 | /*! | |
137 |
Sets the chart \a title. A description text that is |
|
137 | Sets the chart \a title. A description text that is drawn above the chart. | |
138 | */ |
|
138 | */ | |
139 | void QChartView::setChartTitle(const QString& title) |
|
139 | void QChartView::setChartTitle(const QString& title) | |
140 | { |
|
140 | { | |
@@ -142,7 +142,7 void QChartView::setChartTitle(const QString& title) | |||||
142 | } |
|
142 | } | |
143 |
|
143 | |||
144 | /*! |
|
144 | /*! | |
145 |
Returns the chart's title. A description text that is |
|
145 | Returns the chart's title. A description text that is drawn above the chart. | |
146 | */ |
|
146 | */ | |
147 | QString QChartView::chartTitle() const |
|
147 | QString QChartView::chartTitle() const | |
148 | { |
|
148 | { |
@@ -3,25 +3,23 | |||||
3 |
|
3 | |||
4 | /*! |
|
4 | /*! | |
5 | \class QScatterSeries |
|
5 | \class QScatterSeries | |
6 | \brief QtCommercial Chart series API for showing scatter series. |
|
6 | \brief The QScatterSeries class is used for making scatter charts. | |
7 |
|
7 | |||
8 | \mainclass |
|
8 | \mainclass | |
9 |
|
9 | |||
10 | Example on how to create a chart with scatter series: |
|
10 | The scatter data is displayed as a collection of points on the chart. Each point determines the position on the horizontal axis | |
11 | \snippet ../example/scatter/main.cpp 1 |
|
11 | and the vertical axis. | |
12 |
|
12 | |||
13 | The example code would result the following: |
|
13 | \image scatterchart.png | |
14 |
|
14 | |||
15 | \image scatter_example1.jpg |
|
15 | Creating basic scatter chart is simple: | |
16 |
|
16 | \code | ||
17 | To customize the graphical representation of the series, you can modify pen, brush, shape and |
|
17 | QScatterSeries* series = new QScatterSeries(); | |
18 | size of the marker items. For example: |
|
18 | series->add(0, 6); | |
19 |
|
19 | series->add(2, 4); | ||
20 | \snippet ../example/scatter/main.cpp 3 |
|
20 | ... | |
21 |
|
21 | chartView->addSeries(series); | ||
22 | Would present your scatter markers as big rectangles with opaque, uglyish green outlines and |
|
22 | \endcode | |
23 | opaque red filling instead of the beatiful markers defined by the chart's theme: |
|
|||
24 | \image scatter_example_custom.jpg |
|
|||
25 | */ |
|
23 | */ | |
26 |
|
24 | |||
27 | /*! |
|
25 | /*! | |
@@ -41,13 +39,12 | |||||
41 | /*! |
|
39 | /*! | |
42 | \fn QChartSeriesType QScatterSeries::type() const |
|
40 | \fn QChartSeriesType QScatterSeries::type() const | |
43 | \brief Returns QChartSeries::SeriesTypeScatter. |
|
41 | \brief Returns QChartSeries::SeriesTypeScatter. | |
|
42 | \sa QSeries, QSeriesType | |||
44 | */ |
|
43 | */ | |
45 |
|
44 | |||
46 | /*! |
|
45 | /*! | |
47 |
\fn void QScatterSeries::clicked(QPointF |
|
46 | \fn void QScatterSeries::clicked(const QPointF& point) | |
48 | User clicked the scatter series. Note that the \a coordinate is the chart coordinate that the |
|
47 | \brief Signal is emitted when user clicks the \a point on scatter chart. | |
49 | click occurred on; not necessarily a data point coordinate. To find the corresponding (closest) |
|
|||
50 | data point you can use closestPoint(). |
|
|||
51 | */ |
|
48 | */ | |
52 |
|
49 | |||
53 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
50 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
@@ -69,101 +66,6 QScatterSeries::~QScatterSeries() | |||||
69 | { |
|
66 | { | |
70 | } |
|
67 | } | |
71 |
|
68 | |||
72 |
|
||||
73 |
|
||||
74 | /*! |
|
|||
75 | Stream operator for adding a data point with \a value to the series. |
|
|||
76 | \sa add() |
|
|||
77 |
|
||||
78 | For example: |
|
|||
79 | \snippet ../example/scatter/main.cpp 2 |
|
|||
80 | */ |
|
|||
81 |
|
||||
82 |
|
||||
83 | /*! |
|
|||
84 | Stream operator for adding a list of points to the series. |
|
|||
85 | \sa add() |
|
|||
86 | */ |
|
|||
87 |
|
||||
88 |
|
||||
89 | /*! |
|
|||
90 | Replaces the data of the series with the given list of data \a points. |
|
|||
91 | */ |
|
|||
92 |
|
||||
93 |
|
||||
94 | /*! |
|
|||
95 | Returns the current list of data points of the series. |
|
|||
96 | */ |
|
|||
97 |
|
||||
98 | /*! |
|
|||
99 | Replaces the point at \a index with \a newPoint. Returns true if \a index is a valid position |
|
|||
100 | in the series data, false otherwise. |
|
|||
101 | */ |
|
|||
102 |
|
||||
103 |
|
||||
104 | /*! |
|
|||
105 | Remove the data point at \a index. Returns true if a point was removed, false if the point |
|
|||
106 | at \a index does not exist on the series. |
|
|||
107 | */ |
|
|||
108 |
|
||||
109 |
|
||||
110 | /*! |
|
|||
111 | Remove all occurrences of \a point from the series and returns the number of points removed. |
|
|||
112 | */ |
|
|||
113 |
|
||||
114 |
|
||||
115 | /*! |
|
|||
116 | Remove all data points from the series. |
|
|||
117 | */ |
|
|||
118 |
|
||||
119 | /*! |
|
|||
120 | Returns the index of the data point that is closest to \a coordinate. If several data points |
|
|||
121 | are at the same distance from the \a coordinate, returns the last one. If no points exist, |
|
|||
122 | returns -1. |
|
|||
123 |
|
||||
124 | int QScatterSeries::closestPoint(QPointF coordinate) |
|
|||
125 | { |
|
|||
126 | qreal distance(-1); |
|
|||
127 | int pointIndex(-1); |
|
|||
128 | for (int i(0); i < d->m_data.count(); i++) { |
|
|||
129 | QPointF dataPoint = d->m_data.at(i); |
|
|||
130 | QPointF difference = dataPoint - coordinate; |
|
|||
131 | if (i == 0 || difference.manhattanLength() <= distance) { |
|
|||
132 | distance = difference.manhattanLength(); |
|
|||
133 | pointIndex = i; |
|
|||
134 | } |
|
|||
135 | } |
|
|||
136 | return pointIndex; |
|
|||
137 | } |
|
|||
138 | */ |
|
|||
139 |
|
||||
140 | /*! |
|
|||
141 | Returns the pen used for drawing markers. |
|
|||
142 | */ |
|
|||
143 |
|
||||
144 |
|
||||
145 | /*! |
|
|||
146 | Overrides the default pen used for drawing a marker item with a user defined \a pen. The |
|
|||
147 | default pen is defined by chart theme setting. |
|
|||
148 |
|
||||
149 | \sa setBrush() |
|
|||
150 | \sa QChart::setChartTheme() |
|
|||
151 | */ |
|
|||
152 |
|
||||
153 |
|
||||
154 | /*! |
|
|||
155 | Returns the brush used for drawing markers. |
|
|||
156 | */ |
|
|||
157 |
|
||||
158 |
|
||||
159 | /*! |
|
|||
160 | Overrides the default brush of the marker items with a user defined \a brush. The default brush |
|
|||
161 | is defined by chart theme setting. |
|
|||
162 |
|
||||
163 | \sa setPen() |
|
|||
164 | \sa QChart::setChartTheme() |
|
|||
165 | */ |
|
|||
166 |
|
||||
167 | /*! |
|
69 | /*! | |
168 | Returns the shape used for drawing markers. |
|
70 | Returns the shape used for drawing markers. | |
169 | */ |
|
71 | */ |
@@ -34,15 +34,13 public: // from QChartSeries | |||||
34 | QSeriesType type() const { return QSeries::SeriesTypeScatter; } |
|
34 | QSeriesType type() const { return QSeries::SeriesTypeScatter; } | |
35 |
|
35 | |||
36 | public: |
|
36 | public: | |
37 | //int closestPoint(QPointF coordinate); |
|
|||
38 |
|
||||
39 | MarkerShape shape() const; |
|
37 | MarkerShape shape() const; | |
40 | void setShape(MarkerShape shape); |
|
38 | void setShape(MarkerShape shape); | |
41 | qreal size() const; |
|
39 | qreal size() const; | |
42 | void setSize(qreal size); |
|
40 | void setSize(qreal size); | |
43 |
|
41 | |||
44 | signals: |
|
42 | signals: | |
45 |
void clicked(QPointF |
|
43 | void clicked(const QPointF& point); | |
46 |
|
44 | |||
47 | private: |
|
45 | private: | |
48 | MarkerShape m_shape; |
|
46 | MarkerShape m_shape; |
@@ -8,12 +8,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | /*! |
|
10 | /*! | |
11 | \fn virtual QSeriesType QXYSeries::type() const |
|
|||
12 | \brief Returns type of series. |
|
|||
13 | \sa QSeries, QSeriesType |
|
|||
14 | */ |
|
|||
15 |
|
||||
16 | /*! |
|
|||
17 | \fn QPen QXYSeries::pen() const |
|
11 | \fn QPen QXYSeries::pen() const | |
18 | \brief Returns pen used to draw points for series. |
|
12 | \brief Returns pen used to draw points for series. | |
19 | \sa setPen() |
|
13 | \sa setPen() | |
@@ -81,6 +75,17 void QXYSeries::add(const QPointF& point) | |||||
81 | } |
|
75 | } | |
82 |
|
76 | |||
83 | /*! |
|
77 | /*! | |
|
78 | This is an overloaded function. | |||
|
79 | Adds list of data \a points to the series. Points are connected with lines on the chart. | |||
|
80 | */ | |||
|
81 | void QXYSeries::add(const QList<QPointF> points) | |||
|
82 | { | |||
|
83 | foreach(const QPointF& point , points) { | |||
|
84 | add(point.x(),point.y()); | |||
|
85 | } | |||
|
86 | } | |||
|
87 | ||||
|
88 | /*! | |||
84 | Modifies \a y value for given \a x a value. |
|
89 | Modifies \a y value for given \a x a value. | |
85 | */ |
|
90 | */ | |
86 | void QXYSeries::replace(qreal x,qreal y) |
|
91 | void QXYSeries::replace(qreal x,qreal y) | |
@@ -120,9 +125,9 void QXYSeries::remove(const QPointF& point) | |||||
120 | } |
|
125 | } | |
121 |
|
126 | |||
122 | /*! |
|
127 | /*! | |
123 | Clears all the data. |
|
128 | Removes all data points from the series. | |
124 | */ |
|
129 | */ | |
125 |
void QXYSeries:: |
|
130 | void QXYSeries::removeAll() | |
126 | { |
|
131 | { | |
127 | m_x.clear(); |
|
132 | m_x.clear(); | |
128 | m_y.clear(); |
|
133 | m_y.clear(); | |
@@ -156,7 +161,9 int QXYSeries::count() const | |||||
156 | } |
|
161 | } | |
157 |
|
162 | |||
158 | /*! |
|
163 | /*! | |
159 | Sets \a pen used for drawing points on the chart. |
|
164 | Sets \a pen used for drawing points on the chart. If the pen is not defined, the | |
|
165 | pen from chart theme is used. | |||
|
166 | \sa QChart::setChartTheme() | |||
160 | */ |
|
167 | */ | |
161 | void QXYSeries::setPen(const QPen& pen) |
|
168 | void QXYSeries::setPen(const QPen& pen) | |
162 | { |
|
169 | { | |
@@ -167,7 +174,9 void QXYSeries::setPen(const QPen& pen) | |||||
167 | } |
|
174 | } | |
168 |
|
175 | |||
169 | /*! |
|
176 | /*! | |
170 | Sets \a brush used for drawing points on the chart. |
|
177 | Sets \a brush used for drawing points on the chart. If the brush is not defined, brush | |
|
178 | from chart theme setting is used. | |||
|
179 | \sa QChart::setChartTheme() | |||
171 | */ |
|
180 | */ | |
172 |
|
181 | |||
173 | void QXYSeries::setBrush(const QBrush& brush) |
|
182 | void QXYSeries::setBrush(const QBrush& brush) | |
@@ -191,6 +200,18 QXYSeries& QXYSeries::operator<< (const QPointF &point) | |||||
191 | } |
|
200 | } | |
192 |
|
201 | |||
193 |
|
202 | |||
|
203 | /*! | |||
|
204 | Stream operator for adding a list of \a points to the series. | |||
|
205 | \sa add() | |||
|
206 | */ | |||
|
207 | ||||
|
208 | QXYSeries& QXYSeries::operator<< (const QList<QPointF> points) | |||
|
209 | { | |||
|
210 | add(points); | |||
|
211 | return *this; | |||
|
212 | } | |||
|
213 | ||||
|
214 | ||||
194 | #include "moc_qxyseries.cpp" |
|
215 | #include "moc_qxyseries.cpp" | |
195 |
|
216 | |||
196 | QTCOMMERCIALCHART_END_NAMESPACE |
|
217 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -19,24 +19,19 protected: | |||||
19 | public: |
|
19 | public: | |
20 | void add(qreal x, qreal y); |
|
20 | void add(qreal x, qreal y); | |
21 | void add(const QPointF& point); |
|
21 | void add(const QPointF& point); | |
|
22 | void add(const QList<QPointF> points); | |||
22 | void replace(qreal x,qreal y); |
|
23 | void replace(qreal x,qreal y); | |
23 | void replace(const QPointF& point); |
|
24 | void replace(const QPointF& point); | |
24 | void remove(qreal x); |
|
25 | void remove(qreal x); | |
25 | void remove(const QPointF& point); |
|
26 | void remove(const QPointF& point); | |
26 |
void |
|
27 | void removeAll(); | |
27 |
|
28 | |||
28 | int count() const; |
|
29 | int count() const; | |
29 | qreal x(int pos) const; |
|
30 | qreal x(int pos) const; | |
30 | qreal y(int pos) const; |
|
31 | qreal y(int pos) const; | |
31 |
|
32 | |||
32 | QXYSeries& operator << (const QPointF &point); |
|
33 | QXYSeries& operator << (const QPointF &point); | |
33 | /* |
|
34 | QXYSeries& operator << (const QList<QPointF> points); | |
34 | void add(QList<QPointF> points); |
|
|||
35 | void setData(QList<QPointF> points); |
|
|||
36 | QScatterSeries& operator << (const QPointF &value); |
|
|||
37 | QScatterSeries& operator << (QList<QPointF> points); |
|
|||
38 | int removeAll(QPointF point); |
|
|||
39 | */ |
|
|||
40 |
|
35 | |||
41 | void setPen(const QPen& pen); |
|
36 | void setPen(const QPen& pen); | |
42 | QPen pen() const {return m_pen;} |
|
37 | QPen pen() const {return m_pen;} |
General Comments 0
You need to be logged in to leave comments.
Login now