1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#include <private/scatteranimation_p.h>
5#include <private/scatterchartitem_p.h>
6#include <QtCore/QDebug>
7
8QT_BEGIN_NAMESPACE
9
10ScatterAnimation::ScatterAnimation(ScatterChartItem *item, int duration, QEasingCurve &curve)
11 : XYAnimation(item, duration, curve)
12{
13}
14
15ScatterAnimation::~ScatterAnimation()
16{
17}
18
19void ScatterAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
20{
21 XYAnimation::updateState(newState, oldState);
22
23 if (oldState == QAbstractAnimation::Running && newState == QAbstractAnimation::Stopped
24 && animationType() == RemovePointAnimation) {
25 // Removing a point from scatter chart will keep extra marker item after animation stops.
26 // Also, if the removed point was not the last one in series, points after the removed one
27 // will report wrong coordinates when clicked. To fix these issues, update geometry after
28 // point removal animation has finished.
29 chartItem()->updateGeometry();
30 }
31}
32
33QT_END_NAMESPACE
34

source code of qtcharts/src/charts/animations/scatteranimation.cpp