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/04/09 04:47:57 UTC

[echarts] branch fix-pie-display-nan updated: test(pie): add test case for switching between NaN value

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

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


The following commit(s) were added to refs/heads/fix-pie-display-nan by this push:
     new 7ff75da  test(pie): add test case for switching between NaN value
7ff75da is described below

commit 7ff75da6e73a4ceab1cd9e0808e46ee808426499
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Apr 9 12:45:50 2021 +0800

    test(pie): add test case for switching between NaN value
---
 test/pie-animation.html                 | 76 +++++++++++++++++++++++----------
 test/runTest/actions/__meta__.json      |  2 +-
 test/runTest/actions/pie-animation.json |  2 +-
 3 files changed, 56 insertions(+), 24 deletions(-)

diff --git a/test/pie-animation.html b/test/pie-animation.html
index 5c0cec6..4c3c8f8 100644
--- a/test/pie-animation.html
+++ b/test/pie-animation.html
@@ -32,7 +32,8 @@ under the License.
         body,
         #main1,
         #main2,
-        #main3 {
+        #main3,
+        #main4 {
             width: 100%;
             height: 250px;
             margin: 0;
@@ -61,6 +62,11 @@ under the License.
     <div class="test-title">Should display labels on emphasis if no animation</div>
     <div id="main3"></div>
 
+
+    <div class="test-title">Should animate correctly when switching between NaN value</div>
+    <button id="btn3">Go</button>
+    <div id="main4"></div>
+
     <script>
 
         require([
@@ -68,13 +74,7 @@ under the License.
         ], function (echarts) {
 
 
-            var chart = echarts.init(
-                document.getElementById('main1'),
-                null,
-                {
-                    renderer: 'svg'
-                }
-            );
+            var chart = echarts.init(document.getElementById('main1'));
             var data = [
                 {"name": "a1", "value": 92386},
                 {"name": "b1", "value": 90611},
@@ -123,13 +123,7 @@ under the License.
         ], function (echarts) {
 
 
-            var chart = echarts.init(
-                document.getElementById('main2'),
-                null,
-                {
-                    renderer: 'svg'
-                }
-            );
+            var chart = echarts.init(document.getElementById('main2'));
             var data = [
                 {"name": "a1", "value": 92386},
                 {"name": "b1", "value": 90611},
@@ -176,13 +170,7 @@ under the License.
         require([
             'echarts'
         ], function (echarts) {
-            var chart = echarts.init(
-                document.getElementById('main3'),
-                null,
-                {
-                    renderer: 'svg'
-                }
-            );
+            var chart = echarts.init(document.getElementById('main3'));
 
             var option = {
                 "series": [
@@ -209,6 +197,50 @@ under the License.
         });
 
     </script>
+
+    <script>
+
+        require([
+            'echarts'
+        ], function (echarts) {
+            var chart = echarts.init(
+                document.getElementById('main4'),
+                null
+            );
+
+            var option = {
+                "series": [
+                    {
+                        name: '访问来源',
+                        type: 'pie',
+                        selectedMode: 'single',
+                        data:[
+                            {value:335, name:'直接访问'},
+                            {value:310, name:'邮件营销'},
+                            {value:234, name:'联盟广告'},
+                            {value:1548, name:'搜索引擎'}
+                        ],
+                        emphasis: {
+                            itemStyle: {
+                                shadowBlur: 10,
+                                shadowOffsetX: 0,
+                                shadowColor: 'rgba(0, 0, 0, 0.5)'
+                            }
+                        }
+                    }
+                ]
+            };
+            chart.setOption(option);
+
+            document.getElementById('btn3').addEventListener('click', function () {
+                option.series[0].data[0].value =
+                    option.series[0].data[0].value === '-'
+                    ? 335 : '-';
+                chart.setOption(option);
+            });
+        });
+
+    </script>
 </body>
 
 </html>
\ No newline at end of file
diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json
index 69a7a44..b082222 100644
--- a/test/runTest/actions/__meta__.json
+++ b/test/runTest/actions/__meta__.json
@@ -123,7 +123,7 @@
   "pie": 1,
   "pie-action": 1,
   "pie-alignTo": 4,
-  "pie-animation": 1,
+  "pie-animation": 2,
   "pie-calculable": 1,
   "pie-label-extreme": 2,
   "polar-rounded": 3,
diff --git a/test/runTest/actions/pie-animation.json b/test/runTest/actions/pie-animation.json
index b788d98..e60f7d7 100644
--- a/test/runTest/actions/pie-animation.json
+++ b/test/runTest/actions/pie-animation.json
@@ -1 +1 @@
-[{"name":"Action 1","ops":[{"type":"mousemove","time":2246,"x":225,"y":453},{"type":"mousemove","time":2453,"x":225,"y":453},{"type":"mousemove","time":2845,"x":225,"y":453},{"type":"mousemove","time":3045,"x":268,"y":465},{"type":"mousemove","time":3245,"x":312,"y":468},{"type":"mousemove","time":3449,"x":328,"y":469},{"type":"mousemove","time":3669,"x":328,"y":469},{"type":"screenshot","time":4152}],"scrollY":390,"scrollX":0,"timestamp":1583724042816}]
\ No newline at end of file
+[{"name":"Action 1","ops":[{"type":"mousemove","time":2246,"x":225,"y":453},{"type":"mousemove","time":2453,"x":225,"y":453},{"type":"mousemove","time":2845,"x":225,"y":453},{"type":"mousemove","time":3045,"x":268,"y":465},{"type":"mousemove","time":3245,"x":312,"y":468},{"type":"mousemove","time":3449,"x":328,"y":469},{"type":"mousemove","time":3669,"x":328,"y":469},{"type":"screenshot","time":4152}],"scrollY":390,"scrollX":0,"timestamp":1583724042816},{"name":"Action 2","ops":[{"type": [...]
\ 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