@@ -10,7 +10,7 static int label_padding = 5; | |||||
10 |
|
10 | |||
11 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
12 |
|
12 | |||
13 |
Axis::Axis(QChartAxis* |
|
13 | Axis::Axis(QChartAxis *axis,ChartPresenter *presenter,AxisType type) : Chart(presenter), | |
14 | m_chartAxis(axis), |
|
14 | m_chartAxis(axis), | |
15 | m_type(type), |
|
15 | m_type(type), | |
16 | m_labelsAngle(0), |
|
16 | m_labelsAngle(0), | |
@@ -42,13 +42,13 Axis::~Axis() | |||||
42 | void Axis::createItems(int count) |
|
42 | void Axis::createItems(int count) | |
43 | { |
|
43 | { | |
44 |
|
44 | |||
45 | if (m_axis.children().size()==0) |
|
45 | if (m_axis.children().size() == 0) | |
46 | m_axis.addToGroup(new AxisItem(this)); |
|
46 | m_axis.addToGroup(new AxisItem(this)); | |
47 | for (int i = 0; i < count; ++i) { |
|
47 | for (int i = 0; i < count; ++i) { | |
48 | m_grid.addToGroup(new QGraphicsLineItem()); |
|
48 | m_grid.addToGroup(new QGraphicsLineItem()); | |
49 | m_labels.addToGroup(new QGraphicsSimpleTextItem()); |
|
49 | m_labels.addToGroup(new QGraphicsSimpleTextItem()); | |
50 | m_axis.addToGroup(new QGraphicsLineItem()); |
|
50 | m_axis.addToGroup(new QGraphicsLineItem()); | |
51 | if((m_grid.childItems().size())%2 && m_grid.childItems().size()>2) m_shades.addToGroup(new QGraphicsRectItem()); |
|
51 | if ((m_grid.childItems().size())%2 && m_grid.childItems().size()>2) m_shades.addToGroup(new QGraphicsRectItem()); | |
52 | } |
|
52 | } | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
@@ -67,7 +67,7 void Axis::deleteItems(int count) | |||||
67 | } |
|
67 | } | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
void Axis::updateLayout(QVector<qreal>& |
|
70 | void Axis::updateLayout(QVector<qreal> &layout) | |
71 | { |
|
71 | { | |
72 | if (animator()) { |
|
72 | if (animator()) { | |
73 | animator()->updateLayout(this,layout); |
|
73 | animator()->updateLayout(this,layout); | |
@@ -76,7 +76,7 void Axis::updateLayout(QVector<qreal>& layout) | |||||
76 | } |
|
76 | } | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 |
bool Axis::createLabels(QStringList& |
|
79 | bool Axis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) const | |
80 | { |
|
80 | { | |
81 | Q_ASSERT(max>=min); |
|
81 | Q_ASSERT(max>=min); | |
82 | Q_ASSERT(ticks>1); |
|
82 | Q_ASSERT(ticks>1); | |
@@ -87,7 +87,7 bool Axis::createLabels(QStringList& labels,qreal min, qreal max,int ticks) cons | |||||
87 |
|
87 | |||
88 | if (!category) { |
|
88 | if (!category) { | |
89 | int n = qMax(int(-floor(log10((max-min)/(ticks-1)))),0); |
|
89 | int n = qMax(int(-floor(log10((max-min)/(ticks-1)))),0); | |
90 | for(int i=0; i< ticks; i++) { |
|
90 | for (int i=0; i< ticks; i++) { | |
91 | qreal value = min + (i * (max - min)/ (ticks-1)); |
|
91 | qreal value = min + (i * (max - min)/ (ticks-1)); | |
92 | labels << QString::number(value,'f',n); |
|
92 | labels << QString::number(value,'f',n); | |
93 | } |
|
93 | } | |
@@ -239,18 +239,17 QVector<qreal> Axis::calculateLayout() const | |||||
239 | return points; |
|
239 | return points; | |
240 | } |
|
240 | } | |
241 |
|
241 | |||
242 |
void Axis::setLayout(QVector<qreal>& |
|
242 | void Axis::setLayout(QVector<qreal> &layout) | |
243 | { |
|
243 | { | |
244 | int diff = m_layoutVector.size() - layout.size(); |
|
244 | int diff = m_layoutVector.size() - layout.size(); | |
245 |
|
245 | |||
246 | if (diff>0) { |
|
246 | if (diff>0) { | |
247 | deleteItems(diff); |
|
247 | deleteItems(diff); | |
248 | } |
|
248 | } else if (diff<0) { | |
249 | else if(diff<0) { |
|
|||
250 | createItems(-diff); |
|
249 | createItems(-diff); | |
251 | } |
|
250 | } | |
252 |
|
251 | |||
253 |
|
|
252 | if( diff!=0) handleAxisUpdated(); | |
254 |
|
253 | |||
255 | QStringList ticksList; |
|
254 | QStringList ticksList; | |
256 |
|
255 | |||
@@ -275,19 +274,19 void Axis::setLayout(QVector<qreal>& layout) | |||||
275 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
|
274 | QGraphicsLineItem *lineItem = static_cast<QGraphicsLineItem*>(lines.at(i)); | |
276 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); |
|
275 | lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); | |
277 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
276 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); | |
278 | if(!categories){ |
|
277 | if (!categories) { | |
279 | labelItem->setText(ticksList.at(i)); |
|
278 | labelItem->setText(ticksList.at(i)); | |
280 | QPointF center = labelItem->boundingRect().center(); |
|
279 | QPointF center = labelItem->boundingRect().center(); | |
281 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
280 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
282 | labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); |
|
281 | labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); | |
283 | }else if(i>0){ |
|
282 | } else if(i>0) { | |
284 | labelItem->setText(ticksList.at(i)); |
|
283 | labelItem->setText(ticksList.at(i)); | |
285 | QPointF center = labelItem->boundingRect().center(); |
|
284 | QPointF center = labelItem->boundingRect().center(); | |
286 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
285 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
287 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); |
|
286 | labelItem->setPos(layout[i] - (layout[i] - layout[i-1])/2 - center.x(), m_rect.bottom() + label_padding); | |
288 | } |
|
287 | } | |
289 |
|
288 | |||
290 |
|
|
289 | if ((i+1)%2 && i>1) { | |
291 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); |
|
290 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); | |
292 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); |
|
291 | rectItem->setRect(layout[i-1],m_rect.top(),layout[i]-layout[i-1],m_rect.height()); | |
293 | } |
|
292 | } | |
@@ -307,19 +306,19 void Axis::setLayout(QVector<qreal>& layout) | |||||
307 | lineItem->setLine(m_rect.left() , layout[i], m_rect.right(), layout[i]); |
|
306 | lineItem->setLine(m_rect.left() , layout[i], m_rect.right(), layout[i]); | |
308 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); |
|
307 | QGraphicsSimpleTextItem *labelItem = static_cast<QGraphicsSimpleTextItem*>(labels.at(i)); | |
309 |
|
308 | |||
310 | if(!categories){ |
|
309 | if (!categories) { | |
311 | labelItem->setText(ticksList.at(i)); |
|
310 | labelItem->setText(ticksList.at(i)); | |
312 | QPointF center = labelItem->boundingRect().center(); |
|
311 | QPointF center = labelItem->boundingRect().center(); | |
313 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
312 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
314 | labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i]-center.y()); |
|
313 | labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i]-center.y()); | |
315 | } else if(i>0){ |
|
314 | } else if (i>0) { | |
316 | labelItem->setText(ticksList.at(i)); |
|
315 | labelItem->setText(ticksList.at(i)); | |
317 | QPointF center = labelItem->boundingRect().center(); |
|
316 | QPointF center = labelItem->boundingRect().center(); | |
318 | labelItem->setTransformOriginPoint(center.x(), center.y()); |
|
317 | labelItem->setTransformOriginPoint(center.x(), center.y()); | |
319 | labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i] - (layout[i] - layout[i-1])/2 -center.y()); |
|
318 | labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i] - (layout[i] - layout[i-1])/2 -center.y()); | |
320 | } |
|
319 | } | |
321 |
|
320 | |||
322 |
|
|
321 | if ((i+1)%2 && i>1) { | |
323 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); |
|
322 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem*>(shades.at(i/2-1)); | |
324 | rectItem->setRect(m_rect.left(),layout[i],m_rect.width(),layout[i-1]-layout[i]); |
|
323 | rectItem->setRect(m_rect.left(),layout[i],m_rect.width(),layout[i-1]-layout[i]); | |
325 | } |
|
324 | } | |
@@ -329,7 +328,7 void Axis::setLayout(QVector<qreal>& layout) | |||||
329 | } |
|
328 | } | |
330 | break; |
|
329 | break; | |
331 | default: |
|
330 | default: | |
332 |
|
|
331 | qDebug()<<"Unknown axis type"; | |
333 | break; |
|
332 | break; | |
334 | } |
|
333 | } | |
335 |
|
334 | |||
@@ -345,7 +344,7 bool Axis::isEmpty() | |||||
345 |
|
344 | |||
346 | void Axis::handleAxisCategoriesUpdated() |
|
345 | void Axis::handleAxisCategoriesUpdated() | |
347 | { |
|
346 | { | |
348 |
|
|
347 | if (isEmpty()) return; | |
349 | updateLayout(m_layoutVector); |
|
348 | updateLayout(m_layoutVector); | |
350 | } |
|
349 | } | |
351 |
|
350 | |||
@@ -360,13 +359,13 void Axis::handleAxisUpdated() | |||||
360 | setAxisOpacity(0); |
|
359 | setAxisOpacity(0); | |
361 | } |
|
360 | } | |
362 |
|
361 | |||
363 | if(m_chartAxis->isGridLineVisible()) { |
|
362 | if (m_chartAxis->isGridLineVisible()) { | |
364 | setGridOpacity(100); |
|
363 | setGridOpacity(100); | |
365 | } else { |
|
364 | } else { | |
366 | setGridOpacity(0); |
|
365 | setGridOpacity(0); | |
367 | } |
|
366 | } | |
368 |
|
367 | |||
369 | if(m_chartAxis->labelsVisible()) { |
|
368 | if (m_chartAxis->labelsVisible()) { | |
370 | setLabelsOpacity(100); |
|
369 | setLabelsOpacity(100); | |
371 | } else { |
|
370 | } else { | |
372 | setLabelsOpacity(0); |
|
371 | setLabelsOpacity(0); | |
@@ -391,7 +390,7 void Axis::handleAxisUpdated() | |||||
391 |
|
390 | |||
392 | void Axis::handleRangeChanged(qreal min, qreal max,int tickCount) |
|
391 | void Axis::handleRangeChanged(qreal min, qreal max,int tickCount) | |
393 | { |
|
392 | { | |
394 | if(min==max || tickCount<2) return; |
|
393 | if (min==max || tickCount<2) return; | |
395 |
|
394 | |||
396 | m_min = min; |
|
395 | m_min = min; | |
397 | m_max = max; |
|
396 | m_max = max; | |
@@ -403,7 +402,7 void Axis::handleRangeChanged(qreal min, qreal max,int tickCount) | |||||
403 |
|
402 | |||
404 | } |
|
403 | } | |
405 |
|
404 | |||
406 |
void Axis::handleGeometryChanged(const QRectF& |
|
405 | void Axis::handleGeometryChanged(const QRectF &rect) | |
407 | { |
|
406 | { | |
408 | m_rect = rect; |
|
407 | m_rect = rect; | |
409 | if (isEmpty()) return; |
|
408 | if (isEmpty()) return; |
@@ -140,17 +140,17 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
140 | QChatView or QChart when axis added. |
|
140 | QChatView or QChart when axis added. | |
141 | */ |
|
141 | */ | |
142 |
|
142 | |||
143 |
QChartAxis::QChartAxis(QObject* |
|
143 | QChartAxis::QChartAxis(QObject *parent) : QObject(parent), | |
144 | m_axisVisible(true), |
|
144 | m_axisVisible(true), | |
145 | m_gridLineVisible(true), |
|
145 | m_gridLineVisible(true), | |
146 | m_labelsVisible(true), |
|
146 | m_labelsVisible(true), | |
147 | m_labelsAngle(0), |
|
147 | m_labelsAngle(0), | |
148 | m_shadesVisible(false), |
|
148 | m_shadesVisible(false), | |
149 | m_shadesOpacity(1.0), |
|
149 | m_shadesOpacity(1.0), | |
150 | m_min(0), |
|
150 | m_min(0), | |
151 | m_max(0), |
|
151 | m_max(0), | |
152 | m_ticksCount(5), |
|
152 | m_ticksCount(5), | |
153 | m_niceNumbers(false) |
|
153 | m_niceNumbers(false) | |
154 | { |
|
154 | { | |
155 |
|
155 | |||
156 | } |
|
156 | } | |
@@ -166,11 +166,11 QChartAxis::~QChartAxis() | |||||
166 | /*! |
|
166 | /*! | |
167 | Sets \a pen used to draw axis line and ticks. |
|
167 | Sets \a pen used to draw axis line and ticks. | |
168 | */ |
|
168 | */ | |
169 |
void QChartAxis::setAxisPen(const QPen& |
|
169 | void QChartAxis::setAxisPen(const QPen &pen) | |
170 | { |
|
170 | { | |
171 | if (pen != m_axisPen) { |
|
171 | if (pen != m_axisPen) { | |
172 | m_axisPen=pen; |
|
172 | m_axisPen = pen; | |
173 | emit updated(); |
|
173 | emit updated(); | |
174 | } |
|
174 | } | |
175 | } |
|
175 | } | |
176 |
|
176 | |||
@@ -179,9 +179,9 void QChartAxis::setAxisPen(const QPen& pen) | |||||
179 | */ |
|
179 | */ | |
180 | void QChartAxis::setAxisVisible(bool visible) |
|
180 | void QChartAxis::setAxisVisible(bool visible) | |
181 | { |
|
181 | { | |
182 |
|
|
182 | if (m_axisVisible != visible) { | |
183 | m_axisVisible=visible; |
|
183 | m_axisVisible = visible; | |
184 | emit updated(); |
|
184 | emit updated(); | |
185 | } |
|
185 | } | |
186 | } |
|
186 | } | |
187 |
|
187 | |||
@@ -190,20 +190,20 void QChartAxis::setAxisVisible(bool visible) | |||||
190 | */ |
|
190 | */ | |
191 | void QChartAxis::setGridLineVisible(bool visible) |
|
191 | void QChartAxis::setGridLineVisible(bool visible) | |
192 | { |
|
192 | { | |
193 |
|
|
193 | if (m_gridLineVisible != visible) { | |
194 | m_gridLineVisible=visible; |
|
194 | m_gridLineVisible = visible; | |
195 | emit updated(); |
|
195 | emit updated(); | |
196 | } |
|
196 | } | |
197 | } |
|
197 | } | |
198 |
|
198 | |||
199 | /*! |
|
199 | /*! | |
200 | Sets \a pen used to draw grid line. |
|
200 | Sets \a pen used to draw grid line. | |
201 | */ |
|
201 | */ | |
202 |
void QChartAxis::setGridLinePen(const QPen& |
|
202 | void QChartAxis::setGridLinePen(const QPen &pen) | |
203 | { |
|
203 | { | |
204 |
|
|
204 | if (m_gridLinePen != pen) { | |
205 | m_gridLinePen=pen; |
|
205 | m_gridLinePen = pen; | |
206 | emit updated(); |
|
206 | emit updated(); | |
207 | } |
|
207 | } | |
208 | } |
|
208 | } | |
209 |
|
209 | |||
@@ -212,42 +212,42 void QChartAxis::setGridLinePen(const QPen& pen) | |||||
212 | */ |
|
212 | */ | |
213 | void QChartAxis::setLabelsVisible(bool visible) |
|
213 | void QChartAxis::setLabelsVisible(bool visible) | |
214 | { |
|
214 | { | |
215 |
|
|
215 | if (m_labelsVisible != visible) { | |
216 | m_labelsVisible=visible; |
|
216 | m_labelsVisible = visible; | |
217 | emit updated(); |
|
217 | emit updated(); | |
218 | } |
|
218 | } | |
219 | } |
|
219 | } | |
220 |
|
220 | |||
221 | /*! |
|
221 | /*! | |
222 | Sets \a pen used to draw labels. |
|
222 | Sets \a pen used to draw labels. | |
223 | */ |
|
223 | */ | |
224 |
void QChartAxis::setLabelsPen(const QPen& |
|
224 | void QChartAxis::setLabelsPen(const QPen &pen) | |
225 | { |
|
225 | { | |
226 |
|
|
226 | if (m_labelsPen != pen) { | |
227 | m_labelsPen=pen; |
|
227 | m_labelsPen = pen; | |
228 | emit updated(); |
|
228 | emit updated(); | |
229 | } |
|
229 | } | |
230 | } |
|
230 | } | |
231 |
|
231 | |||
232 | /*! |
|
232 | /*! | |
233 | Sets \a brush used to draw labels. |
|
233 | Sets \a brush used to draw labels. | |
234 | */ |
|
234 | */ | |
235 |
void QChartAxis::setLabelsBrush(const QBrush& |
|
235 | void QChartAxis::setLabelsBrush(const QBrush &brush) | |
236 | { |
|
236 | { | |
237 |
|
|
237 | if (m_labelsBrush != brush) { | |
238 | m_labelsBrush=brush; |
|
238 | m_labelsBrush = brush; | |
239 | emit updated(); |
|
239 | emit updated(); | |
240 | } |
|
240 | } | |
241 | } |
|
241 | } | |
242 |
|
242 | |||
243 | /*! |
|
243 | /*! | |
244 | Sets \a font used to draw labels. |
|
244 | Sets \a font used to draw labels. | |
245 | */ |
|
245 | */ | |
246 |
void QChartAxis::setLabelsFont(const QFont& |
|
246 | void QChartAxis::setLabelsFont(const QFont &font) | |
247 | { |
|
247 | { | |
248 |
|
|
248 | if (m_labelsFont != font) { | |
249 | m_labelsFont=font; |
|
249 | m_labelsFont = font; | |
250 | emit updated(); |
|
250 | emit updated(); | |
251 | } |
|
251 | } | |
252 | } |
|
252 | } | |
253 |
|
253 | |||
@@ -256,9 +256,9 void QChartAxis::setLabelsFont(const QFont& font) | |||||
256 | */ |
|
256 | */ | |
257 | void QChartAxis::setLabelsAngle(int angle) |
|
257 | void QChartAxis::setLabelsAngle(int angle) | |
258 | { |
|
258 | { | |
259 |
|
|
259 | if (m_labelsAngle != angle) { | |
260 |
|
|
260 | m_labelsAngle = angle; | |
261 |
|
|
261 | emit updated(); | |
262 | } |
|
262 | } | |
263 | } |
|
263 | } | |
264 |
|
264 | |||
@@ -267,31 +267,31 void QChartAxis::setLabelsAngle(int angle) | |||||
267 | */ |
|
267 | */ | |
268 | void QChartAxis::setShadesVisible(bool visible) |
|
268 | void QChartAxis::setShadesVisible(bool visible) | |
269 | { |
|
269 | { | |
270 |
|
|
270 | if (m_shadesVisible != visible) { | |
271 | m_shadesVisible=visible; |
|
271 | m_shadesVisible = visible; | |
272 | emit updated(); |
|
272 | emit updated(); | |
273 | } |
|
273 | } | |
274 | } |
|
274 | } | |
275 |
|
275 | |||
276 | /*! |
|
276 | /*! | |
277 | Sets \a pen used to draw shades. |
|
277 | Sets \a pen used to draw shades. | |
278 | */ |
|
278 | */ | |
279 |
void QChartAxis::setShadesPen(const QPen& |
|
279 | void QChartAxis::setShadesPen(const QPen &pen) | |
280 | { |
|
280 | { | |
281 |
|
|
281 | if (m_shadesPen != pen) { | |
282 |
|
|
282 | m_shadesPen = pen; | |
283 |
|
|
283 | emit updated(); | |
284 | } |
|
284 | } | |
285 | } |
|
285 | } | |
286 |
|
286 | |||
287 | /*! |
|
287 | /*! | |
288 | Sets \a brush used to draw shades. |
|
288 | Sets \a brush used to draw shades. | |
289 | */ |
|
289 | */ | |
290 |
void QChartAxis::setShadesBrush(const QBrush& |
|
290 | void QChartAxis::setShadesBrush(const QBrush &brush) | |
291 | { |
|
291 | { | |
292 |
|
|
292 | if (m_shadesBrush != brush) { | |
293 | m_shadesBrush=brush; |
|
293 | m_shadesBrush = brush; | |
294 | emit updated(); |
|
294 | emit updated(); | |
295 | } |
|
295 | } | |
296 | } |
|
296 | } | |
297 |
|
297 | |||
@@ -300,7 +300,7 void QChartAxis::setShadesBrush(const QBrush& brush) | |||||
300 | */ |
|
300 | */ | |
301 | void QChartAxis::setShadesOpacity(qreal opacity) |
|
301 | void QChartAxis::setShadesOpacity(qreal opacity) | |
302 | { |
|
302 | { | |
303 |
|
|
303 | if (m_shadesOpacity != opacity) { | |
304 | m_shadesOpacity=opacity; |
|
304 | m_shadesOpacity=opacity; | |
305 | emit updated(); |
|
305 | emit updated(); | |
306 | } |
|
306 | } | |
@@ -327,22 +327,20 void QChartAxis::setMax(qreal max) | |||||
327 | */ |
|
327 | */ | |
328 | void QChartAxis::setRange(qreal min, qreal max) |
|
328 | void QChartAxis::setRange(qreal min, qreal max) | |
329 | { |
|
329 | { | |
330 |
|
||||
331 |
|
||||
332 | bool changed = false; |
|
330 | bool changed = false; | |
333 | if(m_min!=min) { |
|
331 | if (m_min != min) { | |
334 | m_min=min; |
|
332 | m_min = min; | |
335 | changed=true; |
|
333 | changed = true; | |
336 | emit minChanged(min); |
|
334 | emit minChanged(min); | |
337 | } |
|
335 | } | |
338 |
|
336 | |||
339 | if(m_max!=max) { |
|
337 | if (m_max != max) { | |
340 | m_max=max; |
|
338 | m_max = max; | |
341 | changed=true; |
|
339 | changed = true; | |
342 | emit maxChanged(max); |
|
340 | emit maxChanged(max); | |
343 | } |
|
341 | } | |
344 |
|
342 | |||
345 | if(changed) { |
|
343 | if (changed) { | |
346 | emit rangeChanged(m_min,m_max); |
|
344 | emit rangeChanged(m_min,m_max); | |
347 | emit this->changed(m_min, m_max, m_ticksCount, m_niceNumbers); |
|
345 | emit this->changed(m_min, m_max, m_ticksCount, m_niceNumbers); | |
348 | } |
|
346 | } | |
@@ -353,8 +351,8 void QChartAxis::setRange(qreal min, qreal max) | |||||
353 | */ |
|
351 | */ | |
354 | void QChartAxis::setTicksCount(int count) |
|
352 | void QChartAxis::setTicksCount(int count) | |
355 | { |
|
353 | { | |
356 |
|
|
354 | if (m_ticksCount != count) { | |
357 |
|
|
355 | m_ticksCount = count; | |
358 | emit ticksCountChanged(count); |
|
356 | emit ticksCountChanged(count); | |
359 | emit changed(m_min, m_max, m_ticksCount, m_niceNumbers); |
|
357 | emit changed(m_min, m_max, m_ticksCount, m_niceNumbers); | |
360 | } |
|
358 | } | |
@@ -377,10 +375,10 void QChartAxis::show() | |||||
377 | */ |
|
375 | */ | |
378 | void QChartAxis::hide() |
|
376 | void QChartAxis::hide() | |
379 | { |
|
377 | { | |
380 | m_axisVisible=false; |
|
378 | m_axisVisible = false; | |
381 | m_gridLineVisible=false; |
|
379 | m_gridLineVisible = false; | |
382 | m_labelsVisible=false; |
|
380 | m_labelsVisible = false; | |
383 | m_shadesVisible=false; |
|
381 | m_shadesVisible = false; | |
384 | emit updated(); |
|
382 | emit updated(); | |
385 | } |
|
383 | } | |
386 |
|
384 | |||
@@ -392,8 +390,8 void QChartAxis::handleAxisRangeChanged(qreal min, qreal max,int count) | |||||
392 |
|
390 | |||
393 | void QChartAxis::setNiceNumbers(bool enabled) |
|
391 | void QChartAxis::setNiceNumbers(bool enabled) | |
394 | { |
|
392 | { | |
395 | if(m_niceNumbers!=enabled){ |
|
393 | if (m_niceNumbers != enabled){ | |
396 | m_niceNumbers=enabled; |
|
394 | m_niceNumbers = enabled; | |
397 | emit changed(m_min, m_max, m_ticksCount, m_niceNumbers); |
|
395 | emit changed(m_min, m_max, m_ticksCount, m_niceNumbers); | |
398 | } |
|
396 | } | |
399 | } |
|
397 | } |
@@ -13,10 +13,10 QChartAxisCategories::~QChartAxisCategories() | |||||
13 | // TODO Auto-generated destructor stub |
|
13 | // TODO Auto-generated destructor stub | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 |
void QChartAxisCategories::insert(const QBarCategories& |
|
16 | void QChartAxisCategories::insert(const QBarCategories &categories) | |
17 | { |
|
17 | { | |
18 | int i=1; |
|
18 | int i=1; | |
19 | foreach(QString string , categories){ |
|
19 | foreach (QString string , categories) { | |
20 | m_map.insert(i,string); |
|
20 | m_map.insert(i,string); | |
21 | i++; |
|
21 | i++; | |
22 | } |
|
22 | } |
General Comments 0
You need to be logged in to leave comments.
Login now