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/07/06 12:21:14 UTC
[echarts] branch fix-universal-transition created (now f96ac55)
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a change to branch fix-universal-transition
in repository https://gitbox.apache.org/repos/asf/echarts.git.
at f96ac55 test: optimize test cases for universal transition
This branch includes the following new commits:
new 9b904e6 fix(ut): more precise when determine if using id as key
new f96ac55 test: optimize test cases for universal transition
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts] 02/02: test: optimize test cases for universal transition
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch fix-universal-transition
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit f96ac55aa62d8f83985572713d37209754d17e9c
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Jul 6 20:20:10 2021 +0800
test: optimize test cases for universal transition
---
src/model/Series.ts | 1 +
test/runTest/actions/universalTransition2.json | 2 +-
test/universalTransition2.html | 24 +++++++++++++++++-------
3 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/src/model/Series.ts b/src/model/Series.ts
index 1972ca7..9ee54c8 100644
--- a/src/model/Series.ts
+++ b/src/model/Series.ts
@@ -541,6 +541,7 @@ class SeriesModel<Opt extends SeriesOption = SeriesOption> extends ComponentMode
return true;
}
+ // NOTE: don't support define universalTransition in global option yet.
const universalTransitionOpt = this.option.universalTransition;
// Quick reject
if (!universalTransitionOpt) {
diff --git a/test/runTest/actions/universalTransition2.json b/test/runTest/actions/universalTransition2.json
index cdc7262..9e746cd 100644
--- a/test/runTest/actions/universalTransition2.json
+++ b/test/runTest/actions/universalTransition2.json
@@ -1 +1 @@
-[{"name":"Action 1","ops":[{"type":"mousedown","time":472,"x":221,"y":267},{"type":"mouseup","time":561,"x":221,"y":267},{"time":562,"delay":100,"type":"screenshot-auto"},{"type":"mousemove","time":1020,"x":220,"y":266},{"type":"mousemove","time":1220,"x":72,"y":121},{"type":"mousemove","time":1420,"x":65,"y":106},{"type":"mousemove","time":1625,"x":68,"y":90},{"type":"mousemove","time":1855,"x":68,"y":90},{"type":"mousedown","time":2046,"x":68,"y":90},{"type":"mouseup","time":2124,"x":6 [...]
\ No newline at end of file
+[{"name":"Action 1","ops":[{"type":"mousedown","time":442,"x":233,"y":291},{"type":"mouseup","time":541,"x":233,"y":291},{"time":542,"delay":100,"type":"screenshot-auto"},{"type":"mousemove","time":796,"x":232,"y":291},{"type":"mousemove","time":1001,"x":113,"y":115},{"type":"mousemove","time":1212,"x":99,"y":92},{"type":"mousemove","time":1412,"x":93,"y":92},{"type":"mousemove","time":1615,"x":87,"y":91},{"type":"mousedown","time":1824,"x":83,"y":90},{"type":"mousemove","time":1834,"x": [...]
\ No newline at end of file
diff --git a/test/universalTransition2.html b/test/universalTransition2.html
index 860ce29..ef3a998 100644
--- a/test/universalTransition2.html
+++ b/test/universalTransition2.html
@@ -149,9 +149,13 @@ under the License.
fontSize: 18
},
onclick() {
- chart.setOption(option);
+ chart.setOption(option, {
+ replaceMerge: ['xAxis', 'yAxis']
+ });
}
}]
+ }, {
+ replaceMerge: ['xAxis', 'yAxis']
});
}
});
@@ -416,21 +420,27 @@ under the License.
yAxis: {
scale: true
},
- universalTransition: {
- enabled: true,
- delay(idx, count) {
- return (idx / count) * 1000;
- }
- },
series: [{
type: 'scatter',
id: 'female',
dataGroupId: 'female',
+ universalTransition: {
+ enabled: true,
+ delay(idx, count) {
+ return (idx / count) * 1000;
+ }
+ },
data: femaleData
}, {
type: 'scatter',
id: 'male',
dataGroupId: 'male',
+ universalTransition: {
+ enabled: true,
+ delay(idx, count) {
+ return (idx / count) * 1000;
+ }
+ },
data: maleDeta
}]
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
[echarts] 01/02: fix(ut): more precise when determine if using id
as key
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch fix-universal-transition
in repository https://gitbox.apache.org/repos/asf/echarts.git
commit 9b904e659bfefa54467871004c1fdf12ba9bf63b
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Jul 6 20:18:16 2021 +0800
fix(ut): more precise when determine if using id as key
---
src/animation/universalTransition.ts | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/animation/universalTransition.ts b/src/animation/universalTransition.ts
index 53bf2da..140afca 100644
--- a/src/animation/universalTransition.ts
+++ b/src/animation/universalTransition.ts
@@ -142,6 +142,21 @@ function animateElementStyles(el: Element, dataIndex: number, seriesModel: Serie
}
+function isAllIdSame(oldDiffItems: DiffItem[], newDiffItems: DiffItem[]) {
+ const len = oldDiffItems.length;
+ if (len !== newDiffItems.length) {
+ return false;
+ }
+ for (let i = 0; i < len; i++) {
+ const oldItem = oldDiffItems[i];
+ const newItem = newDiffItems[i];
+ if (oldItem.data.getId(oldItem.dataIndex) !== newItem.data.getId(newItem.dataIndex)) {
+ return false;
+ }
+ }
+ return true;
+}
+
function transitionBetween(
oldList: TransitionSeries[],
newList: TransitionSeries[],
@@ -220,7 +235,7 @@ function transitionBetween(
// Use id if it's very likely to be an one to one animation
// It's more robust than groupId
// TODO Check if key dimension is specified.
- const useId = oldDiffItems.length === newDiffItems.length;
+ const useId = isAllIdSame(oldDiffItems, newDiffItems);
const isElementStillInChart: Dictionary<boolean> = {};
if (!useId) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org