question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scroll event may prevent after use inside dataZoom

See original GitHub issue

Version

4.2.1-rc.3

Reproduction link

https://codepen.io/gfwer/pen/maJGNz

Steps to reproduce

  1. add an inside dataZoom(in this instance I set zoomOnMouseWheel:'shift')
  2. mouse hover in the chart grid and scroll the mouse

What is expected?

page scroll

What is actually happening?

scroll event may prevent , I can 't scroll page when I move mouse over the chart grid

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:33 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
hoshitomicommented, Apr 12, 2019

This problem still seems to exist on 4.2.1 (but works fine on 4.1.0), I can’t scrll page when the mouse hover in grid, here is my DataZoom option:

	{
		type: 'inside',
        zoomOnMouseWheel:'shift',
		preventDefaultMouseWheel: false
	}

A CodePen here

It seems event is stopped by eventTool.stop(e.event)

3reactions
kaihenzlercommented, May 19, 2022

I wanted to share my workaround for this issue.

  • The basic idea is to disable zooming by setting zoomLock: true
  • Add keyboard event listener to the window for keyup and keydown
  • Alter the settings of the echarts instance by setting zoomLock: false while a specific key is pressed
  • set zoomLock: true when the key is released again

This can be done with vanilla JS or any ui library.

Here you can see how it’s done in Angular: https://stackblitz.com/edit/angular-ngx-echarts-qd5up4?file=src/app/app.component.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

scroll event may prevent after use inside dataZoom #10079
The mouse events are captured by the graph, which causes the problem. The workaround is basically a bypass – subscribing to the mouse...
Read more >
[GitHub] [echarts] Orangat commented on issue #10079: scroll e...
[GitHub] [echarts] Orangat commented on issue #10079: scroll event may prevent after use inside dataZoom · GitBox Fri, 05 Feb 2021 02:44:09 -0800....
Read more >
How to scroll with mouse wheel and keyboard on vertical ...
I have tried the datazoom configurations moveOnMouseWheel and moveOnMouseWheel but that only zooms the chart. i don't want it to zoom. the ...
Read more >
See How It Works
With Datazoom, you can add datapoints to existing JSON streams such as combining ad CPM with ad-event data. This can reduce the amount...
Read more >
Event and Action - Concepts - Handbook - Apache ECharts
The following example shows how to highlight each sector one by one in the pie chart using dispatchAction . option = { tooltip:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found