amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
Other
342 stars 91 forks source link

Pan only, no zoom, on cursor scroll? #291

Closed cwooldridge1 closed 2 years ago

cwooldridge1 commented 2 years ago

I've noticed on the pan setting on the chart that when you pan it doesn't just pan it also affects the zoom level of the x-axis. This trait is mainly apparent when panning towards the most recent data (scrolling in). What I am envisioning is when scrolling in the width of the zoom stays the same but the x-axis position of both the selectionMin and selectionMax get incremented the same amount instead of the current way of the selectionMin being incremented by more than the selectionMax. Does this make sense?

Also, I noticed that the zoomMinCount on the new GaplessDateAxis is very off. In my code pen the minZoomCount is 10 and I can zoom in up to to two increments. https://codepen.io/cwooldridge1/pen/eYeexee?editors=1011

Thanks

martynasma commented 2 years ago

I suppose this is because of over-zooming, which is enabled by default. You can turn it off by setting maxDeviation: 0 in your axis settings:

https://www.amcharts.com/docs/v5/charts/xy-chart/zoom-and-pan/#Over_zooming

P.S. can you post the zoomMinCount thing as a separate issue? It's unrelated, and might be a bug. Thanks.

cwooldridge1 commented 2 years ago

I'm sorry I must have been unintentionally ambiguous with the above statement. What I am referring to is I want the range of the zoom to remain consistent when panning inwards. Panning on the current chart when zooming outward keeps a consistent zoom width (what I want) but when you start to pan inward (toward recent data) the pan's width decreases until the zoomMinCount condition is met. For example, panning back in time keeps a consistent width of the following: **

image

** However once I start to pan inwards (toward recent data) the zoom width decreases to the min zoom count:

image

After only a few scrolls the width of my zoom in reduced to the minimum zoom count (the number of elements in the zoom should stay consistent until the end of the series data is met like how panning outward does). This would be ok if I reached the end of the series data but there is still much more data (in the image above) that can be panned over. I want the width to remain constant when zooming in (until the end of the series) such as how zooming out does.

P.S. I made a new issue for the zoomMinCount as requested. Thank you for all your time

martynasma commented 2 years ago

Hm, yeah, that must be a bug. It should not zoom at all of wheelY: "panX" is set.

We'll need to fix this.

Thanks for thorough explanation!

keegandonley commented 2 years ago

Following this issue as it's become problematic for my implementation as well

martynasma commented 2 years ago

Fixed in 5.1.5.

[5.1.5] - 2022-02-22

Added

Changed

Fixed

Full change log.

Download options.

Make sure you clear your browser cache after upgrading. And feel free to contact us again if you are still experiencing this issue.