@@ -1,182 +1,182 | |||||
1 | #include "qlinechartseries.h" |
|
1 | #include "qlinechartseries.h" | |
2 |
|
2 | |||
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
4 |
|
4 | |||
5 | /*! |
|
5 | /*! | |
6 | \class QLineChartSeries |
|
6 | \class QLineChartSeries | |
7 | \brief The QLineChartSeries class is used for making line charts. |
|
7 | \brief The QLineChartSeries class is used for making line charts. | |
8 |
|
8 | |||
9 | \mainclass |
|
9 | \mainclass | |
10 |
|
10 | |||
11 | A line chart is used to show information as a series of data points |
|
11 | A line chart is used to show information as a series of data points | |
12 | connected by straight lines. |
|
12 | connected by straight lines. | |
13 |
|
13 | |||
14 | \image linechart.png |
|
14 | \image linechart.png | |
15 |
|
15 | |||
16 | To create line charts, users need to first QLineChartSeries object. |
|
16 | To create line charts, users need to first QLineChartSeries object. | |
17 |
|
17 | |||
18 | \snippet ../example/linechart/main.cpp 1 |
|
18 | \snippet ../example/linechart/main.cpp 1 | |
19 |
|
19 | |||
20 | Populate with the data |
|
20 | Populate with the data | |
21 |
|
21 | |||
22 | \snippet ../example/linechart/main.cpp 2 |
|
22 | \snippet ../example/linechart/main.cpp 2 | |
23 |
|
23 | |||
24 | Add created series objects to QChartView or QChart instance. |
|
24 | Add created series objects to QChartView or QChart instance. | |
25 |
|
25 | |||
26 | \snippet ../example/linechart/main.cpp 3 |
|
26 | \snippet ../example/linechart/main.cpp 3 | |
27 |
|
27 | |||
28 | */ |
|
28 | */ | |
29 |
|
29 | |||
30 | /*! |
|
30 | /*! | |
31 | \fn virtual QChartSeriesType QLineChartSeries::type() const |
|
31 | \fn virtual QChartSeriesType QLineChartSeries::type() const | |
32 | \brief Returns type of series. |
|
32 | \brief Returns type of series. | |
33 | \sa QChartSeries, QChartSeriesType |
|
33 | \sa QChartSeries, QChartSeriesType | |
34 | */ |
|
34 | */ | |
35 |
|
35 | |||
36 | /*! |
|
36 | /*! | |
37 | \fn QPen QLineChartSeries::pen() const |
|
37 | \fn QPen QLineChartSeries::pen() const | |
38 | \brief Returns the pen used to draw line for this series. |
|
38 | \brief Returns the pen used to draw line for this series. | |
39 | \sa setPen() |
|
39 | \sa setPen() | |
40 | */ |
|
40 | */ | |
41 |
|
41 | |||
42 | /*! |
|
42 | /*! | |
43 | \fn bool isPointsVisible() const |
|
43 | \fn bool QLineChartSeries::isPointsVisible() const | |
44 | \brief Returns if the points are drawn for this series. |
|
44 | \brief Returns if the points are drawn for this series. | |
45 | \sa setPointsVisible() |
|
45 | \sa setPointsVisible() | |
46 | */ |
|
46 | */ | |
47 |
|
47 | |||
48 |
|
48 | |||
49 | /*! |
|
49 | /*! | |
50 | \fn void QLineChartSeries::changed(int index) |
|
50 | \fn void QLineChartSeries::changed(int index) | |
51 | \brief \internal \a index |
|
51 | \brief \internal \a index | |
52 | */ |
|
52 | */ | |
53 |
|
53 | |||
54 | /*! |
|
54 | /*! | |
55 | Constructs empty series object which is a child of \a parent. |
|
55 | Constructs empty series object which is a child of \a parent. | |
56 | When series object is added to QChartView or QChart instance ownerships is transfered. |
|
56 | When series object is added to QChartView or QChart instance ownerships is transfered. | |
57 | */ |
|
57 | */ | |
58 | QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent), |
|
58 | QLineChartSeries::QLineChartSeries(QObject* parent):QChartSeries(parent), | |
59 | m_pointsVisible(false) |
|
59 | m_pointsVisible(false) | |
60 | { |
|
60 | { | |
61 | } |
|
61 | } | |
62 | /*! |
|
62 | /*! | |
63 | Destroys the object. Series added to QChartView or QChart instances are owned by those, |
|
63 | Destroys the object. Series added to QChartView or QChart instances are owned by those, | |
64 | and are deleted when mentioned object are destroyed. |
|
64 | and are deleted when mentioned object are destroyed. | |
65 | */ |
|
65 | */ | |
66 | QLineChartSeries::~QLineChartSeries() |
|
66 | QLineChartSeries::~QLineChartSeries() | |
67 | { |
|
67 | { | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 | /*! |
|
70 | /*! | |
71 | Adds data point \a x \a y to the series. Points are connected with lines on the chart. |
|
71 | Adds data point \a x \a y to the series. Points are connected with lines on the chart. | |
72 | Function returns index, which can be used to modify data. |
|
72 | Function returns index, which can be used to modify data. | |
73 | */ |
|
73 | */ | |
74 | int QLineChartSeries::add(qreal x,qreal y) |
|
74 | int QLineChartSeries::add(qreal x,qreal y) | |
75 | { |
|
75 | { | |
76 | m_x<<x; |
|
76 | m_x<<x; | |
77 | m_y<<y; |
|
77 | m_y<<y; | |
78 | return m_x.size()-1; |
|
78 | return m_x.size()-1; | |
79 | } |
|
79 | } | |
80 |
|
80 | |||
81 | /*! |
|
81 | /*! | |
82 | This is an overloaded function. |
|
82 | This is an overloaded function. | |
83 | Adds data \a point to the series. Points are connected with lines on the chart. |
|
83 | Adds data \a point to the series. Points are connected with lines on the chart. | |
84 | Function returns index, which can be used to modify data. |
|
84 | Function returns index, which can be used to modify data. | |
85 | */ |
|
85 | */ | |
86 | int QLineChartSeries::add(const QPointF& point) |
|
86 | int QLineChartSeries::add(const QPointF& point) | |
87 | { |
|
87 | { | |
88 | m_x<<point.x(); |
|
88 | m_x<<point.x(); | |
89 | m_y<<point.y(); |
|
89 | m_y<<point.y(); | |
90 | return m_x.size()-1; |
|
90 | return m_x.size()-1; | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 | /*! |
|
93 | /*! | |
94 | Modifies data within \a index, sets new \a x and \a y values. |
|
94 | Modifies data within \a index, sets new \a x and \a y values. | |
95 | */ |
|
95 | */ | |
96 | void QLineChartSeries::set(int index,qreal x,qreal y) |
|
96 | void QLineChartSeries::set(int index,qreal x,qreal y) | |
97 | { |
|
97 | { | |
98 | m_x[index]=x; |
|
98 | m_x[index]=x; | |
99 | m_y[index]=y; |
|
99 | m_y[index]=y; | |
100 | emit changed(index); |
|
100 | emit changed(index); | |
101 | } |
|
101 | } | |
102 |
|
102 | |||
103 | /*! |
|
103 | /*! | |
104 | This is an overloaded function. |
|
104 | This is an overloaded function. | |
105 | Modifies data within \a index, sets new \a point value. |
|
105 | Modifies data within \a index, sets new \a point value. | |
106 | */ |
|
106 | */ | |
107 | void QLineChartSeries::set(int index,const QPointF& point) |
|
107 | void QLineChartSeries::set(int index,const QPointF& point) | |
108 | { |
|
108 | { | |
109 | m_x[index]=point.x(); |
|
109 | m_x[index]=point.x(); | |
110 | m_y[index]=point.y(); |
|
110 | m_y[index]=point.y(); | |
111 | emit changed(index); |
|
111 | emit changed(index); | |
112 | } |
|
112 | } | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | /*! |
|
115 | /*! | |
116 | Clears all the data. |
|
116 | Clears all the data. | |
117 | */ |
|
117 | */ | |
118 | void QLineChartSeries::clear() |
|
118 | void QLineChartSeries::clear() | |
119 | { |
|
119 | { | |
120 | m_x.clear(); |
|
120 | m_x.clear(); | |
121 | m_y.clear(); |
|
121 | m_y.clear(); | |
122 | } |
|
122 | } | |
123 |
|
123 | |||
124 | /*! |
|
124 | /*! | |
125 | \internal \a pos |
|
125 | \internal \a pos | |
126 | */ |
|
126 | */ | |
127 | qreal QLineChartSeries::x(int pos) const |
|
127 | qreal QLineChartSeries::x(int pos) const | |
128 | { |
|
128 | { | |
129 | return m_x.at(pos); |
|
129 | return m_x.at(pos); | |
130 | } |
|
130 | } | |
131 |
|
131 | |||
132 | /*! |
|
132 | /*! | |
133 | \internal \a pos |
|
133 | \internal \a pos | |
134 | */ |
|
134 | */ | |
135 | qreal QLineChartSeries::y(int pos) const |
|
135 | qreal QLineChartSeries::y(int pos) const | |
136 | { |
|
136 | { | |
137 | return m_y.at(pos); |
|
137 | return m_y.at(pos); | |
138 | } |
|
138 | } | |
139 |
|
139 | |||
140 | /*! |
|
140 | /*! | |
141 | Returns number of data points within series. |
|
141 | Returns number of data points within series. | |
142 | */ |
|
142 | */ | |
143 | int QLineChartSeries::count() const |
|
143 | int QLineChartSeries::count() const | |
144 | { |
|
144 | { | |
145 | Q_ASSERT(m_x.size() == m_y.size()); |
|
145 | Q_ASSERT(m_x.size() == m_y.size()); | |
146 |
|
146 | |||
147 | return m_x.size(); |
|
147 | return m_x.size(); | |
148 |
|
148 | |||
149 | } |
|
149 | } | |
150 |
|
150 | |||
151 | /*! |
|
151 | /*! | |
152 | Sets \a pen used for drawing given series.. |
|
152 | Sets \a pen used for drawing given series.. | |
153 | */ |
|
153 | */ | |
154 | void QLineChartSeries::setPen(const QPen& pen) |
|
154 | void QLineChartSeries::setPen(const QPen& pen) | |
155 | { |
|
155 | { | |
156 | m_pen=pen; |
|
156 | m_pen=pen; | |
157 | } |
|
157 | } | |
158 |
|
158 | |||
159 | /*! |
|
159 | /*! | |
160 | Sets if data points are \a visible and should be drawn on line. |
|
160 | Sets if data points are \a visible and should be drawn on line. | |
161 | */ |
|
161 | */ | |
162 | void QLineChartSeries::setPointsVisible(bool visible) |
|
162 | void QLineChartSeries::setPointsVisible(bool visible) | |
163 | { |
|
163 | { | |
164 | m_pointsVisible=visible; |
|
164 | m_pointsVisible=visible; | |
165 | } |
|
165 | } | |
166 |
|
166 | |||
167 | QDebug operator<< (QDebug debug, const QLineChartSeries series) |
|
167 | QDebug operator<< (QDebug debug, const QLineChartSeries series) | |
168 | { |
|
168 | { | |
169 | Q_ASSERT(series.m_x.size() == series.m_y.size()); |
|
169 | Q_ASSERT(series.m_x.size() == series.m_y.size()); | |
170 |
|
170 | |||
171 | int size = series.m_x.size(); |
|
171 | int size = series.m_x.size(); | |
172 |
|
172 | |||
173 | for (int i=0;i<size;i++) { |
|
173 | for (int i=0;i<size;i++) { | |
174 | debug.nospace() << "(" << series.m_x.at(i) << ','<< series.m_y.at(i) << ") "; |
|
174 | debug.nospace() << "(" << series.m_x.at(i) << ','<< series.m_y.at(i) << ") "; | |
175 | } |
|
175 | } | |
176 | return debug.space(); |
|
176 | return debug.space(); | |
177 | } |
|
177 | } | |
178 |
|
178 | |||
179 |
|
179 | |||
180 | #include "moc_qlinechartseries.cpp" |
|
180 | #include "moc_qlinechartseries.cpp" | |
181 |
|
181 | |||
182 | QTCOMMERCIALCHART_END_NAMESPACE |
|
182 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,296 +1,353 | |||||
1 | #include "qchartaxis.h" |
|
1 | #include "qchartaxis.h" | |
2 |
|
2 | |||
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
4 |
|
4 | |||
5 | /*! |
|
5 | /*! | |
6 | \class QChartAxis |
|
6 | \class QChartAxis | |
7 | \brief The QChartAxis class is used for manipulating chart's axis |
|
7 | \brief The QChartAxis class is used for manipulating chart's axis | |
8 | and for adding optional axes to the chart. |
|
8 | and for adding optional axes to the chart. | |
9 | \mainclass |
|
9 | \mainclass | |
10 |
|
10 | |||
11 | There is only one x Axis, however there can be multiple y axes. |
|
11 | There is only one x Axis, however there can be multiple y axes. | |
12 | Each chart series can be bound to exactly one Y axis and the share common X axis. |
|
12 | Each chart series can be bound to exactly one Y axis and the share common X axis. | |
13 | Axis can be setup to show axis line with ticks, gird lines and shades. |
|
13 | Axis can be setup to show axis line with ticks, gird lines and shades. | |
14 |
|
14 | |||
15 | */ |
|
15 | */ | |
16 |
|
16 | |||
17 | /*! |
|
17 | /*! | |
|
18 | \fn bool QChartAxis::isAxisVisible() const | |||
|
19 | \brief Returns if axis is visible | |||
|
20 | \sa setAxisVisible() | |||
|
21 | */ | |||
|
22 | ||||
|
23 | /*! | |||
18 | \fn QPen QChartAxis::axisPen() const |
|
24 | \fn QPen QChartAxis::axisPen() const | |
19 | \brief Returns pen used to draw axis and ticks. |
|
25 | \brief Returns pen used to draw axis and ticks. | |
20 | \sa setAxisPen() |
|
26 | \sa setAxisPen() | |
21 | */ |
|
27 | */ | |
22 |
|
28 | |||
|
29 | ||||
|
30 | /*! | |||
|
31 | \fn bool QChartAxis::isGridVisible() const | |||
|
32 | \brief Returns if grid is visible | |||
|
33 | \sa setGridVisible() | |||
|
34 | */ | |||
|
35 | ||||
23 | /*! |
|
36 | /*! | |
24 | \fn QPen QChartAxis::gridPen() const |
|
37 | \fn QPen QChartAxis::gridPen() const | |
25 | \brief Returns pen used to draw grid. |
|
38 | \brief Returns pen used to draw grid. | |
26 | \sa setGridPen() |
|
39 | \sa setGridPen() | |
27 | */ |
|
40 | */ | |
28 |
|
41 | |||
29 | /*! |
|
42 | /*! | |
|
43 | \fn bool QChartAxis::isLabelsVisible() const | |||
|
44 | \brief Returns if grid is visible | |||
|
45 | \sa setLabelsVisible() | |||
|
46 | */ | |||
|
47 | ||||
|
48 | /*! | |||
30 | \fn QPen QChartAxis::labelsPen() const |
|
49 | \fn QPen QChartAxis::labelsPen() const | |
31 |
\brief |
|
50 | \brief Returns the pen used to labels. | |
32 | \sa setLabelsPen() |
|
51 | \sa setLabelsPen() | |
33 | */ |
|
52 | */ | |
34 |
|
53 | |||
35 | /*! |
|
54 | /*! | |
36 | \fn QBrush QChartAxis::labelsBrush() const |
|
55 | \fn QBrush QChartAxis::labelsBrush() const | |
37 |
\brief |
|
56 | \brief Returns brush used to draw labels. | |
38 | \sa setLabelsBrush() |
|
57 | \sa setLabelsBrush() | |
39 | */ |
|
58 | */ | |
40 |
|
59 | |||
41 | /*! |
|
60 | /*! | |
42 | \fn QFont QChartAxis::labelsFont() const |
|
61 | \fn QFont QChartAxis::labelsFont() const | |
43 |
\brief |
|
62 | \brief Returns font used to draw labels. | |
44 | \sa setLabelsFont() |
|
63 | \sa setLabelsFont() | |
45 | */ |
|
64 | */ | |
46 |
|
65 | |||
47 | /*! |
|
66 | /*! | |
48 | \fn QFont QChartAxis::labelsAngle() const |
|
67 | \fn QFont QChartAxis::labelsAngle() const | |
49 |
\brief |
|
68 | \brief Returns angle used to draw labels. | |
50 | \sa setLabelsAngle() |
|
69 | \sa setLabelsAngle() | |
51 | */ |
|
70 | */ | |
52 |
|
71 | |||
53 | /*! |
|
72 | /*! | |
|
73 | \fn bool QChartAxis::isShadesVisible() const | |||
|
74 | \brief Returns if shades are visible. | |||
|
75 | \sa setShadesVisible() | |||
|
76 | */ | |||
|
77 | ||||
|
78 | /*! | |||
|
79 | \fn qreal QChartAxis::shadesOpacity() const | |||
|
80 | \brief Returns opacity of shades. | |||
|
81 | */ | |||
|
82 | ||||
|
83 | /*! | |||
54 | \fn QPen QChartAxis::shadesPen() const |
|
84 | \fn QPen QChartAxis::shadesPen() const | |
55 |
\brief |
|
85 | \brief Returns pen used to draw shades. | |
56 | \sa setShadesPen() |
|
86 | \sa setShadesPen() | |
57 | */ |
|
87 | */ | |
58 |
|
88 | |||
59 | /*! |
|
89 | /*! | |
60 | \fn QBrush QChartAxis::shadesBrush() const |
|
90 | \fn QBrush QChartAxis::shadesBrush() const | |
61 |
\brief |
|
91 | \brief Returns brush used to draw shades. | |
62 | \sa setShadesBrush() |
|
92 | \sa setShadesBrush() | |
63 | */ |
|
93 | */ | |
64 |
|
94 | |||
65 | /*! |
|
95 | /*! | |
|
96 | \fn qreal QChartAxis::min() const | |||
|
97 | \brief Returns minimum value on the axis. | |||
|
98 | \sa setMin() | |||
|
99 | */ | |||
|
100 | ||||
|
101 | /*! | |||
|
102 | \fn qreal QChartAxis::max() const | |||
|
103 | \brief Returns maximim value on the axis. | |||
|
104 | \sa setMax() | |||
|
105 | */ | |||
|
106 | ||||
|
107 | /*! | |||
|
108 | \fn void QChartAxis::minChanged(qreal min) | |||
|
109 | \brief Axis emits signal when \a min of axis has changed. | |||
|
110 | */ | |||
|
111 | ||||
|
112 | /*! | |||
|
113 | \fn void QChartAxis::maxChanged(qreal max) | |||
|
114 | \brief Axis emits signal when \a max of axis has changed. | |||
|
115 | */ | |||
|
116 | /*! | |||
|
117 | \fn int QChartAxis::ticksCount() const | |||
|
118 | \brief Return number of ticks on the axis | |||
|
119 | \sa setTicksCount() | |||
|
120 | */ | |||
|
121 | ||||
|
122 | /*! | |||
66 | \fn void QChartAxis::update(QChartAxis*) |
|
123 | \fn void QChartAxis::update(QChartAxis*) | |
67 | \brief \internal |
|
124 | \brief \internal | |
68 | */ |
|
125 | */ | |
69 |
|
126 | |||
70 | /*! |
|
127 | /*! | |
71 | \fn void QChartAxis::ticksChanged(QChartAxis*) |
|
128 | \fn void QChartAxis::ticksChanged(QChartAxis*) | |
72 | \brief \internal |
|
129 | \brief \internal | |
73 | */ |
|
130 | */ | |
74 |
|
131 | |||
75 | /*! |
|
132 | /*! | |
76 | Constructs new axis object which is a child of \a parent. Ownership is taken by |
|
133 | Constructs new axis object which is a child of \a parent. Ownership is taken by | |
77 | QChatView or QChart when axis added. |
|
134 | QChatView or QChart when axis added. | |
78 | */ |
|
135 | */ | |
79 |
|
136 | |||
80 | QChartAxis::QChartAxis(QObject* parent):QObject(parent), |
|
137 | QChartAxis::QChartAxis(QObject* parent):QObject(parent), | |
81 | m_axisVisible(true), |
|
138 | m_axisVisible(true), | |
82 | m_gridVisible(true), |
|
139 | m_gridVisible(true), | |
83 | m_labelsVisible(true), |
|
140 | m_labelsVisible(true), | |
84 | m_labelsAngle(0), |
|
141 | m_labelsAngle(0), | |
85 | m_shadesVisible(true), |
|
142 | m_shadesVisible(true), | |
86 | m_shadesOpacity(1.0), |
|
143 | m_shadesOpacity(1.0), | |
87 | m_min(0), |
|
144 | m_min(0), | |
88 | m_max(0), |
|
145 | m_max(0), | |
89 | m_ticksCount(5) |
|
146 | m_ticksCount(5) | |
90 | { |
|
147 | { | |
91 |
|
148 | |||
92 | } |
|
149 | } | |
93 |
|
150 | |||
94 | /*! |
|
151 | /*! | |
95 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. |
|
152 | Destructor of the axis object. When axis is added to chart, chart object takes ownership. | |
96 | */ |
|
153 | */ | |
97 |
|
154 | |||
98 | QChartAxis::~QChartAxis() |
|
155 | QChartAxis::~QChartAxis() | |
99 | { |
|
156 | { | |
100 | } |
|
157 | } | |
101 |
|
158 | |||
102 | /*! |
|
159 | /*! | |
103 | Sets \a pen used to draw axis line and ticks. |
|
160 | Sets \a pen used to draw axis line and ticks. | |
104 | */ |
|
161 | */ | |
105 | void QChartAxis::setAxisPen(const QPen& pen) |
|
162 | void QChartAxis::setAxisPen(const QPen& pen) | |
106 | { |
|
163 | { | |
107 | m_axisPen=pen; |
|
164 | m_axisPen=pen; | |
108 | emit update(this); |
|
165 | emit update(this); | |
109 | } |
|
166 | } | |
110 |
|
167 | |||
111 | /*! |
|
168 | /*! | |
112 | Sets if axis and ticks are \a visible. |
|
169 | Sets if axis and ticks are \a visible. | |
113 | */ |
|
170 | */ | |
114 | void QChartAxis::setAxisVisible(bool visible) |
|
171 | void QChartAxis::setAxisVisible(bool visible) | |
115 | { |
|
172 | { | |
116 | m_axisVisible=visible; |
|
173 | m_axisVisible=visible; | |
117 | emit update(this); |
|
174 | emit update(this); | |
118 | } |
|
175 | } | |
119 |
|
176 | |||
120 | /*! |
|
177 | /*! | |
121 | Sets if grid is \a visible. |
|
178 | Sets if grid is \a visible. | |
122 | */ |
|
179 | */ | |
123 | void QChartAxis::setGridVisible(bool visible) |
|
180 | void QChartAxis::setGridVisible(bool visible) | |
124 | { |
|
181 | { | |
125 | m_gridVisible=visible; |
|
182 | m_gridVisible=visible; | |
126 | emit update(this); |
|
183 | emit update(this); | |
127 | } |
|
184 | } | |
128 |
|
185 | |||
129 | /*! |
|
186 | /*! | |
130 | Sets \a pen used to draw grid. |
|
187 | Sets \a pen used to draw grid. | |
131 | */ |
|
188 | */ | |
132 | void QChartAxis::setGridPen(const QPen& pen) |
|
189 | void QChartAxis::setGridPen(const QPen& pen) | |
133 | { |
|
190 | { | |
134 | m_gridPen=pen; |
|
191 | m_gridPen=pen; | |
135 | emit update(this); |
|
192 | emit update(this); | |
136 | } |
|
193 | } | |
137 |
|
194 | |||
138 | /*! |
|
195 | /*! | |
139 | Sets if axis' labels are \a visible. |
|
196 | Sets if axis' labels are \a visible. | |
140 | */ |
|
197 | */ | |
141 | void QChartAxis::setLabelsVisible(bool visible) |
|
198 | void QChartAxis::setLabelsVisible(bool visible) | |
142 | { |
|
199 | { | |
143 | m_labelsVisible=visible; |
|
200 | m_labelsVisible=visible; | |
144 | emit update(this); |
|
201 | emit update(this); | |
145 | } |
|
202 | } | |
146 |
|
203 | |||
147 | /*! |
|
204 | /*! | |
148 | Sets \a pen used to draw labels. |
|
205 | Sets \a pen used to draw labels. | |
149 | */ |
|
206 | */ | |
150 | void QChartAxis::setLabelsPen(const QPen& pen) |
|
207 | void QChartAxis::setLabelsPen(const QPen& pen) | |
151 | { |
|
208 | { | |
152 | m_labelsPen=pen; |
|
209 | m_labelsPen=pen; | |
153 | emit update(this); |
|
210 | emit update(this); | |
154 | } |
|
211 | } | |
155 |
|
212 | |||
156 | /*! |
|
213 | /*! | |
157 | Sets \a brush used to draw labels. |
|
214 | Sets \a brush used to draw labels. | |
158 | */ |
|
215 | */ | |
159 | void QChartAxis::setLabelsBrush(const QBrush& brush) |
|
216 | void QChartAxis::setLabelsBrush(const QBrush& brush) | |
160 | { |
|
217 | { | |
161 | m_labelsBrush=brush; |
|
218 | m_labelsBrush=brush; | |
162 | emit update(this); |
|
219 | emit update(this); | |
163 | } |
|
220 | } | |
164 |
|
221 | |||
165 | /*! |
|
222 | /*! | |
166 | Sets \a font used to draw labels. |
|
223 | Sets \a font used to draw labels. | |
167 | */ |
|
224 | */ | |
168 | void QChartAxis::setLabelsFont(const QFont& font) |
|
225 | void QChartAxis::setLabelsFont(const QFont& font) | |
169 | { |
|
226 | { | |
170 | m_labelsFont=font; |
|
227 | m_labelsFont=font; | |
171 | emit update(this); |
|
228 | emit update(this); | |
172 | } |
|
229 | } | |
173 |
|
230 | |||
174 | /*! |
|
231 | /*! | |
175 | Sets \a angle for all the labels on given axis. |
|
232 | Sets \a angle for all the labels on given axis. | |
176 | */ |
|
233 | */ | |
177 | void QChartAxis::setLabelsAngle(int angle) |
|
234 | void QChartAxis::setLabelsAngle(int angle) | |
178 | { |
|
235 | { | |
179 | m_labelsAngle=angle; |
|
236 | m_labelsAngle=angle; | |
180 | emit update(this); |
|
237 | emit update(this); | |
181 | } |
|
238 | } | |
182 |
|
239 | |||
183 | /*! |
|
240 | /*! | |
184 | Sets if shades are \a visible. |
|
241 | Sets if shades are \a visible. | |
185 | */ |
|
242 | */ | |
186 | void QChartAxis::setShadesVisible(bool visible) |
|
243 | void QChartAxis::setShadesVisible(bool visible) | |
187 | { |
|
244 | { | |
188 | m_shadesVisible=visible; |
|
245 | m_shadesVisible=visible; | |
189 | emit update(this); |
|
246 | emit update(this); | |
190 | } |
|
247 | } | |
191 |
|
248 | |||
192 | /*! |
|
249 | /*! | |
193 | Sets \a pen used to draw shades. |
|
250 | Sets \a pen used to draw shades. | |
194 | */ |
|
251 | */ | |
195 | void QChartAxis::setShadesPen(const QPen& pen) |
|
252 | void QChartAxis::setShadesPen(const QPen& pen) | |
196 | { |
|
253 | { | |
197 | m_shadesPen=pen; |
|
254 | m_shadesPen=pen; | |
198 | emit update(this); |
|
255 | emit update(this); | |
199 | } |
|
256 | } | |
200 |
|
257 | |||
201 | /*! |
|
258 | /*! | |
202 | Sets \a brush used to draw shades. |
|
259 | Sets \a brush used to draw shades. | |
203 | */ |
|
260 | */ | |
204 | void QChartAxis::setShadesBrush(const QBrush& brush) |
|
261 | void QChartAxis::setShadesBrush(const QBrush& brush) | |
205 | { |
|
262 | { | |
206 | m_shadesBrush=brush; |
|
263 | m_shadesBrush=brush; | |
207 | emit update(this); |
|
264 | emit update(this); | |
208 | } |
|
265 | } | |
209 |
|
266 | |||
210 | /*! |
|
267 | /*! | |
211 | Sets \a opacity of the shades. |
|
268 | Sets \a opacity of the shades. | |
212 | */ |
|
269 | */ | |
213 | void QChartAxis::setShadesOpacity(qreal opacity) |
|
270 | void QChartAxis::setShadesOpacity(qreal opacity) | |
214 | { |
|
271 | { | |
215 | m_shadesOpacity=opacity; |
|
272 | m_shadesOpacity=opacity; | |
216 | emit update(this); |
|
273 | emit update(this); | |
217 | } |
|
274 | } | |
218 |
|
275 | |||
219 | /*! |
|
276 | /*! | |
220 | Sets \a min value on the axis. |
|
277 | Sets \a min value on the axis. | |
221 | */ |
|
278 | */ | |
222 | void QChartAxis::setMin(qreal min) |
|
279 | void QChartAxis::setMin(qreal min) | |
223 | { |
|
280 | { | |
224 | if(m_min!=min){ |
|
281 | if(m_min!=min){ | |
225 | m_min=min; |
|
282 | m_min=min; | |
226 | emit minChanged(m_min); |
|
283 | emit minChanged(m_min); | |
227 | } |
|
284 | } | |
228 | } |
|
285 | } | |
229 |
|
286 | |||
230 | /*! |
|
287 | /*! | |
231 | Sets \a max value on the axis. |
|
288 | Sets \a max value on the axis. | |
232 | */ |
|
289 | */ | |
233 | void QChartAxis::setMax(qreal max) |
|
290 | void QChartAxis::setMax(qreal max) | |
234 | { |
|
291 | { | |
235 | if(m_max!=max){ |
|
292 | if(m_max!=max){ | |
236 | m_max=max; |
|
293 | m_max=max; | |
237 | emit maxChanged(m_max); |
|
294 | emit maxChanged(m_max); | |
238 | } |
|
295 | } | |
239 | } |
|
296 | } | |
240 |
|
297 | |||
241 | /*! |
|
298 | /*! | |
242 | Sets range from \a min to \a max on the axis. |
|
299 | Sets range from \a min to \a max on the axis. | |
243 | */ |
|
300 | */ | |
244 | void QChartAxis::setRange(qreal min, qreal max) |
|
301 | void QChartAxis::setRange(qreal min, qreal max) | |
245 | { |
|
302 | { | |
246 | setMin(min); |
|
303 | setMin(min); | |
247 | setMax(max); |
|
304 | setMax(max); | |
248 | } |
|
305 | } | |
249 |
|
306 | |||
250 | /*! |
|
307 | /*! | |
251 | Sets \a count for ticks on the axis. |
|
308 | Sets \a count for ticks on the axis. | |
252 | */ |
|
309 | */ | |
253 | void QChartAxis::setTicksCount(int count) |
|
310 | void QChartAxis::setTicksCount(int count) | |
254 | { |
|
311 | { | |
255 | m_ticksCount=count; |
|
312 | m_ticksCount=count; | |
256 | emit ticksChanged(this); |
|
313 | emit ticksChanged(this); | |
257 | } |
|
314 | } | |
258 |
|
315 | |||
259 | /*! |
|
316 | /*! | |
260 | TODO: refactor me. Sets string \a label for \a value on the axis. |
|
317 | TODO: refactor me. Sets string \a label for \a value on the axis. | |
261 | */ |
|
318 | */ | |
262 | void QChartAxis::addAxisTickLabel(qreal value,const QString& label) |
|
319 | void QChartAxis::addAxisTickLabel(qreal value,const QString& label) | |
263 | { |
|
320 | { | |
264 | m_ticks.insert(value,label); |
|
321 | m_ticks.insert(value,label); | |
265 | emit ticksChanged(this); |
|
322 | emit ticksChanged(this); | |
266 | } |
|
323 | } | |
267 |
|
324 | |||
268 | /*! |
|
325 | /*! | |
269 | TODO: refactor me. Removes label for \a value on the axis. |
|
326 | TODO: refactor me. Removes label for \a value on the axis. | |
270 | */ |
|
327 | */ | |
271 | void QChartAxis::removeAxisTickLabel(qreal value) |
|
328 | void QChartAxis::removeAxisTickLabel(qreal value) | |
272 | { |
|
329 | { | |
273 | m_ticks.remove(value); |
|
330 | m_ticks.remove(value); | |
274 | emit ticksChanged(this); |
|
331 | emit ticksChanged(this); | |
275 | } |
|
332 | } | |
276 |
|
333 | |||
277 | /*! |
|
334 | /*! | |
278 | TODO: refactor me. Returns label for \a value on the axis. |
|
335 | TODO: refactor me. Returns label for \a value on the axis. | |
279 | */ |
|
336 | */ | |
280 | QString QChartAxis::axisTickLabel(qreal value) const |
|
337 | QString QChartAxis::axisTickLabel(qreal value) const | |
281 | { |
|
338 | { | |
282 | return m_ticks.value(value); |
|
339 | return m_ticks.value(value); | |
283 | } |
|
340 | } | |
284 |
|
341 | |||
285 | /*! |
|
342 | /*! | |
286 | TODO: refactor me. Removes all the string labels for on the axis. |
|
343 | TODO: refactor me. Removes all the string labels for on the axis. | |
287 | */ |
|
344 | */ | |
288 | void QChartAxis::clearAxisTickLabels() |
|
345 | void QChartAxis::clearAxisTickLabels() | |
289 | { |
|
346 | { | |
290 | m_ticks.clear(); |
|
347 | m_ticks.clear(); | |
291 | emit ticksChanged(this); |
|
348 | emit ticksChanged(this); | |
292 | } |
|
349 | } | |
293 |
|
350 | |||
294 | #include "moc_qchartaxis.cpp" |
|
351 | #include "moc_qchartaxis.cpp" | |
295 |
|
352 | |||
296 | QTCOMMERCIALCHART_END_NAMESPACE |
|
353 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now