amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
324 stars 90 forks source link

Ctrl key event + On-demand loading changes the position of cursor #1410

Closed workingbuddy10 closed 3 months ago

workingbuddy10 commented 4 months ago

I am using on-demand loading of stock chart, and I have also added the ctrl key zoom feature.

But when I am pressing the ctrl key and trying to load the data the cursor moves/shifts from the initial position. Ideally it should not happen.

Any way in amcharts to hold the cursor position when zooming out or loading the data via wheelended event.

In first half of the video currently how it is working, and in second half ideally what should happen:

https://github.com/amcharts/amcharts5/assets/137867461/d9f08398-9dde-4eaa-85c7-f813bc8eaddd

martynasma commented 4 months ago

That doesn't seem like a amCharts bult-in functionality. We do not have anything that is affected using CTRL key.

If you can distill a specific question about specific functionality, please do so, and provide a CodePen to demonstrate.

Hope that sounds reasonable.

workingbuddy10 commented 4 months ago

Sure @martynasma

Just point out the cursor at one candlestick, and then zoom -out + ctrl key. More data will load but the cursor position will also shift ( which I don't want).

https://codepen.io/Ansh-m-the-reactor/pen/abxpLxB

you can see my cursor is shifting :

https://github.com/amcharts/amcharts5/assets/137867461/3b01b71f-a28f-4885-a8f2-633a04dce92a

martynasma commented 4 months ago

OK, so what happens, the overzoomed part gets reset when you update data.

The only workaround I can think of is to log X-axis' private variables selectionMin and selectionMax before loading data, then do zoomToValues() after series' datavalidated kicks in.

workingbuddy10 commented 4 months ago

Isn't there any better or reliable way to achieve this? Like I'll be having live data coming too + on-demand loading.

The only workaround I can think of is to log X-axis' private variables selectionMin and selectionMax before loading data, then do zoomToValues() after series' datavalidated kicks in.

martynasma commented 4 months ago

Not sure. Maybe disable overzoom?