diff --git a/src/animations/axisanimation.cpp b/src/animations/axisanimation.cpp index 49842b8..dc224e1 100644 --- a/src/animations/axisanimation.cpp +++ b/src/animations/axisanimation.cpp @@ -57,6 +57,11 @@ void AxisAnimation::setValues(QVector &oldLayout, QVector &newLayo { if (state() != QAbstractAnimation::Stopped) stop(); +// TODO: cannot return even if layout is empty +// New layout is not set properly without it (crash) +// if (newLayout.count() == 0) +// return; + switch (m_type) { case ZoomOutAnimation: { QRectF rect = m_axis->gridGeometry(); @@ -125,6 +130,7 @@ void AxisAnimation::updateCurrentValue(const QVariant &value) { if (state() != QAbstractAnimation::Stopped) { //workaround QVector vector = qvariant_cast >(value); +// Q_ASSERT(vector.count() != 0); m_axis->setLayout(vector); m_axis->updateGeometry(); } diff --git a/src/areachart/areachartitem.cpp b/src/areachart/areachartitem.cpp index 99b6c32..5ef8805 100644 --- a/src/areachart/areachartitem.cpp +++ b/src/areachart/areachartitem.cpp @@ -31,8 +31,10 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE +//TODO: optimize : remove points which are not visible + AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item) - : ChartItem(areaSeries->d_func(),item), + : ChartItem(areaSeries->d_func(),item), //TODO: fix me m_series(areaSeries), m_upper(0), m_lower(0), diff --git a/src/areachart/qareaseries.cpp b/src/areachart/qareaseries.cpp index 952e6ee..be6e605 100644 --- a/src/areachart/qareaseries.cpp +++ b/src/areachart/qareaseries.cpp @@ -213,7 +213,8 @@ void QAreaSeries::setUpperSeries(QLineSeries *series) { Q_D(QAreaSeries); if(d->m_upperSeries!=series){ - d->m_upperSeries = series; + d->m_upperSeries = series; + //TODO: } } diff --git a/src/axis/barcategoryaxis/qbarcategoryaxis.cpp b/src/axis/barcategoryaxis/qbarcategoryaxis.cpp index 99cf20a..ba06d69 100644 --- a/src/axis/barcategoryaxis/qbarcategoryaxis.cpp +++ b/src/axis/barcategoryaxis/qbarcategoryaxis.cpp @@ -247,7 +247,8 @@ void QBarCategoryAxis::remove(const QString &category) } else if (d->m_maxCategory == category) { setRange(d->m_minCategory, d->m_categories.last()); } else { - d->updateCategoryDomain(); + d->updateCategoryDomain(); + //TODO:: d->emitUpdated(); } } else { setRange(QString::null, QString::null); @@ -280,7 +281,8 @@ void QBarCategoryAxis::insert(int index, const QString &category) } else if (index == count) { setRange(d->m_minCategory, d->m_categories.last()); } else { - d->updateCategoryDomain(); + d->updateCategoryDomain(); + //TODO:: d->emitUpdated(); } emit categoriesChanged(); @@ -304,6 +306,8 @@ void QBarCategoryAxis::replace(const QString &oldCategory, const QString &newCat setRange(newCategory, d->m_maxCategory); } else if (d->m_maxCategory == oldCategory) { setRange(d->m_minCategory, newCategory); + } else { + //TODO:: d->emitUpdated(); } emit categoriesChanged(); emit countChanged(); diff --git a/src/axis/categoryaxis/chartcategoryaxisx.cpp b/src/axis/categoryaxis/chartcategoryaxisx.cpp index b4fa744..ca9e176 100644 --- a/src/axis/categoryaxis/chartcategoryaxisx.cpp +++ b/src/axis/categoryaxis/chartcategoryaxisx.cpp @@ -66,7 +66,8 @@ QVector ChartCategoryAxisX::calculateLayout() const } void ChartCategoryAxisX::updateGeometry() -{ +{ + //TODO: this is not optimal when many categories :( , create only visible lables setLabels(m_axis->categoriesLabels() << ""); HorizontalAxis::updateGeometry(); } diff --git a/src/axis/categoryaxis/chartcategoryaxisy.cpp b/src/axis/categoryaxis/chartcategoryaxisy.cpp index b7176b4..ec0b4da 100644 --- a/src/axis/categoryaxis/chartcategoryaxisy.cpp +++ b/src/axis/categoryaxis/chartcategoryaxisy.cpp @@ -74,7 +74,8 @@ void ChartCategoryAxisY::updateGeometry() void ChartCategoryAxisY::handleAxisUpdated() { - updateGeometry(); + updateGeometry(); + //TODO:: ChartAxis::handleAxisUpdated(); } QSizeF ChartCategoryAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const diff --git a/src/axis/categoryaxis/qcategoryaxis.cpp b/src/axis/categoryaxis/qcategoryaxis.cpp index e288fed..0db64fd 100644 --- a/src/axis/categoryaxis/qcategoryaxis.cpp +++ b/src/axis/categoryaxis/qcategoryaxis.cpp @@ -226,7 +226,8 @@ void QCategoryAxis::remove(const QString &categoryLabel) range.first = d->m_categoriesMap.value(d->m_categories.at(labelIndex - 1)).second; d->m_categoriesMap.insert(label, range); } - } + } + //TODO:: d->emitUpdated(); } } @@ -249,7 +250,8 @@ void QCategoryAxis::replaceLabel(const QString &oldLabel, const QString &newLabe d->m_categories.replace(labelIndex, newLabel); Range range = d->m_categoriesMap.value(oldLabel); d->m_categoriesMap.remove(oldLabel); - d->m_categoriesMap.insert(newLabel, range); + d->m_categoriesMap.insert(newLabel, range); + //TODO:: d->emitUpdated(); } } diff --git a/src/axis/chartaxis.cpp b/src/axis/chartaxis.cpp index 2323b3e..8c862d7 100644 --- a/src/axis/chartaxis.cpp +++ b/src/axis/chartaxis.cpp @@ -420,6 +420,9 @@ void ChartAxis::handleRangeChanged(qreal min, qreal max) QStringList ChartAxis::createValueLabels(qreal min, qreal max, int ticks,const QString& format) { + //TODO: Q_ASSERT(m_max > m_min); + //TODO: Q_ASSERT(ticks > 1); + QStringList labels; if(max <= min || ticks < 1){ @@ -507,6 +510,8 @@ QStringList ChartAxis::createLogValueLabels(qreal min, qreal max, qreal base, in QStringList ChartAxis::createDateTimeLabels(qreal min, qreal max,int ticks,const QString& format) { + //TODO: Q_ASSERT(m_max > m_min); + //TODO: Q_ASSERT(ticks > 1); QStringList labels; if(max <= min || ticks < 1) { diff --git a/src/axis/qabstractaxis.cpp b/src/axis/qabstractaxis.cpp index a1720d1..f3669b5 100644 --- a/src/axis/qabstractaxis.cpp +++ b/src/axis/qabstractaxis.cpp @@ -468,6 +468,7 @@ QPen QAbstractAxis::linePen() const return d_ptr->m_axisPen; } +//TODO: remove me void QAbstractAxis::setLinePenColor(QColor color) { QPen p = d_ptr->m_axisPen; @@ -613,7 +614,7 @@ int QAbstractAxis::labelsAngle() const { return d_ptr->m_labelsAngle; } - +//TODO: remove me void QAbstractAxis::setLabelsColor(QColor color) { QBrush b = d_ptr->m_labelsBrush; @@ -862,6 +863,8 @@ void QAbstractAxis::setRange(const QVariant &min, const QVariant &max) /*! Returns the orientation in which the axis is being used (Vertical or Horizontal) */ +// NOTE: should have const but it breaks BC: +// http://techbase.kde.org/Policies/Binary_Compatibility_Examples#Change_the_CV-qualifiers_of_a_member_function Qt::Orientation QAbstractAxis::orientation() { return d_ptr->orientation(); @@ -928,7 +931,7 @@ void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) if (forced || brush == m_labelsBrush){ q_ptr->setLabelsBrush(theme->labelBrush()); } - + //TODO: introduce axis brush if (forced || brush == m_titleBrush){ q_ptr->setTitleBrush(theme->labelBrush()); } @@ -964,7 +967,7 @@ void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced) if (forced || font == m_labelsFont){ q_ptr->setLabelsFont(theme->labelFont()); } - + //TODO: discuss with Tero if (forced || font == m_titleFont){ QFont font(m_labelsFont); font.setBold(true); diff --git a/src/axis/qabstractaxis.h b/src/axis/qabstractaxis.h index b28b9dc..161bebe 100644 --- a/src/axis/qabstractaxis.h +++ b/src/axis/qabstractaxis.h @@ -43,7 +43,7 @@ class QTCOMMERCIALCHART_EXPORT QAbstractAxis : public QObject Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) Q_PROPERTY(QPen labelsPen READ labelsPen WRITE setLabelsPen NOTIFY labelsPenChanged) Q_PROPERTY(QBrush labelsBrush READ labelsBrush WRITE setLabelsBrush NOTIFY labelsBrushChanged) - + //TODO: fix labels angles to work with layout Q_PROPERTY(int labelsAngle READ labelsAngle WRITE setLabelsAngle NOTIFY labelsAngleChanged) Q_PROPERTY(QFont labelsFont READ labelsFont WRITE setLabelsFont NOTIFY labelsFontChanged) Q_PROPERTY(QColor labelsColor READ labelsColor WRITE setLabelsColor NOTIFY labelsColorChanged) @@ -146,7 +146,7 @@ public: void setShadesBorderColor(QColor color); QColor shadesBorderColor() const; - Qt::Orientation orientation(); + Qt::Orientation orientation(); //TODO: missing const <- BC Qt::Alignment alignment() const; //range handling diff --git a/src/axis/valueaxis/qvalueaxis.h b/src/axis/valueaxis/qvalueaxis.h index 9802485..142d21e 100644 --- a/src/axis/valueaxis/qvalueaxis.h +++ b/src/axis/valueaxis/qvalueaxis.h @@ -60,7 +60,7 @@ public: void setLabelFormat(const QString &format); QString labelFormat() const; - + //TODO: depreciated ! void setNiceNumbersEnabled(bool enable = true); bool niceNumbersEnabled() const; diff --git a/src/axis/valueaxis/qvalueaxis_p.h b/src/axis/valueaxis/qvalueaxis_p.h index 260661c..aaa7037 100644 --- a/src/axis/valueaxis/qvalueaxis_p.h +++ b/src/axis/valueaxis/qvalueaxis_p.h @@ -61,7 +61,7 @@ private: int m_tickCount; QString m_format; bool m_applying; - bool m_niceNumbersEnabled; + bool m_niceNumbersEnabled; //TODO: this depreciated Q_DECLARE_PUBLIC(QValueAxis) }; diff --git a/src/chartthememanager.cpp b/src/chartthememanager.cpp index 335570b..989aecc 100644 --- a/src/chartthememanager.cpp +++ b/src/chartthememanager.cpp @@ -183,6 +183,9 @@ QList ChartThemeManager::generateSeriesGradients(const QList& qreal h = color.hsvHueF(); qreal s = color.hsvSaturationF(); + // TODO: tune the algorithm to give nice results with most base colors defined in + // most themes. The rest of the gradients we can define manually in theme specific + // implementation. QColor start = color; start.setHsvF(h, 0.0, 1.0); g.setColorAt(0.0, start); diff --git a/src/legend/qlegendmarker_p.h b/src/legend/qlegendmarker_p.h index 8c85dc5..b041952 100644 --- a/src/legend/qlegendmarker_p.h +++ b/src/legend/qlegendmarker_p.h @@ -39,7 +39,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE - +// TODO: check these class QAbstractSeries; class QAreaSeries; class QXYSeries; diff --git a/src/qabstractseries.cpp b/src/qabstractseries.cpp index c90aa34..809fa3d 100644 --- a/src/qabstractseries.cpp +++ b/src/qabstractseries.cpp @@ -204,6 +204,11 @@ QChart *QAbstractSeries::chart() const return d_ptr->m_chart; } +//void QAbstractSeries::adjustView() +//{ +// //TODO: +//} + /*! \brief Sets the visibility of the series to true diff --git a/src/qchart.cpp b/src/qchart.cpp index 8388d6f..f0dd9d3 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -118,6 +118,8 @@ QChart::QChart(QGraphicsItem *parent, Qt::WindowFlags wFlags) { d_ptr->m_legend = new LegendScroller(this); setTheme(QChart::ChartThemeLight); + //TODO: what is that ? + //connect(d_ptr->m_presenter, SIGNAL(marginsChanged(QRectF)), this, SIGNAL(marginsChanged(QRectF))); setLayout(d_ptr->m_presenter->layout()); } @@ -447,6 +449,15 @@ QRectF QChart::plotArea() const return d_ptr->m_presenter->geometry(); } +///*! +// TODO: Dummy. +// Adjest the ranges of the axes so that all the data of the specified \a series is visible +// */ +//void QChart::adjustViewToSeries(QAbstractSeries* series) +//{ +// // +//} + /*! Sets animation \a options for the chart */ diff --git a/src/scatterchart/scatterchartitem.cpp b/src/scatterchart/scatterchartitem.cpp index ef28a55..3b6a06c 100644 --- a/src/scatterchart/scatterchartitem.cpp +++ b/src/scatterchart/scatterchartitem.cpp @@ -176,7 +176,8 @@ void ScatterChartItem::handleUpdated() m_shape = m_series->markerShape(); setOpacity(m_series->opacity()); - if (recreate) { + if (recreate) { + // TODO: optimize handleUpdate to recreate points only in case shape changed deletePoints(count); createPoints(count); diff --git a/src/xychart/xychart.cpp b/src/xychart/xychart.cpp index 2109faa..26bed33 100644 --- a/src/xychart/xychart.cpp +++ b/src/xychart/xychart.cpp @@ -30,6 +30,8 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE +//TODO: optimize : remove points which are not visible + XYChart::XYChart(QXYSeries *series,QGraphicsItem* item): ChartItem(series->d_func(),item), m_series(series),