You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/11/01 04:23:49 UTC

[GitHub] [echarts] Ovilia commented on a diff in pull request #17849: feat(dataView): add dataViewOpend and dataViewClosed event, close #17840

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-unsubscribe@echarts.apache.org

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


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