You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "tkdwns1245 (via GitHub)" <gi...@apache.org> on 2025/11/12 09:23:28 UTC

[I] [Feature] Allow drag-to-zoom even when toolbox.feature.dataZoom.show is false [echarts]

tkdwns1245 opened a new issue, #21367:
URL: https://github.com/apache/echarts/issues/21367

   ### What problem does this feature solve?
   
   **Summary**
   
   Currently, the rectangle drag-to-zoom gesture seems to be tied to the toolbox dataZoom feature. If I hide the toolbox button (toolbox.feature.dataZoom.show = false), I can still zoom with the mouse wheel via dataZoom: [{ type: 'inside' }], but I cannot drag-select a range to zoom. I’d like to enable the same drag-to-zoom gesture without showing the toolbox button.
   
   **Use cases**
   
   Clean/minimal UI where we don’t want any toolbar buttons.
   
   Kiosk or embedded dashboards where gestures (wheel/drag) are preferred to visible controls.
   
   Custom toolbars that control zoom state, while keeping ECharts’ native drag-zoom gesture.
   
   **Current behavior**
   
   dataZoom: [{ type: 'inside' }] enables wheel/pinch zoom and panning, but there is no built-in rectangle drag gesture unless the toolbox dataZoom button is visible and toggled.
   
   **Desired behavior**
   
   Provide a config to enable drag-to-zoom gesture independently of the toolbox visibility.
   
   Example: users can hold a modifier key (e.g., Shift) and drag to select a window to zoom, or simply drag without a modifier (configurable).
   
   **Live demo (CodeSandbox)**
   
   Minimal repro: https://codesandbox.io/p/sandbox/dmwjy9
   
   ### What does the proposed API look like?
   
   dataZoom: [{
     type: 'inside',
     dragToZoom: true,         // NEW: enable rectangle drag zoom
     dragModifierKey: 'shift', // 'none' | 'shift' | 'ctrl' | 'alt' (optional)
     dragDirection: 'auto',    // 'x' | 'y' | 'auto'
   }]
   
   
   (or) expose this via a new top-level interaction option:
   
   interaction: {
     dragZoom: { enable: true, modifierKey: 'shift', axis: 'x' }
   }
   
   
   Workarounds tried
   
   dataZoom: [{ type: 'inside' }] → wheel zoom works, but no rectangle drag.
   
   brush component can draw rectangles, but doesn’t behave like a smooth zoom gesture and needs additional glue code.
   
   Custom pointer handlers → re-implementing zoom logic becomes non-trivial (coord transforms, axis sync, etc.).


-- 
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.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: [I] [Feature] Allow drag-to-zoom even when toolbox.feature.dataZoom.show is false [echarts]

Posted by "unitrongroup-ir (via GitHub)" <gi...@apache.org>.
unitrongroup-ir commented on issue #21367:
URL: https://github.com/apache/echarts/issues/21367#issuecomment-6024706082

   +1, we needed the same thing (Plotly-like drag zoom with our own zoom buttons outside the chart).
   
   In case it helps someone until this is there: we keep the toolbox but make it invisible with `itemSize: 0`. With `show: false` the feature isn't rendered at all and dragging does nothing. Then we switch the select mode on ourselves:
   
   ```js
   toolbox: {
     show: true,
     itemSize: 0,
     showTitle: false,
     feature: { dataZoom: { yAxisIndex: 'none', filterMode: 'none' } }
   }
   ```
   
   ```js
   chart.dispatchAction({ type: 'takeGlobalCursor', key: 'dataZoomSelect', dataZoomSelectActive: true });
   ```
   
   After `setOption(option, { notMerge: true })` the select mode is off again, so we dispatch it after every update. Dispatch it with `dataZoomSelectActive: false` before the `setOption` too, otherwise you run into #21661.
   


-- 
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: [I] [Feature] Allow drag-to-zoom even when toolbox.feature.dataZoom.show is false [echarts]

Posted by "aviralgarg05 (via GitHub)" <gi...@apache.org>.
aviralgarg05 commented on issue #21367:
URL: https://github.com/apache/echarts/issues/21367#issuecomment-3586290439

   I would like to solve this issue


-- 
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: [I] [Feature] Allow drag-to-zoom even when toolbox.feature.dataZoom.show is false [echarts]

Posted by "famouspotatoes1 (via GitHub)" <gi...@apache.org>.
famouspotatoes1 commented on issue #21367:
URL: https://github.com/apache/echarts/issues/21367#issuecomment-4167003876

   Is this feature still planned? I think this would be a great improvement, over the current toolbox where you must first click the zoom button before zooming with a rectangle. Directly dragging a rectangle to zoom is a better experience.


-- 
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: [I] [Feature] Allow drag-to-zoom even when toolbox.feature.dataZoom.show is false [echarts]

Posted by "Joseph-D-Bradshaw (via GitHub) via commits" <co...@echarts.apache.org>.
Joseph-D-Bradshaw commented on issue #21367:
URL: https://github.com/apache/echarts/issues/21367#issuecomment-7012381939

   This is something I am also interested in, currently we will go with the proposed solution by @unitrongroup-ir - but are pinning this issue to hopefully utilise a better API when/if it comes along.


-- 
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: [I] [Feature] Allow drag-to-zoom even when toolbox.feature.dataZoom.show is false [echarts]

Posted by "Deepak-negi11 (via GitHub)" <gi...@apache.org>.
Deepak-negi11 commented on issue #21367:
URL: https://github.com/apache/echarts/issues/21367#issuecomment-3735549412

   @tkdwns1245  can you please assign this to me 
   


-- 
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: [I] [Feature] Allow drag-to-zoom even when toolbox.feature.dataZoom.show is false [echarts]

Posted by "AndreFavotto (via GitHub)" <gi...@apache.org>.
AndreFavotto commented on issue #21367:
URL: https://github.com/apache/echarts/issues/21367#issuecomment-5399747027

   +1 for this feature
   Having to click on the toolbox option to be able to zoom is not very intuitive. I'd expect a behaviour similar to Plotly, for example.


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