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

Inconsistent behavior in xaxis labels when using ellipses. #6258

Closed
jasdeep26 opened this Issue Jan 18, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@jasdeep26

jasdeep26 commented Jan 18, 2017

Expected behaviour

Should consistently show first n letters of each category if space permits.

Actual behaviour

Skipping the first letter in some of the categories (specially with word length is a multiple of 5) even if the space permits.

Live demo with steps to reproduce

Minimalist example
http://jsfiddle.net/reckutq8/

Affected browser(s)

All browsers

@jasdeep26

This comment has been minimized.

Show comment
Hide comment
@jasdeep26

jasdeep26 Jan 18, 2017

Fix:
In Highcharts v5.0.6, change condition in line number 4343
from : if (wordStr === '' || (!tooLong && cursor < 0.5))
to : if ((wordStr === '' || !tooLong) && cursor <= 0.5) {

Root Cause:
Since we are using Math.ceil on the binary search cursor, it goes from 5, 2.5, 1.25, 0.625
which makes the actual word length go from 5, 2, 0.
Now since word string becomes empty, it returns empty word.
But the fact is that we never checked for word length 1.
So in the fix provided, we will always continue to check as long as the cursor value is less than or equal to 0.5 implying that we have not yet checked for word length 1 yet.

Example with updated script.
http://jsfiddle.net/reckutq8/2/

jasdeep26 commented Jan 18, 2017

Fix:
In Highcharts v5.0.6, change condition in line number 4343
from : if (wordStr === '' || (!tooLong && cursor < 0.5))
to : if ((wordStr === '' || !tooLong) && cursor <= 0.5) {

Root Cause:
Since we are using Math.ceil on the binary search cursor, it goes from 5, 2.5, 1.25, 0.625
which makes the actual word length go from 5, 2, 0.
Now since word string becomes empty, it returns empty word.
But the fact is that we never checked for word length 1.
So in the fix provided, we will always continue to check as long as the cursor value is less than or equal to 0.5 implying that we have not yet checked for word length 1 yet.

Example with updated script.
http://jsfiddle.net/reckutq8/2/

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