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/05/11 10:31:56 UTC

[echarts] branch fix-custom-progressive created (now 0f4408d)

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a change to branch fix-custom-progressive
in repository https://gitbox.apache.org/repos/asf/echarts.git.


      at 0f4408d  fix(custom): remove incremental el when switched back to normal.

This branch includes the following new commits:

     new 0f4408d  fix(custom): remove incremental el when switched back to normal.

The 1 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] 01/01: fix(custom): remove incremental el when switched back to normal.

Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch fix-custom-progressive
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 0f4408daebdd7f43319f0322e98861917d76a124
Author: pissang <bm...@gmail.com>
AuthorDate: Tue May 11 18:30:40 2021 +0800

    fix(custom): remove incremental el when switched back to normal.
---
 src/chart/custom/install.ts                |   6 +
 test/build/mktest-tpl.html                 |   4 +-
 test/custom-bmap-grid.html                 |   1 -
 test/custom-large.html                     | 194 +++++++++++++++++++++++++++++
 test/runTest/actions/__meta__.json         |   2 +
 test/runTest/actions/custom-bmap-grid.json |   1 +
 test/runTest/actions/custom-large.json     |   1 +
 7 files changed, 206 insertions(+), 3 deletions(-)

diff --git a/src/chart/custom/install.ts b/src/chart/custom/install.ts
index 73b8315..0592854 100644
--- a/src/chart/custom/install.ts
+++ b/src/chart/custom/install.ts
@@ -487,6 +487,12 @@ class CustomSeriesView extends ChartView {
         const group = this.group;
         const renderItem = makeRenderItem(customSeries, data, ecModel, api);
 
+        if (!oldData) {
+            // Previous render is incremental render or first render.
+            // Needs remove the incremental rendered elements.
+            group.removeAll();
+        }
+
         // By default, merge mode is applied. In most cases, custom series is
         // used in the scenario that data amount is not large but graphic elements
         // is complicated, where merge mode is probably necessary for optimization.
diff --git a/test/build/mktest-tpl.html b/test/build/mktest-tpl.html
index 80a7e85..84218ef 100644
--- a/test/build/mktest-tpl.html
+++ b/test/build/mktest-tpl.html
@@ -52,8 +52,8 @@ under the License.
         <script>
         require([
             'echarts',
-            /*'map/js/china', */
-            /* './data/nutrients.json' */
+            // 'map/js/china',
+            // './data/nutrients.json'
         ], function (echarts) {
             var option;
 
diff --git a/test/custom-bmap-grid.html b/test/custom-bmap-grid.html
index 1dd83b5..ad1833c 100644
--- a/test/custom-bmap-grid.html
+++ b/test/custom-bmap-grid.html
@@ -224,7 +224,6 @@ under the License.
                             opacity: 0.7
                         }
                     },
-                    hoverLayerThreshold: 1e5,
                     series: [
                         {
                             type: 'custom',
diff --git a/test/custom-large.html b/test/custom-large.html
new file mode 100644
index 0000000..ad38fa2
--- /dev/null
+++ b/test/custom-large.html
@@ -0,0 +1,194 @@
+<!DOCTYPE html>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+<html>
+    <head>
+        <meta charset="utf-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1" />
+        <script src="lib/simpleRequire.js"></script>
+        <script src="lib/config.js"></script>
+        <script src="lib/jquery.min.js"></script>
+        <script src="lib/facePrint.js"></script>
+        <script src="lib/testHelper.js"></script>
+        <!-- <script src="ut/lib/canteen.js"></script> -->
+        <link rel="stylesheet" href="lib/reset.css" />
+    </head>
+    <body>
+        <style>
+        </style>
+
+
+
+        <div id="main0"></div>
+
+
+
+
+
+
+        <script>
+        require([
+            'echarts'
+        ], function (echarts) {
+            var option;
+
+            var data = [];
+            var dataCount = 1000;
+            var startTime =  new Date();
+            var categories = ['categoryA', 'categoryB', 'categoryC'];
+            var types = [
+                {name: 'JS Heap', color: '#7b9ce1'},
+                {name: 'Documents', color: '#bd6d6c'},
+                {name: 'Nodes', color: '#75d874'},
+                {name: 'Listeners', color: '#e0bc78'},
+                {name: 'GPU Memory', color: '#dc77dc'},
+                {name: 'GPU', color: '#72b362'}
+            ];
+
+            // Generate mock data
+            categories.forEach(function (category, index) {
+                let start = 0;
+                for (var i = 0; i < dataCount; i++) {
+                    var typeItem = types[Math.round(Math.random() * (types.length - 1))];
+                    data.push({
+                        name: typeItem.name,
+                        value: [
+                            index,
+                            i +  start,
+                            i + 1 + start,
+                            1
+                        ],
+                        itemStyle: {
+                            color: typeItem.color
+                        }
+                    });
+                    start
+                }
+            });
+
+            function renderItem(params, api) {
+                var categoryIndex = api.value(0);
+                var start = api.coord([api.value(1), categoryIndex]);
+                var end = api.coord([api.value(2), categoryIndex]);
+                var height = api.size([0, 1])[1] * 0.6;
+
+                var rectShape = echarts.graphic.clipRectByRect({
+                    x: start[0],
+                    y: start[1] - height / 2,
+                    width: end[0] - start[0],
+                    height: height
+                }, {
+                    x: params.coordSys.x,
+                    y: params.coordSys.y,
+                    width: params.coordSys.width,
+                    height: params.coordSys.height
+                });
+
+                return rectShape && {
+                    type: 'rect',
+                    transition: ['shape'],
+                    shape: rectShape,
+                    style: api.style()
+                };
+            }
+
+            option = {
+                tooltip: {
+                    formatter: function (params) {
+                        return params.marker + params.name + ': ' + params.value[3] + ' ms';
+                    }
+                },
+                title: {
+                    text: 'Profile',
+                    left: 'center'
+                },
+                dataZoom: [{
+                    type: 'slider',
+                    filterMode: 'weakFilter',
+                    showDataShadow: false,
+                    top: 400,
+                    labelFormatter: ''
+                }, {
+                    type: 'inside',
+                    filterMode: 'weakFilter'
+                }],
+                grid: {
+                    height: 300
+                },
+                xAxis: {
+                    min: 0,
+                    scale: true,
+                    axisLabel: {
+                        formatter: function (val) {
+                            return val + ' ms';
+                        }
+                    }
+                },
+                yAxis: {
+                    data: categories
+                },
+                series: [{
+                    type: 'custom',
+                    renderItem: renderItem,
+                    itemStyle: {
+                        opacity: 0.8
+                    },
+                    encode: {
+                        x: [1, 2],
+                        y: 0
+                    },
+                    data: data
+                }]
+            };
+
+            var chart = testHelper.create(echarts, 'main0', {
+                title: [
+                    'Test Case from https://github.com/apache/echarts/issues/14573',
+                    'Should switch between progressive normally.'
+                ],
+                option: option,
+                buttons: [{
+                    text: 'Zoom in',
+                    onclick: function () {
+                        chart.dispatchAction({
+                            type: 'dataZoom',
+                            start: 10,
+                            end: 12
+                        });
+                    }
+                }, {
+                    text: 'Zoom out',
+                    onclick: function () {
+                        chart.dispatchAction({
+                            type: 'dataZoom',
+                            start: 0,
+                            end: 100
+                        });
+                    }
+                }],
+            });
+        });
+        </script>
+
+
+    </body>
+</html>
+
diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json
index 53217ac..5b08a8c 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -52,8 +52,10 @@
   "connect2": 1,
   "css-transform": 4,
   "custom": 5,
+  "custom-bmap-grid": 1,
   "custom-children-remove": 1,
   "custom-hexbin": 2,
+  "custom-large": 1,
   "custom-text-content": 6,
   "dataSelect": 7,
   "dataZoom-action": 4,
diff --git a/test/runTest/actions/custom-bmap-grid.json b/test/runTest/actions/custom-bmap-grid.json
new file mode 100644
index 0000000..3cc637b
--- /dev/null
+++ b/test/runTest/actions/custom-bmap-grid.json
@@ -0,0 +1 @@
+[{"name":"Action 1","ops":[{"type":"mousemove","time":410,"x":578,"y":256},{"type":"mousemove","time":611,"x":454,"y":290},{"type":"mousemove","time":811,"x":342,"y":321},{"type":"mousemove","time":1015,"x":342,"y":321},{"type":"screenshot","time":1272}],"scrollY":0,"scrollX":0,"timestamp":1620704737845}]
\ No newline at end of file
diff --git a/test/runTest/actions/custom-large.json b/test/runTest/actions/custom-large.json
new file mode 100644
index 0000000..bcf91b8
--- /dev/null
+++ b/test/runTest/actions/custom-large.json
@@ -0,0 +1 @@
+[{"name":"Action 1","ops":[{"type":"mousedown","time":264,"x":38,"y":101},{"type":"mouseup","time":353,"x":38,"y":101},{"time":354,"delay":400,"type":"screenshot-auto"},{"type":"mousemove","time":528,"x":38,"y":101},{"type":"mousemove","time":731,"x":92,"y":98},{"type":"mousedown","time":882,"x":102,"y":97},{"type":"mousemove","time":946,"x":102,"y":96},{"type":"mouseup","time":983,"x":102,"y":96},{"time":984,"delay":400,"type":"screenshot-auto"}],"scrollY":0,"scrollX":0,"timestamp":1620 [...]
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org