-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Custom Tooltips - X coordinate unpredictable for points in second half of dataset #2636
Comments
@etimberg This is actually for version 2.x, experiencing it in 2.0.2 specifically. |
I'm able to circumvent the issue by commenting out
on line 11604 in Chart.bundle.js though I suspect a more elegant solution is possible. I'm also setting
|
I think it's the alignment settings but I'll give it some debugging |
Running into further issues even with that line commented out. Here is a screenshot to demonstrate. Using a simple 1px red vertical line to debug. How can I reliably get the x coord that is at the center of the point? The x value seems to vary - I'm not sure why, perhaps based on the actual value of the point. It makes achieving the following style quite difficult: Is it possible for them to be evenly spaced? |
I think the Label Version 2.x should be kept for this bug. |
I am also experiencing this issue in v2.3.0. Has anyone found a workaround/fix? @elzii ? Thanks. |
@elzii you can probably compute the correct point using the alignment options and the given point until a PR can fix this. I will likely add something to fix this as part of my tooltip work in v2.4 hence why this is targeted to v2.4 |
my workaround is using a custom hover function and get the correct values from it.
lookout for _view.x and _view.y |
Thank you for the responses, it is much appreciated. Due to time pressure I had to revert to the standard tooltip. |
Hi, onHover objects has no x a y coordinates, Is there any other way to do the positioning, I can stick easily with original tooltips but when I change the tooltip using custom: fucntion() - like adding some lines, the position is screwed up... Please some help, this is really annoying, we have such a great feature to do custom tooltips but we have no chance to position them right? I dont believe it, there must be a easy way to do this for sure... |
I moved in front of in chart.js and everything works just as expected... is there a reason this is not done ? because i tested most of graphs a made with this and it works just great... |
@StealthyDamn the position is indeed correct when you move that if statement but in our code the tooltip doesn't dissapear anymore except for when we hover another item that has the tooltip(then that one sticks), are you seeing the same behavior? I've added a check in the custom tooltip function if the tooltip is aligned left or right.
|
@sambruggeman no, I am using the latest version with that modificatin and tooltips are dssapearing correctly. |
@StealthyDamn weird, I've also updated to latest version and still have the issue.. either way my addition above fixes the problem for us without going in the chart.js .. not sure if it's actually working as intended or if this is an actual bug .. |
@sambruggeman I dont know, maybe it is happeining only with some options or so, I use pretty big code to generate the graphs, many options changed. |
@sambruggeman's solution is the best way to deal with this until we expose the top left of the tooltip regardless of the alignment. This is currently targeted to v2.4 (next release) and will be fixed soon. We will likely add some new properties to expose the (left, top) which can be used |
okay, nice, I will stick with my solution since it works and i have my code around it, but will upgrade as soon as 2.4 will come out. I am always sticking with latest version since the charts.js development is great, every new version is much better and I love that. |
Fixed in #3472 see the new caretX and caretY properties |
JSBin here:
http://jsbin.com/beguzuveki/1/edit?js,output
To demonstrate, hover over the point in for JUNE, then JULY
It looks like a product of the default tooltip styling where the caret is situated to the left/right, but I'm unsure how to resolve for this custom implementation
The text was updated successfully, but these errors were encountered: