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/10/30 14:03:48 UTC

[GitHub] [echarts] MainHou opened a new pull request, #17849: feat(dataView): add dataViewOpend and dataViewClosed event, close #17840

MainHou opened a new pull request, #17849:
URL: https://github.com/apache/echarts/pull/17849

   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [x] new feature
   - [ ] others
   
   ### What does this PR do?
   
   <!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   
   add toolbox enter and close event listener
   
   ### Fixed issues
   
   <!--
   - #xxxx: ...
   -->
   
   #17840
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   Open and close dataview without event listening
   
   ### After: How does it behave after the fixing?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   The API look like
   
   ```js
   chart.on('dataViewOpend', function (params) {
     console.log('dataViewOpend', params)
   });
   
   chart.on('dataViewClosed', function (params) {
     console.log('dataViewClosed', params)
   });
   ```
   
   ## Document Info
   
   One of the following should be checked.
   
   - [ ] This PR doesn't relate to document changes
   - [x] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   ## Misc
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   N.A.
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### Other information


-- 
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


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

Posted by GitBox <gi...@apache.org>.
plainheart commented on code in PR #17849:
URL: https://github.com/apache/echarts/pull/17849#discussion_r1010162481


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

Review Comment:
   Should it be `dataViewShown` instead of `dataViewShowed`? (Not sure)



-- 
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


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

Posted by GitBox <gi...@apache.org>.
plainheart commented on code in PR #17849:
URL: https://github.com/apache/echarts/pull/17849#discussion_r1010162481


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

Review Comment:
   Should it be `dataViewShown` instead of `dataViewShowed`?



-- 
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


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

Posted by GitBox <gi...@apache.org>.
MainHou commented on code in PR #17849:
URL: https://github.com/apache/echarts/pull/17849#discussion_r1011246699


##########
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:
   I have made changes to the code, please review it again.  It will rebase after confirmation 



-- 
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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
plainheart commented on code in PR #17849:
URL: https://github.com/apache/echarts/pull/17849#discussion_r1010164448


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

Review Comment:
   @MainHou And here we can use provided `noop` from zrender util.
   ```ts
   import { noop } from 'zrender/src/core/util';
   ```



-- 
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


[GitHub] [echarts] echarts-bot[bot] commented on pull request #17849: feat(dataView): add dataViewOpend and dataViewClosed event, close #17840

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on PR #17849:
URL: https://github.com/apache/echarts/pull/17849#issuecomment-1296267778

   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
   
   Document changes are required in this PR. Please also make a PR to [apache/echarts-doc](https://github.com/apache/echarts-doc) for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the `PR: awaiting doc` label.


-- 
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


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

Posted by GitBox <gi...@apache.org>.
plainheart commented on code in PR #17849:
URL: https://github.com/apache/echarts/pull/17849#discussion_r1011298445


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

Review Comment:
   @Ovilia @MainHou I noticed the registered action doesn't respond to the corresponding command from the developer. That is, this PR is only for the event but not for action, which causes the developer can't open or close the data view programmatically. I think it makes sense to support this feature.
   
   ```js
   // show the data view programmatically
   myChart.dispatchAction({
     type: 'showDataView'
   })
   
   // hide the data view programmatically
   myChart.dispatchAction({
     type: 'hideDataView'
   })
   ```



-- 
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


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

Posted by GitBox <gi...@apache.org>.
Ovilia commented on code in PR #17849:
URL: https://github.com/apache/echarts/pull/17849#discussion_r1015138918


##########
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:
   @MainHou I didn't see `dispatchAction` in the test so this conversation hasn't been resolved yet.



-- 
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


Re: [PR] feat(dataView): add dataViewOpend and dataViewClosed event, close #17840 [echarts]

Posted by "YuShengHou (via GitHub)" <gi...@apache.org>.
YuShengHou closed pull request #17849: feat(dataView): add dataViewOpend and dataViewClosed event, close #17840
URL: https://github.com/apache/echarts/pull/17849


-- 
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