-
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
Update tooltip custom label example #5454
Conversation
@jung35 can you build a jsfiddle with this change? |
I also added pointerevent none because you can't hover over data points with the tooltip blocking from hovering over data point here is example with |
docs/configuration/tooltip.md
Outdated
tooltipEl.style.left = position.left + tooltipModel.caretX + 'px'; | ||
tooltipEl.style.top = position.top + tooltipModel.caretY + 'px'; | ||
tooltipEl.style.fontFamily = tooltipModel._bodyFontFamily; | ||
tooltipEl.style.fontSize = tooltipModel.bodyFontSize + 'px'; | ||
tooltipEl.style.fontStyle = tooltipModel._bodyFontStyle; | ||
tooltipEl.style.padding = tooltipModel.yPadding + 'px ' + tooltipModel.xPadding + 'px'; | ||
tooltipEl.style.pointerEvents = 'none'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you used tabs here, but it's spaces everywhere else in the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, kinda made the change on github editor. defaulted to tabs
With var pos = this._chart.canvas.getBoundingClientRect();
var x = pos.left + window.pageXOffset;
var y = pos.top + window.pageYOffset;
// ...
el.style.left = x + tooltipModel.caretX + 'px';
el.style.top = y + tooltipModel.caretY + 'px';
// ... https://jsfiddle.net/r3Lz7371/16/ I think I prefer the |
|
I agree @simonbrunel @benmccann. Absolute is better to me |
@jung35 can you update to use |
The
canvas.getBoundingClientRect()
So the tooltip should also reflect that as fixed positioning and not absolute