From 4fe5f7a79a8fb60f4637174fc5c02397db746f88 2012-03-08 07:52:51 From: Michal Klocek Date: 2012-03-08 07:52:51 Subject: [PATCH] Sets drawline animation for all points update --- diff --git a/src/xychart/xychartanimationitem_p.h b/src/xychart/xychartanimationitem_p.h index b7a75a3..798016c 100644 --- a/src/xychart/xychartanimationitem_p.h +++ b/src/xychart/xychartanimationitem_p.h @@ -58,6 +58,7 @@ void XYChartAnimationItem::updatePoints(QVector& newPoints) } m_animation->setDuration(duration); + m_animation->setAnimationType(XYChartAnimator::LineDrawAnimation); m_animation->setEasingCurve(QEasingCurve::InOutBack); m_animation->setKeyValueAt(0.0, qVariantFromValue(oldPoints)); m_animation->setKeyValueAt(1.0, qVariantFromValue(newPoints)); @@ -82,6 +83,7 @@ void XYChartAnimationItem::updatePoint(QVector& newPoints) } m_animation->setDuration(duration); + m_animation->setAnimationType(XYChartAnimator::MoveDownAnimation); m_animation->setEasingCurve(QEasingCurve::InOutBack); m_animation->setKeyValueAt(0.0, qVariantFromValue(m_points)); m_animation->setKeyValueAt(1.0, qVariantFromValue(newPoints)); diff --git a/src/xychart/xychartanimator_p.h b/src/xychart/xychartanimator_p.h index 0698671..31bd208 100644 --- a/src/xychart/xychartanimator_p.h +++ b/src/xychart/xychartanimator_p.h @@ -17,6 +17,7 @@ public: enum Animation { LineDrawAnimation, MoveDownAnimation, MoveUpAnimation }; XYChartAnimator(XYChartAnimationItem *item, QObject *parent = 0 ); ~XYChartAnimator(); + void setAnimationType(Animation type); protected: QVariant interpolated(const QVariant &start, const QVariant & end, qreal progress ) const; @@ -40,6 +41,12 @@ XYChartAnimator::~XYChartAnimator() { } +template +void XYChartAnimator::setAnimationType(Animation type) +{ + m_type=type; +} + template QVariant XYChartAnimator::interpolated(const QVariant &start, const QVariant & end, qreal progress ) const {