Ovilia commented on code in PR #17849:
URL: https://github.com/apache/echarts/pull/17849#discussion_r1010054705


##########
src/component/toolbox/feature/DataView.ts:
##########
@@ -534,4 +540,14 @@ echarts.registerAction({
     }, payload.newOption));
 });
 
+echarts.registerAction(
+    { type: 'openDataView', event: 'dataViewOpend' },

Review Comment:
   Event name can be `dataViewShowed` and `dataViewHidden`.



##########
test/dataview-event.html:
##########
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+
+<html>
+
+<head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <link rel="stylesheet" href="lib/reset.css" />
+    <style>
+        #main {
+            width: 1200px;
+        }
+    </style>
+</head>
+
+<body>
+    <div id="main"></div>
+
+    <!-- please run npm run build/watch -->
+    <script src="../dist/echarts.js"></script>
+    <script>
+        const chart = echarts.init(document.getElementById("main"));
+
+        var option = {
+            toolbox: {
+                feature: {
+                    dataView: {
+                        show: true
+                    }
+                }
+            },
+            xAxis: {
+                type: 'category',
+                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+            },
+            yAxis: {
+                type: 'value'
+            },
+            series: [
+                {
+                    data: [150, 230, 224, 218, 135, 147, 260],
+                    type: 'line'
+                }
+            ]
+        };
+
+        chart.on('dataViewChanged', function (params) {

Review Comment:
   Also test `chart.dispatchAction('showDataView')` and 
`chart.dispatchAction('hideDataView')`.



##########
src/component/toolbox/feature/DataView.ts:
##########
@@ -324,6 +324,9 @@ class DataView extends 
ToolboxFeature<ToolboxDataViewFeatureOption> {
             api.dispatchAction({
                 type: 'hideTip'
             });
+            api.dispatchAction({
+                type: 'openDataView'

Review Comment:
   I think `showDataView` and `hideDataView` should be a better name to align 
with `showTip` and `hideTip`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to