##// END OF EJS Templates
prune redundant DEPENDPATH entries...
prune redundant DEPENDPATH entries qt5 has depend_includepath enabled by default. Change-Id: I10ffcc9ff83a8b3c2252abe3dbdf7d0d40fcd4f2 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com>

File last commit:

r2845:ae12522d475c
r2885:b0b6ace77823
Show More
boxwhiskersanimation.cpp
113 lines | 4.1 KiB | text/x-c | CppLexer
/ src / charts / animations / boxwhiskersanimation.cpp
Titta Heikkala
Updated license headers...
r2845 /******************************************************************************
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 **
Titta Heikkala
Updated license headers...
r2845 ** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 **
Titta Heikkala
Updated license headers...
r2740 ** This file is part of the Qt Charts module.
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_BEGIN_LICENSE:COMM$
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 **
Titta Heikkala
Updated license headers...
r2845 ** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 **
Titta Heikkala
Updated license headers...
r2845 ** $QT_END_LICENSE$
**
******************************************************************************/
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Titta Heikkala
Fix include syntax...
r2714 #include <private/boxwhiskersanimation_p.h>
#include <private/boxplotanimation_p.h>
#include <private/boxplotchartitem_p.h>
#include <private/boxwhiskersdata_p.h>
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Q_DECLARE_METATYPE(QVector<QRectF>)
Titta Heikkala
Qt Charts project file structure change...
r2712 Q_DECLARE_METATYPE(QT_CHARTS_NAMESPACE::BoxWhiskersData)
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 Q_DECLARE_METATYPE(qreal)
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548
Titta Heikkala
Added possibility to set duration and easing curve for chart animation...
r2804 BoxWhiskersAnimation::BoxWhiskersAnimation(BoxWhiskers *box, BoxPlotAnimation *boxPlotAnimation,
int duration, QEasingCurve &curve)
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 : ChartAnimation(box),
Miikka Heikkinen
Further crash fixes to boxplot...
r2561 m_box(box),
Miikka Heikkinen
Plugged some memory leaks....
r2733 m_changeAnimation(false),
Miikka Heikkinen
Further crash fixes to boxplot...
r2561 m_boxPlotAnimation(boxPlotAnimation)
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 {
Titta Heikkala
Added possibility to set duration and easing curve for chart animation...
r2804 setDuration(duration);
setEasingCurve(curve);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
BoxWhiskersAnimation::~BoxWhiskersAnimation()
{
Miikka Heikkinen
Further crash fixes to boxplot...
r2561 if (m_boxPlotAnimation)
m_boxPlotAnimation->removeBoxAnimation(m_box);
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 }
QVariant BoxWhiskersAnimation::interpolated(const QVariant &from, const QVariant &to, qreal progress) const
{
BoxWhiskersData startData = qvariant_cast<BoxWhiskersData>(from);
BoxWhiskersData endData = qvariant_cast<BoxWhiskersData>(to);
BoxWhiskersData result;
Miikka Heikkinen
Fix animation artifact with boxplots....
r2564 if (m_changeAnimation) {
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548 result.m_lowerExtreme = startData.m_lowerExtreme + progress * (endData.m_lowerExtreme - startData.m_lowerExtreme);
result.m_lowerQuartile = startData.m_lowerQuartile + progress * (endData.m_lowerQuartile - startData.m_lowerQuartile);
result.m_median = startData.m_median + progress * (endData.m_median - startData.m_median);
result.m_upperQuartile = startData.m_upperQuartile + progress * (endData.m_upperQuartile - startData.m_upperQuartile);
result.m_upperExtreme = startData.m_upperExtreme + progress * (endData.m_upperExtreme - startData.m_upperExtreme);
} else {
result.m_lowerExtreme = endData.m_median + progress * (endData.m_lowerExtreme - endData.m_median);
result.m_lowerQuartile = endData.m_median + progress * (endData.m_lowerQuartile - endData.m_median);
result.m_median = endData.m_median;
result.m_upperQuartile = endData.m_median + progress * (endData.m_upperQuartile - endData.m_median);
result.m_upperExtreme = endData.m_median + progress * (endData.m_upperExtreme - endData.m_median);
}
result.m_index = endData.m_index;
result.m_boxItems = endData.m_boxItems;
result.m_maxX = endData.m_maxX;
result.m_minX = endData.m_minX;
result.m_maxY = endData.m_maxY;
result.m_minY = endData.m_minY;
result.m_seriesIndex = endData.m_seriesIndex;
result.m_seriesCount = endData.m_seriesCount;
return qVariantFromValue(result);
}
void BoxWhiskersAnimation::updateCurrentValue(const QVariant &value)
{
BoxWhiskersData data = qvariant_cast<BoxWhiskersData>(value);
m_box->setLayout(data);
}
void BoxWhiskersAnimation::setup(const BoxWhiskersData &startData, const BoxWhiskersData &endData)
{
setKeyValueAt(0.0, qVariantFromValue(startData));
setKeyValueAt(1.0, qVariantFromValue(endData));
}
void BoxWhiskersAnimation::setEndData(const BoxWhiskersData &endData)
{
if (state() != QAbstractAnimation::Stopped)
stop();
setEndValue(qVariantFromValue(endData));
}
void BoxWhiskersAnimation::setStartData(const BoxWhiskersData &endData)
{
if (state() != QAbstractAnimation::Stopped)
stop();
setStartValue(qVariantFromValue(endData));
}
#include "moc_boxwhiskersanimation_p.cpp"
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE
Mika Salmela
A new box-and-whiskers series type added to charts....
r2548