hihiro commented on issue #17662: URL: https://github.com/apache/echarts/issues/17662#issuecomment-1249250268
@plainheart 想问下,echarts 现在支持自定义这种缩放按钮吗?或者有没有相关的 api? 也需要支持鼠标拖动时,选择一个区域,进行缩放,我目前的实现: ```js function onZoom () { // 框架:vue3 chart 是 echarts 实例 chart.value?.dispatchAction({ type: 'dataZoom', // 开始位置的百分比,0 - 100 这样设置确实可以进行缩放,但是需求是支持鼠标拖动 start: 20, // 结束位置的百分比,0 - 100 end: 80, }) chart.value?.on('mousedown', () => { chart.value?.on('mousemove', onMouseMove) }) chart.value?.on('mouseup', () => { chart.value?.off('mousemove', onMouseMove) }) } // 这个函数只有在 echarts 绘制的线段上时,才会触发 function onMouseMove() { // something.... } ``` -- 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