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

Some Raphael tags Not appearing on Linechart Mouseover #163

Open
ghost opened this issue Jul 30, 2012 · 1 comment
Open

Some Raphael tags Not appearing on Linechart Mouseover #163

ghost opened this issue Jul 30, 2012 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 30, 2012

jsfiddle - http://jsfiddle.net/QrSWz/2/

As can be seen, the 2nd,10th & 13th labels (tags in Raphael language) do not appear on mouseover of their respective graph points (at least not in the viewable area). The problem gets worse (ie more missing tags) when you add more points. Anyone know what the issue might be?

@markdwhitehouse
Copy link

I accidentally posted this on the raphael bug list and not here, so i'll post again. Ran into the same issue yesterday with the linechart, so decided to find a fix.... The issue is that the hover column widths computed incorrectly.

The index ordering of Xs and Xs2 in the createColumn method is important for properly computing column widths. With Xs.length > 10, you get into this situation:

[0, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 2, 3, 4, 5, 6, 7, 8, 9]

which leads to width values like the following (printing w from line 203):

w = 16.315789473684212
w = 113.15789473684211
w = 113.15789473684208
w = 22.63157894736841
w = 22.63157894736844
w = 22.63157894736844
w = 22.63157894736841
w = 22.63157894736841
w = 22.63157894736844
w = 22.63157894736841
w = 22.63157894736841
w = -181.05263157894734
w = -181.05263157894734
w = 22.631578947368425
w = 22.631578947368425
w = 22.63157894736841
w = 22.631578947368425
w = 22.631578947368425
w = 22.63157894736841
w = 129.4736842105263

You need to do a comparison sort. One fix is to change:

line 185 -> Xs.sort(function(a,b){return a - b});
line 195 -> Xs = Xs2.sort(function(a,b){return a - b});

After updating those lines, I get nice values again:

16.315789473684212
22.631578947368425
22.631578947368418
22.631578947368425
22.631578947368425
22.63157894736841
22.631578947368425
22.631578947368425
22.63157894736841
22.631578947368425
22.63157894736841
22.63157894736841
22.63157894736844
22.63157894736844
22.63157894736841
22.63157894736841
22.63157894736844
22.63157894736841
22.63157894736841
16.31578947368422

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

No branches or pull requests

1 participant