@@ -57,6 +57,11 void AxisAnimation::setValues(QVector<qreal> &oldLayout, QVector<qreal> &newLayo | |||||
57 | { |
|
57 | { | |
58 | if (state() != QAbstractAnimation::Stopped) stop(); |
|
58 | if (state() != QAbstractAnimation::Stopped) stop(); | |
59 |
|
59 | |||
|
60 | // TODO: cannot return even if layout is empty | |||
|
61 | // New layout is not set properly without it (crash) | |||
|
62 | // if (newLayout.count() == 0) | |||
|
63 | // return; | |||
|
64 | ||||
60 | switch (m_type) { |
|
65 | switch (m_type) { | |
61 | case ZoomOutAnimation: { |
|
66 | case ZoomOutAnimation: { | |
62 | QRectF rect = m_axis->gridGeometry(); |
|
67 | QRectF rect = m_axis->gridGeometry(); | |
@@ -125,6 +130,7 void AxisAnimation::updateCurrentValue(const QVariant &value) | |||||
125 | { |
|
130 | { | |
126 | if (state() != QAbstractAnimation::Stopped) { //workaround |
|
131 | if (state() != QAbstractAnimation::Stopped) { //workaround | |
127 | QVector<qreal> vector = qvariant_cast<QVector<qreal> >(value); |
|
132 | QVector<qreal> vector = qvariant_cast<QVector<qreal> >(value); | |
|
133 | // Q_ASSERT(vector.count() != 0); | |||
128 | m_axis->setLayout(vector); |
|
134 | m_axis->setLayout(vector); | |
129 | m_axis->updateGeometry(); |
|
135 | m_axis->updateGeometry(); | |
130 | } |
|
136 | } |
@@ -31,8 +31,10 | |||||
31 |
|
31 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
33 | |||
|
34 | //TODO: optimize : remove points which are not visible | |||
|
35 | ||||
34 | AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item) |
|
36 | AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item) | |
35 | : ChartItem(areaSeries->d_func(),item), |
|
37 | : ChartItem(areaSeries->d_func(),item), //TODO: fix me | |
36 | m_series(areaSeries), |
|
38 | m_series(areaSeries), | |
37 | m_upper(0), |
|
39 | m_upper(0), | |
38 | m_lower(0), |
|
40 | m_lower(0), |
@@ -213,7 +213,8 void QAreaSeries::setUpperSeries(QLineSeries *series) | |||||
213 | { |
|
213 | { | |
214 | Q_D(QAreaSeries); |
|
214 | Q_D(QAreaSeries); | |
215 | if(d->m_upperSeries!=series){ |
|
215 | if(d->m_upperSeries!=series){ | |
216 |
d->m_upperSeries = series; |
|
216 | d->m_upperSeries = series; | |
|
217 | //TODO: | |||
217 | } |
|
218 | } | |
218 | } |
|
219 | } | |
219 |
|
220 |
@@ -247,7 +247,8 void QBarCategoryAxis::remove(const QString &category) | |||||
247 | } else if (d->m_maxCategory == category) { |
|
247 | } else if (d->m_maxCategory == category) { | |
248 | setRange(d->m_minCategory, d->m_categories.last()); |
|
248 | setRange(d->m_minCategory, d->m_categories.last()); | |
249 | } else { |
|
249 | } else { | |
250 |
d->updateCategoryDomain(); |
|
250 | d->updateCategoryDomain(); | |
|
251 | //TODO:: d->emitUpdated(); | |||
251 | } |
|
252 | } | |
252 | } else { |
|
253 | } else { | |
253 | setRange(QString::null, QString::null); |
|
254 | setRange(QString::null, QString::null); | |
@@ -280,7 +281,8 void QBarCategoryAxis::insert(int index, const QString &category) | |||||
280 | } else if (index == count) { |
|
281 | } else if (index == count) { | |
281 | setRange(d->m_minCategory, d->m_categories.last()); |
|
282 | setRange(d->m_minCategory, d->m_categories.last()); | |
282 | } else { |
|
283 | } else { | |
283 |
d->updateCategoryDomain(); |
|
284 | d->updateCategoryDomain(); | |
|
285 | //TODO:: d->emitUpdated(); | |||
284 | } |
|
286 | } | |
285 |
|
287 | |||
286 | emit categoriesChanged(); |
|
288 | emit categoriesChanged(); | |
@@ -304,6 +306,8 void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCat | |||||
304 | setRange(newCategory, d->m_maxCategory); |
|
306 | setRange(newCategory, d->m_maxCategory); | |
305 | } else if (d->m_maxCategory == oldCategory) { |
|
307 | } else if (d->m_maxCategory == oldCategory) { | |
306 | setRange(d->m_minCategory, newCategory); |
|
308 | setRange(d->m_minCategory, newCategory); | |
|
309 | } else { | |||
|
310 | //TODO:: d->emitUpdated(); | |||
307 | } |
|
311 | } | |
308 | emit categoriesChanged(); |
|
312 | emit categoriesChanged(); | |
309 | emit countChanged(); |
|
313 | emit countChanged(); |
@@ -66,7 +66,8 QVector<qreal> ChartCategoryAxisX::calculateLayout() const | |||||
66 | } |
|
66 | } | |
67 |
|
67 | |||
68 | void ChartCategoryAxisX::updateGeometry() |
|
68 | void ChartCategoryAxisX::updateGeometry() | |
69 | { |
|
69 | { | |
|
70 | //TODO: this is not optimal when many categories :( , create only visible lables | |||
70 | setLabels(m_axis->categoriesLabels() << ""); |
|
71 | setLabels(m_axis->categoriesLabels() << ""); | |
71 | HorizontalAxis::updateGeometry(); |
|
72 | HorizontalAxis::updateGeometry(); | |
72 | } |
|
73 | } |
@@ -74,7 +74,8 void ChartCategoryAxisY::updateGeometry() | |||||
74 |
|
74 | |||
75 | void ChartCategoryAxisY::handleAxisUpdated() |
|
75 | void ChartCategoryAxisY::handleAxisUpdated() | |
76 | { |
|
76 | { | |
77 |
updateGeometry(); |
|
77 | updateGeometry(); | |
|
78 | //TODO:: ChartAxis::handleAxisUpdated(); | |||
78 | } |
|
79 | } | |
79 |
|
80 | |||
80 | QSizeF ChartCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const |
|
81 | QSizeF ChartCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const |
@@ -226,7 +226,8 void QCategoryAxis::remove(const QString &categoryLabel) | |||||
226 | range.first = d->m_categoriesMap.value(d->m_categories.at(labelIndex - 1)).second; |
|
226 | range.first = d->m_categoriesMap.value(d->m_categories.at(labelIndex - 1)).second; | |
227 | d->m_categoriesMap.insert(label, range); |
|
227 | d->m_categoriesMap.insert(label, range); | |
228 | } |
|
228 | } | |
229 |
} |
|
229 | } | |
|
230 | //TODO:: d->emitUpdated(); | |||
230 | } |
|
231 | } | |
231 | } |
|
232 | } | |
232 |
|
233 | |||
@@ -249,7 +250,8 void QCategoryAxis::replaceLabel(const QString &oldLabel, const QString &newLabe | |||||
249 | d->m_categories.replace(labelIndex, newLabel); |
|
250 | d->m_categories.replace(labelIndex, newLabel); | |
250 | Range range = d->m_categoriesMap.value(oldLabel); |
|
251 | Range range = d->m_categoriesMap.value(oldLabel); | |
251 | d->m_categoriesMap.remove(oldLabel); |
|
252 | d->m_categoriesMap.remove(oldLabel); | |
252 |
d->m_categoriesMap.insert(newLabel, range); |
|
253 | d->m_categoriesMap.insert(newLabel, range); | |
|
254 | //TODO:: d->emitUpdated(); | |||
253 | } |
|
255 | } | |
254 | } |
|
256 | } | |
255 |
|
257 |
@@ -420,6 +420,9 void ChartAxis::handleRangeChanged(qreal min, qreal max) | |||||
420 |
|
420 | |||
421 | QStringList ChartAxis::createValueLabels(qreal min, qreal max, int ticks,const QString& format) |
|
421 | QStringList ChartAxis::createValueLabels(qreal min, qreal max, int ticks,const QString& format) | |
422 | { |
|
422 | { | |
|
423 | //TODO: Q_ASSERT(m_max > m_min); | |||
|
424 | //TODO: Q_ASSERT(ticks > 1); | |||
|
425 | ||||
423 | QStringList labels; |
|
426 | QStringList labels; | |
424 |
|
427 | |||
425 | if(max <= min || ticks < 1){ |
|
428 | if(max <= min || ticks < 1){ | |
@@ -507,6 +510,8 QStringList ChartAxis::createLogValueLabels(qreal min, qreal max, qreal base, in | |||||
507 |
|
510 | |||
508 | QStringList ChartAxis::createDateTimeLabels(qreal min, qreal max,int ticks,const QString& format) |
|
511 | QStringList ChartAxis::createDateTimeLabels(qreal min, qreal max,int ticks,const QString& format) | |
509 | { |
|
512 | { | |
|
513 | //TODO: Q_ASSERT(m_max > m_min); | |||
|
514 | //TODO: Q_ASSERT(ticks > 1); | |||
510 | QStringList labels; |
|
515 | QStringList labels; | |
511 |
|
516 | |||
512 | if(max <= min || ticks < 1) { |
|
517 | if(max <= min || ticks < 1) { |
@@ -468,6 +468,7 QPen QAbstractAxis::linePen() const | |||||
468 | return d_ptr->m_axisPen; |
|
468 | return d_ptr->m_axisPen; | |
469 | } |
|
469 | } | |
470 |
|
470 | |||
|
471 | //TODO: remove me | |||
471 | void QAbstractAxis::setLinePenColor(QColor color) |
|
472 | void QAbstractAxis::setLinePenColor(QColor color) | |
472 | { |
|
473 | { | |
473 | QPen p = d_ptr->m_axisPen; |
|
474 | QPen p = d_ptr->m_axisPen; | |
@@ -613,7 +614,7 int QAbstractAxis::labelsAngle() const | |||||
613 | { |
|
614 | { | |
614 | return d_ptr->m_labelsAngle; |
|
615 | return d_ptr->m_labelsAngle; | |
615 | } |
|
616 | } | |
616 |
|
617 | //TODO: remove me | ||
617 | void QAbstractAxis::setLabelsColor(QColor color) |
|
618 | void QAbstractAxis::setLabelsColor(QColor color) | |
618 | { |
|
619 | { | |
619 | QBrush b = d_ptr->m_labelsBrush; |
|
620 | QBrush b = d_ptr->m_labelsBrush; | |
@@ -862,6 +863,8 void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) | |||||
862 | /*! |
|
863 | /*! | |
863 | Returns the orientation in which the axis is being used (Vertical or Horizontal) |
|
864 | Returns the orientation in which the axis is being used (Vertical or Horizontal) | |
864 | */ |
|
865 | */ | |
|
866 | // NOTE: should have const but it breaks BC: | |||
|
867 | // http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function | |||
865 | Qt::Orientation QAbstractAxis::orientation() |
|
868 | Qt::Orientation QAbstractAxis::orientation() | |
866 | { |
|
869 | { | |
867 | return d_ptr->orientation(); |
|
870 | return d_ptr->orientation(); | |
@@ -928,7 +931,7 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) | |||||
928 | if (forced || brush == m_labelsBrush){ |
|
931 | if (forced || brush == m_labelsBrush){ | |
929 | q_ptr->setLabelsBrush(theme->labelBrush()); |
|
932 | q_ptr->setLabelsBrush(theme->labelBrush()); | |
930 | } |
|
933 | } | |
931 |
|
934 | //TODO: introduce axis brush | ||
932 | if (forced || brush == m_titleBrush){ |
|
935 | if (forced || brush == m_titleBrush){ | |
933 | q_ptr->setTitleBrush(theme->labelBrush()); |
|
936 | q_ptr->setTitleBrush(theme->labelBrush()); | |
934 | } |
|
937 | } | |
@@ -964,7 +967,7 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) | |||||
964 | if (forced || font == m_labelsFont){ |
|
967 | if (forced || font == m_labelsFont){ | |
965 | q_ptr->setLabelsFont(theme->labelFont()); |
|
968 | q_ptr->setLabelsFont(theme->labelFont()); | |
966 | } |
|
969 | } | |
967 |
|
970 | //TODO: discuss with Tero | ||
968 | if (forced || font == m_titleFont){ |
|
971 | if (forced || font == m_titleFont){ | |
969 | QFont font(m_labelsFont); |
|
972 | QFont font(m_labelsFont); | |
970 | font.setBold(true); |
|
973 | font.setBold(true); |
@@ -43,7 +43,7 class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject | |||||
43 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) |
|
43 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) | |
44 | Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) |
|
44 | Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) | |
45 | Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) |
|
45 | Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) | |
46 |
|
46 | //TODO: fix labels angles to work with layout | ||
47 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) |
|
47 | Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) | |
48 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) |
|
48 | Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) | |
49 | Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) |
|
49 | Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) | |
@@ -146,7 +146,7 public: | |||||
146 | void setShadesBorderColor(QColor color); |
|
146 | void setShadesBorderColor(QColor color); | |
147 | QColor shadesBorderColor() const; |
|
147 | QColor shadesBorderColor() const; | |
148 |
|
148 | |||
149 | Qt::Orientation orientation(); |
|
149 | Qt::Orientation orientation(); //TODO: missing const <- BC | |
150 | Qt::Alignment alignment() const; |
|
150 | Qt::Alignment alignment() const; | |
151 |
|
151 | |||
152 | //range handling |
|
152 | //range handling |
@@ -60,7 +60,7 public: | |||||
60 | void setLabelFormat(const QString &format); |
|
60 | void setLabelFormat(const QString &format); | |
61 | QString labelFormat() const; |
|
61 | QString labelFormat() const; | |
62 |
|
62 | |||
63 |
|
63 | //TODO: depreciated ! | ||
64 | void setNiceNumbersEnabled(bool enable = true); |
|
64 | void setNiceNumbersEnabled(bool enable = true); | |
65 | bool niceNumbersEnabled() const; |
|
65 | bool niceNumbersEnabled() const; | |
66 |
|
66 |
@@ -61,7 +61,7 private: | |||||
61 | int m_tickCount; |
|
61 | int m_tickCount; | |
62 | QString m_format; |
|
62 | QString m_format; | |
63 | bool m_applying; |
|
63 | bool m_applying; | |
64 | bool m_niceNumbersEnabled; |
|
64 | bool m_niceNumbersEnabled; //TODO: this depreciated | |
65 | Q_DECLARE_PUBLIC(QValueAxis) |
|
65 | Q_DECLARE_PUBLIC(QValueAxis) | |
66 | }; |
|
66 | }; | |
67 |
|
67 |
@@ -183,6 +183,9 QList<QGradient> ChartThemeManager::generateSeriesGradients(const QList<QColor>& | |||||
183 | qreal h = color.hsvHueF(); |
|
183 | qreal h = color.hsvHueF(); | |
184 | qreal s = color.hsvSaturationF(); |
|
184 | qreal s = color.hsvSaturationF(); | |
185 |
|
185 | |||
|
186 | // TODO: tune the algorithm to give nice results with most base colors defined in | |||
|
187 | // most themes. The rest of the gradients we can define manually in theme specific | |||
|
188 | // implementation. | |||
186 | QColor start = color; |
|
189 | QColor start = color; | |
187 | start.setHsvF(h, 0.0, 1.0); |
|
190 | start.setHsvF(h, 0.0, 1.0); | |
188 | g.setColorAt(0.0, start); |
|
191 | g.setColorAt(0.0, start); |
@@ -39,7 +39,7 | |||||
39 |
|
39 | |||
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
40 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
41 |
|
41 | |||
42 |
|
42 | // TODO: check these | ||
43 | class QAbstractSeries; |
|
43 | class QAbstractSeries; | |
44 | class QAreaSeries; |
|
44 | class QAreaSeries; | |
45 | class QXYSeries; |
|
45 | class QXYSeries; |
@@ -204,6 +204,11 QChart *QAbstractSeries::chart() const | |||||
204 | return d_ptr->m_chart; |
|
204 | return d_ptr->m_chart; | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
|
207 | //void QAbstractSeries::adjustView() | |||
|
208 | //{ | |||
|
209 | // //TODO: | |||
|
210 | //} | |||
|
211 | ||||
207 | /*! |
|
212 | /*! | |
208 | \brief Sets the visibility of the series to true |
|
213 | \brief Sets the visibility of the series to true | |
209 |
|
214 |
@@ -118,6 +118,8 QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) | |||||
118 | { |
|
118 | { | |
119 | d_ptr->m_legend = new LegendScroller(this); |
|
119 | d_ptr->m_legend = new LegendScroller(this); | |
120 | setTheme(QChart::ChartThemeLight); |
|
120 | setTheme(QChart::ChartThemeLight); | |
|
121 | //TODO: what is that ? | |||
|
122 | //connect(d_ptr->m_presenter, SIGNAL(marginsChanged(QRectF)), this, SIGNAL(marginsChanged(QRectF))); | |||
121 | setLayout(d_ptr->m_presenter->layout()); |
|
123 | setLayout(d_ptr->m_presenter->layout()); | |
122 | } |
|
124 | } | |
123 |
|
125 | |||
@@ -447,6 +449,15 QRectF QChart::plotArea() const | |||||
447 | return d_ptr->m_presenter->geometry(); |
|
449 | return d_ptr->m_presenter->geometry(); | |
448 | } |
|
450 | } | |
449 |
|
451 | |||
|
452 | ///*! | |||
|
453 | // TODO: Dummy. | |||
|
454 | // Adjest the ranges of the axes so that all the data of the specified \a series is visible | |||
|
455 | // */ | |||
|
456 | //void QChart::adjustViewToSeries(QAbstractSeries* series) | |||
|
457 | //{ | |||
|
458 | // // | |||
|
459 | //} | |||
|
460 | ||||
450 | /*! |
|
461 | /*! | |
451 | Sets animation \a options for the chart |
|
462 | Sets animation \a options for the chart | |
452 | */ |
|
463 | */ |
@@ -176,7 +176,8 void ScatterChartItem::handleUpdated() | |||||
176 | m_shape = m_series->markerShape(); |
|
176 | m_shape = m_series->markerShape(); | |
177 | setOpacity(m_series->opacity()); |
|
177 | setOpacity(m_series->opacity()); | |
178 |
|
178 | |||
179 |
if (recreate) { |
|
179 | if (recreate) { | |
|
180 | // TODO: optimize handleUpdate to recreate points only in case shape changed | |||
180 | deletePoints(count); |
|
181 | deletePoints(count); | |
181 | createPoints(count); |
|
182 | createPoints(count); | |
182 |
|
183 |
@@ -30,6 +30,8 | |||||
30 |
|
30 | |||
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
32 |
|
32 | |||
|
33 | //TODO: optimize : remove points which are not visible | |||
|
34 | ||||
33 | XYChart::XYChart(QXYSeries *series,QGraphicsItem* item): |
|
35 | XYChart::XYChart(QXYSeries *series,QGraphicsItem* item): | |
34 | ChartItem(series->d_func(),item), |
|
36 | ChartItem(series->d_func(),item), | |
35 | m_series(series), |
|
37 | m_series(series), |
General Comments 0
You need to be logged in to leave comments.
Login now