apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.69k stars 19.62k forks source link

[Feature] Better api support for OndataZoom type #20461

Closed electroheadfx closed 3 weeks ago

electroheadfx commented 3 weeks ago

What problem does this feature solve?

Could you add a better support for dected zoom type on onDataZoom event ?

const ondataZoom = (param: any) => {
    const zoomID = param.batch[0].dataZoomId.toString()
    if (zoomID === '\x00series\x001\x000') {
      // zoom Y are handled
      console.log('zoom Y handled', [param.batch[0].start, param.batch[0].end])
    }
    if (zoomID === '\x00series\x000\x000') {
      // zoom X are handled
      console.log('zoom X handled', [param.batch[0].start, param.batch[0].end])
    }
  }

so '\x00series\x001\x000' is vertical zoom and '\x00series\x000\x000' is horyzontale,

What does the proposed API look like?

Could you and a better name for exemple

if (param.batch[0].dataZoomType === 'y') { // store dataZoom Y values array } if (param.batch[0].dataZoomType === 'x') { // store dataZoom X values array }

electroheadfx commented 3 weeks ago

If the dataZoom options contains an named ID per axis, for exemple for inside xAxis #0 : id:'zoom-inside-x-0', I can track them with api ! very nice concept.