##// END OF EJS Templates
refactored legend to qseries
refactored legend to qseries

File last commit:

r349:7594bc4927de
r380:0247ffcfa93f
Show More
linechartanimationitem.cpp
63 lines | 1.7 KiB | text/x-c | CppLexer
/ src / linechart / linechartanimationitem.cpp
Michal Klocek
Refactors qchart , adds line animation...
r131 #include "linechartanimationitem_p.h"
Michal Klocek
Fix previous broken commit
r145 #include "linechartitem_p.h"
Michal Klocek
Refactors qchart , adds line animation...
r131 #include <QPropertyAnimation>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
const static int duration = 500;
Michal Klocek
Rename QLineChartSeries to QLineSeries
r349 LineChartAnimationItem::LineChartAnimationItem(ChartPresenter* presenter, QLineSeries* series,QGraphicsItem *parent):
Michal Klocek
Fix previous broken commit
r145 LineChartItem(presenter,series,parent)
Michal Klocek
Refactors qchart , adds line animation...
r131 {
}
LineChartAnimationItem::~LineChartAnimationItem()
{
}
void LineChartAnimationItem::addPoints(const QVector<QPointF>& points)
{
m_data=points;
clearView();
QPropertyAnimation *animation = new QPropertyAnimation(this, "a_addPoints", parent());
animation->setDuration(duration);
//animation->setEasingCurve(QEasingCurve::InOutBack);
animation->setKeyValueAt(0.0, 0);
animation->setKeyValueAt(1.0, m_data.size());
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
void LineChartAnimationItem::setPoint(int index,const QPointF& point)
{
AnimationHelper* helper = new AnimationHelper(this,index);
QPropertyAnimation *animation = new QPropertyAnimation(helper, "point", parent());
animation->setDuration(duration);
//animation->setEasingCurve(QEasingCurve::InOutBack);
animation->setKeyValueAt(0.0, points().value(index));
animation->setKeyValueAt(1.0, point);
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
void LineChartAnimationItem::aw_addPoints(int points)
{
int index = count();
for(int i = index;i< points ;i++){
Michal Klocek
Fix previous broken commit
r145 LineChartItem::addPoint(m_data.at(i));
Michal Klocek
Refactors qchart , adds line animation...
r131 }
updateGeometry();
update();
}
void LineChartAnimationItem::aw_setPoint(int index,const QPointF& point)
{
Michal Klocek
Fix previous broken commit
r145 LineChartItem::setPoint(index,point);
Michal Klocek
Refactors qchart , adds line animation...
r131 updateGeometry();
update();
}
#include "moc_linechartanimationitem_p.cpp"
QTCOMMERCIALCHART_END_NAMESPACE