@@ -1,115 +1,115 | |||
|
1 | 1 | #include "qareaseries.h" |
|
2 | 2 | #include "qlineseries.h" |
|
3 | 3 | |
|
4 | 4 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
5 | 5 | |
|
6 | 6 | /*! |
|
7 | 7 | \class QAreaSeries |
|
8 | 8 | \brief The QAreaSeries class is used for making area charts. |
|
9 | 9 | |
|
10 | 10 | \mainclass |
|
11 | 11 | |
|
12 | 12 | An area chart is used to show quantitative data. It is based on line chart, in the way that area between axis and the line |
|
13 | 13 | is emphasized with color. Since the area chart is based on line chart, QAreaSeries constructor needs QLineSeries instance, |
|
14 |
which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X |
|
|
14 | which defines "upper" boundary of the area. "Lower" boundary is defined by default by axis X. Instead of axis X "lower" boundary can be specified by other line. | |
|
15 | 15 | In that case QAreaSeries should be initiated with two QLineSerie instances. Please note terms "upper" and "lower" boundary can be misleading in cases |
|
16 | where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary will be filled. | |
|
16 | where "lower" boundary had bigger values than the "upper" one, however the main point that area between these two boundary lines will be filled. | |
|
17 | 17 | |
|
18 | 18 | \image areachart.png |
|
19 | 19 | |
|
20 | 20 | Creating basic area chart is simple: |
|
21 | 21 | \code |
|
22 | 22 | QLineSeries* lineSeries = new QLineSeries(); |
|
23 | 23 | series->add(0, 6); |
|
24 | 24 | series->add(2, 4); |
|
25 | 25 | QAreaSeries* areaSeries = new QAreaSeries(lineSeries); |
|
26 | 26 | ... |
|
27 | 27 | chartView->addSeries(areaSeries); |
|
28 | 28 | \endcode |
|
29 | 29 | */ |
|
30 | 30 | |
|
31 | 31 | /*! |
|
32 | 32 | \fn virtual QSeriesType QAreaSeries::type() const |
|
33 | 33 | \brief Returns type of series. |
|
34 | 34 | \sa QSeries, QSeriesType |
|
35 | 35 | */ |
|
36 | 36 | |
|
37 | 37 | /*! |
|
38 | 38 | \fn QLineSeries* QAreaSeries::upperSeries() const |
|
39 | 39 | \brief Returns upperSeries used to define one of area boundaries. |
|
40 | 40 | */ |
|
41 | 41 | |
|
42 | 42 | /*! |
|
43 | 43 | \fn QLineSeries* QAreaSeries::lowerSeries() const |
|
44 | 44 | \brief Returns lowerSeries used to define one of area boundaries. Note if QAreaSeries where counstucted wihtout a\ lowerSeries |
|
45 | 45 | this function return Null pointer. |
|
46 | 46 | */ |
|
47 | 47 | |
|
48 | 48 | /*! |
|
49 | 49 | \fn QPen QAreaSeries::pen() const |
|
50 | 50 | \brief Returns the pen used to draw line for this series. |
|
51 | 51 | \sa setPen() |
|
52 | 52 | */ |
|
53 | 53 | |
|
54 | 54 | /*! |
|
55 | 55 | \fn QPen QAreaSeries::brush() const |
|
56 | 56 | \brief Returns the brush used to draw line for this series. |
|
57 | 57 | \sa setBrush() |
|
58 | 58 | */ |
|
59 | 59 | |
|
60 | 60 | /*! |
|
61 | 61 | \fn bool QAreaSeries::pointsVisible() const |
|
62 | 62 | \brief Returns if the points are drawn for this series. |
|
63 | 63 | \sa setPointsVisible() |
|
64 | 64 | */ |
|
65 | 65 | |
|
66 | 66 | /*! |
|
67 | 67 | \fn void QAreaSeries::updated() |
|
68 | 68 | \brief \internal |
|
69 | 69 | */ |
|
70 | 70 | |
|
71 | 71 | /*! |
|
72 | 72 | Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a |
|
73 | 73 | upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. |
|
74 | 74 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
75 | 75 | */ |
|
76 | 76 | QAreaSeries::QAreaSeries(QLineSeries* upperSeries,QLineSeries* lowerSeries):QSeries(upperSeries), |
|
77 | 77 | m_upperSeries(upperSeries), |
|
78 | 78 | m_lowerSeries(lowerSeries), |
|
79 | 79 | m_pointsVisible(false) |
|
80 | 80 | { |
|
81 | 81 | } |
|
82 | 82 | /*! |
|
83 | 83 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
84 | 84 | and are deleted when mentioned object are destroyed. |
|
85 | 85 | */ |
|
86 | 86 | QAreaSeries::~QAreaSeries() |
|
87 | 87 | { |
|
88 | 88 | } |
|
89 | 89 | |
|
90 | 90 | /*! |
|
91 | 91 | Sets \a pen used for drawing area outline. |
|
92 | 92 | */ |
|
93 | 93 | void QAreaSeries::setPen(const QPen& pen) |
|
94 | 94 | { |
|
95 | 95 | m_pen=pen; |
|
96 | 96 | } |
|
97 | 97 | |
|
98 | 98 | /*! |
|
99 | 99 | Sets \a brush used for filling the area. |
|
100 | 100 | */ |
|
101 | 101 | void QAreaSeries::setBrush(const QBrush& brush) |
|
102 | 102 | { |
|
103 | 103 | m_brush=brush; |
|
104 | 104 | } |
|
105 | 105 | /*! |
|
106 | 106 | Sets if data points are \a visible and should be drawn on line. |
|
107 | 107 | */ |
|
108 | 108 | void QAreaSeries::setPointsVisible(bool visible) |
|
109 | 109 | { |
|
110 | 110 | m_pointsVisible=visible; |
|
111 | 111 | } |
|
112 | 112 | |
|
113 | 113 | #include "moc_qareaseries.cpp" |
|
114 | 114 | |
|
115 | 115 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now