Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong max extreme for the selection event in column charts #21058

Open
ollivih opened this issue Apr 23, 2024 · 3 comments
Open

Wrong max extreme for the selection event in column charts #21058

ollivih opened this issue Apr 23, 2024 · 3 comments

Comments

@ollivih
Copy link

ollivih commented Apr 23, 2024

Expected behaviour

The events.selection callback function should have correct x-axis min and max values reflecting the selected range.

Actual behaviour

In the events.selection callback function the x-axis max is incorrect with some range selections. For example, with following screenshot selection, the x-axis max is around 1, but it should be around 0.5.
image

Seems that the bug appears when the selection range min is left side of the zero point. I can also see, that the min value doesn't go lower than 0 even though the x-axis left border is less than 0 (not sure if that is desired).

Assuming that the same issue is with the x-axis min value when selecting a range near the right border.

Live demo with steps to reproduce

Issue can be replicated with this demo (make a mouse selection shown in the above screenshot): https://jsfiddle.net/50Lq6jfh/

Product version

Highcharts v11.4.1

Affected browser(s)

Likely all browsers

I believe this issue is related to #20784.

@hubertkozik
Copy link
Member

Hi @ollivih! Thank you for reporting the issue. The axis max value is correct, but the min value is wrong. This is a regression.

Demo with axis min/max logging: https://jsfiddle.net/BlackLabel/jbx4ydmh/

I've prepared a workaround for this issue. If you want to use it in your project just copy-paste the IIFE function to your project.

Workaround: https://jsfiddle.net/BlackLabel/asrfje0y/

Internal note:
Workaround is changing the floor and ceiling by adding/subtracting the minPointOffset.

@ollivih
Copy link
Author

ollivih commented Apr 24, 2024

I feel that also the max value is incorrect with some selections.

For example in this selection, the max value seems correct (1):
image

But in this selection, where the max is in the same place as in the previous, it gives 1.5 as the max value:
image

@hubertkozik
Copy link
Member

You're right @ollivih! My bad, sometimes the max values are incorrect also, but the workaround from my previous post is fixing max values also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants