You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/10/30 10:17:20 UTC

[GitHub] aengl opened a new issue #9303: setOption() causes brush controls to disappear

aengl opened a new issue #9303: setOption() causes brush controls to disappear
URL: https://github.com/apache/incubator-echarts/issues/9303
 
 
   ### One-line summary [问题简述]
   
   If `setOption()` is called more then once, brush controls disappear.
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]: 4.2.0-rc.2
   + Browser version [浏览器类型和版本]: Google Chrome 70.0.3538.77 (Official Build) (64-bit)
   + OS Version [操作系统类型和版本]: macOS Mojave 10.14
   
   ### Expected behaviour [期望结果]
   
   It should still be possible to use brushes on the graph after updating its data via `setOption()`.
   
   ### ECharts option [ECharts配置项]
   ```javascript
   var option = {
     brush: {},
     series: [
       {
         data: [[1, 1], [2, 2]],
         type: 'scatter',
       },
     ],
     xAxis: {},
     yAxis: {},
   };
   ```
   
   ### Other comments [其他信息]
   Here is an html file that replicates the issue:
   
   ```
   <html>
   
   <head>
     <meta charset="utf-8">
     <script src="./node_modules/echarts/dist/echarts.min.js"></script>
   </head>
   
   <body>
     <div id="main" style="width:600px; height:400px;"></div>
     <script type="text/javascript">
       var myChart = echarts.init(document.getElementById('main'));
       var option = {
         brush: {},
         series: [
           {
             data: [[1, 1], [2, 2]],
             type: 'scatter',
           },
         ],
         xAxis: {},
         yAxis: {},
       };
       myChart.setOption(option);
       setInterval(() => {
         // Bug: this setOption() call makes the brush controls disappear!
         myChart.setOption(option);
         // If we set "notMerge" to true the controls won't disappear, but now it
         // becomes impossible to interact with the chart since the setOption()
         // call now cancels all existing brushes
         // myChart.setOption(option, true);
       }, 1000);
     </script>
   </body>
   
   </html>
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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