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

HTML Table within Tooltip callback #3734

Closed
azcanada opened this issue Dec 21, 2016 · 4 comments
Closed

HTML Table within Tooltip callback #3734

azcanada opened this issue Dec 21, 2016 · 4 comments

Comments

@azcanada
Copy link

Hi there,

I am trying to create a HTML table within a label callback function.

Within the function we are querying a database based upon the point on the data selected. The query works perfectly as I can document.write(queryanswer) to create my table in a new table.

However when I try to add the table within the tooltip I only get the text and not the formatted html. I think this is because the tooltip is a SVG. I attempted using a foreign object but still no luck.

The only other idea I came across was to use the customtooltip which will allow me to use html but I can not find a way to find the define the variables from the graph for the query.

Is there support for this?

Many thanks in advance

@etimberg
Copy link
Member

@azcanada do you have an image of what you are trying to achieve? The current tooltip is drawn on the canvas so it won't support HTML.

Have you looked at the https://github.com/chartjs/Chart.js/blob/master/samples/tooltips/line-customTooltips.html sample?

The other option is to use the work merged in #3718 (not yet released) and write a plugin that handles the mouse events to conditionally display the table.

@azcanada
Copy link
Author

azcanada commented Dec 21, 2016 via email

@etimberg
Copy link
Member

Sure we can leave this open. I'll do some thinking about better ways to handle this. You might even be able to use the hover.onHover callback https://github.com/chartjs/Chart.js/blob/master/src/core/core.controller.js#L668 to trigger the table when an item is hovered. Would work in the last release version to get you going until you can use the plugin stuff.

@etimberg
Copy link
Member

Closing as out of date

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

3 participants