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 2020/06/25 06:15:28 UTC

[GitHub] [incubator-echarts] yuanzhou3118 commented on issue #8002: 【求教】有没有办法让graph用roam缩放的时候,label的字体大小也能一起缩放

yuanzhou3118 commented on issue #8002:
URL: https://github.com/apache/incubator-echarts/issues/8002#issuecomment-649245000


   已通过graphRoam实现:
   ```javascript
        // 鼠标滚轮监听放大缩小
        myECharts.on('graphRoam', function(e) {
           const option = that.echartsGraph.getOption(); // 获得当前option.series的zoom
           const textPercent = (option.series[0].zoom - 0.8) / 0.8; // 计算比例,我设置zoom的初始值是0.8
           option.series[0].label.fontSize = 9 + 9 * textPercent // 等比例计算fontSize
           that.echartsGraph.setOption(option); // setOption
         });
   ```
   同理可以加在toolbox内的自定义的“放大”和“缩小”按钮上
   
   希望可以帮助到其他同学 :stuck_out_tongue_closed_eyes:


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

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