Skip to content

Commit

Permalink
Merge pull request #15731 from apache/fix-line-animation
Browse files Browse the repository at this point in the history
[Fix] [line] fix animation is not stopped when direct update points.
  • Loading branch information
pissang committed Sep 15, 2021
2 parents 26e9a95 + 4824ada commit 6384acf
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/chart/line/LineView.ts
Expand Up @@ -1290,17 +1290,18 @@ class LineView extends ChartView {
next = turnPointsIntoStep(diff.next, coordSys, step);
stackedOnNext = turnPointsIntoStep(diff.stackedOnNext, coordSys, step);
}

// Don't apply animation if diff is large.
// For better result and avoid memory explosion problems like
// https://github.com/apache/incubator-echarts/issues/12229
if (getBoundingDiff(current, next) > 3000
|| (polygon && getBoundingDiff(stackedOnCurrent, stackedOnNext) > 3000)
) {
polyline.stopAnimation();
polyline.setShape({
points: next
});
if (polygon) {
polygon.stopAnimation();
polygon.setShape({
points: next,
stackedOnPoints: stackedOnNext
Expand Down Expand Up @@ -1345,7 +1346,6 @@ class LineView extends ChartView {
}
}


const updatedDataInfo: {
el: SymbolExtended,
ptIdx: number
Expand All @@ -1364,7 +1364,6 @@ class LineView extends ChartView {
}
}
}

if (polyline.animators && polyline.animators.length) {
polyline.animators[0].during(function () {
polygon && polygon.dirtyShape();
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/langPT-br.ts
Expand Up @@ -24,7 +24,8 @@
export default {
time: {
month: [
'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'
'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho',
'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'
],
monthAbbr: [
'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun',
Expand Down
106 changes: 106 additions & 0 deletions test/line-extraneous.html → test/line-animation-update.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions test/line-case.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/runTest/actions/__meta__.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6384acf

Please sign in to comment.