amcharts / amcharts3

JavaScript Charts V3
Other
395 stars 129 forks source link

Be more conservative with scroll / mousewheel event listeners #83

Open Fredlewis2 opened 7 years ago

Fredlewis2 commented 7 years ago

I have a project that displays about 10 serial charts stacked vertically. Each chart displays live-updating data, so they are often redrawing. If scrolling the page when a redraw happens, the smooth scroll freezes momentarily. This is annoying when graphs are updated often.

After some research, I found that that the reason for the freeze was that amcharts registers global, non-passive listeners on window:DOMMouseScroll and document:mousewheel. I was able to work around the issue by forcing those listeners to register as passive (something similar to https://www.npmjs.com/package/default-passive-events) though this is not a real solution because amcharts' listener requires the use of preventDefault() when mouse-wheel zooming is enabled.

I think a proper solution, if possible, would be for amcharts to register a mousewheel listener only on graphs that have mouse-wheel zooming enabled.

martynasma commented 7 years ago

Thanks for the info!

I'll pass it on to development for further review.