You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/06/18 12:27:39 UTC
[echarts] branch enhance-morph updated: feat(ut): disable universal
transition on large data.
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch enhance-morph
in repository https://gitbox.apache.org/repos/asf/echarts.git
The following commit(s) were added to refs/heads/enhance-morph by this push:
new 9217b0b feat(ut): disable universal transition on large data.
9217b0b is described below
commit 9217b0bc201ddafa8d16ee1b15cd419adcbef268
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Jun 18 20:26:43 2021 +0800
feat(ut): disable universal transition on large data.
---
src/animation/universalTransition.ts | 10 ++++++++--
src/core/echarts.ts | 4 +++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/animation/universalTransition.ts b/src/animation/universalTransition.ts
index 1824ed0..bde43f8 100644
--- a/src/animation/universalTransition.ts
+++ b/src/animation/universalTransition.ts
@@ -20,7 +20,7 @@
// Universal transitions that can animate between any shapes(series) and any properties in any amounts.
import SeriesModel, { SERIES_UNIVERSAL_TRANSITION_PROP } from '../model/Series';
-import {createHashMap, each, map, filter, isArray, find, retrieve, retrieve2, extend} from 'zrender/src/core/util';
+import {createHashMap, each, map, filter, isArray} from 'zrender/src/core/util';
import Element, { ElementAnimateConfig } from 'zrender/src/Element';
import { applyMorphAnimation, getPathList } from './morphTransitionHelper';
import Path from 'zrender/src/graphic/Path';
@@ -64,6 +64,12 @@ function flattenDataDiffItems(list: TransitionSeries[]) {
each(list, seriesInfo => {
const data = seriesInfo.data;
+ if (data.count() > 1e4) {
+ if (__DEV__) {
+ warn('Universal transition is disabled on large data > 10k.');
+ }
+ return;
+ }
const indices = data.getIndices();
const groupDim = getGroupIdDimension(data);
for (let dataIndex = 0; dataIndex < indices.length; dataIndex++) {
@@ -398,7 +404,7 @@ function findTransitionSeriesBatches(params: UpdateLifecycleParams) {
}
}
each(params.updatedSeries, series => {
- if (series.get(['universalTransition', 'enabled'])) {
+ if (series.get(['universalTransition', 'enabled']) && series.isAnimationEnabled()) {
const newData = series.getData();
const transitionKey = getSeriesTransitionKey(series);
const transitionKeyStr = convertArraySeriesKeyToString(transitionKey);
diff --git a/src/core/echarts.ts b/src/core/echarts.ts
index c2d91f3..70c1125 100644
--- a/src/core/echarts.ts
+++ b/src/core/echarts.ts
@@ -613,7 +613,9 @@ class ECharts extends Eventful<ECEventDefinition> {
oldSeriesModels = this._model.getSeries();
}
- const oldSeriesData = !this[PENDING_UPDATE] // Check if previous option is not rendered yet. Can't getData if so(will throw error.)
+ // Check if previous option is not rendered yet. Can't getData if so(will throw error.)
+ // TODO: This will cause animation failed if setOption with lazyUpdate twice.
+ const oldSeriesData = !this[PENDING_UPDATE]
&& oldSeriesModels
&& map(oldSeriesModels, series => series.getData());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org