-
Notifications
You must be signed in to change notification settings - Fork 569
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
Customizing tooltips #46
Comments
There's no way right now. There's a pull request for changing the date format which I'll look at when I get the chance. ankane/chartkick.js#11 For price, I would round in Ruby until there's a better solution. |
Sorry @jancantor, totally missed your comment. There's no way to do this right now. Customizing tooltips will be one of the next features. |
It's a bit late, but I've found recently how to change the tooltip for highcharts. You can use Documentation: http://api.highcharts.com/highcharts#plotOptions.series.tooltip.pointFormat <%= column_chart [
["Very Poor", p[1]],
["Poor", p[2]],
["Average", p[3]],
["Above Average", p[4]],
["Excellent", p[5]],
["N/A", p[6]]
],
height: "220px",
library: {
tooltip: {
pointFormat: 'Awesome values: <b>{point.y}</b>'
}
} %> |
@vdmgolub Thank you, it works! |
Do we already have a way to change the tooltip? |
Does Tooltip Customization feature is added ?? @ankane |
Since you can update your chart from JS, try this : function customTooltip() {
// some logic
}
var chart = Chartkick.charts['yourChart'];
chart.options.library.tooltips.custom = customTooltip;
chart.setOptions(chart.options); |
Thanks @MatthieuGC 👍 Can a few people interested in this feature gives examples of how they want to use it? This will help with designing it. Current ideas:
|
One more call for examples. Then closing this out. |
Hi @ankane , sorry I'm not using this anymore. All the three example you have provided would have been fine for me at the moment I've needed it. |
@ankane I'd vote for option 2! {
"name": "Example",
"data": [ 1, 2, 3 ],
"tooltips": [ "First", "Second", "Third" ]
} Doesn't break the current interface, and is more flexible than 3. I'd also suggest that it's important to support things like line breaks ( Something that I'm currently working towards would appreciate a tooltip looking something like this:
I appreciate that the Graph's JSON will bloat quite considerably... but other options that support this flexibility get complex fast. |
Just in case it's helpful at all in the feature planning process, I wanted to also chime in with an example of why I would want to customize the tooltips for some of my graphs. In short, I'd like to use the tooltips to "dive in" to a datapoint in most graphs and display a third axis of data that I wouldn't want "at a glance" on the chart, but rather expose for a particular point when a user expresses some interest in it (e.g. hovering over a datapoint). For example, here's one graph of the number of words in each sentence of a document: Hovering over sentence 39's bullet and seeing "Sentence 39: 35 words" is fine and dandy, but... I'd much rather be able to show the actual sentence in the tooltip instead of the x/y values. Here, the intent is to highlight clusters of sentences with low/high variety in length, so being able to quickly view the actual sentences being displayed makes a lot of sense in determining what to do with them (should I shorten them? lengthen them?), but plotting the actual sentence on the graph doesn't make a lot of sense. I would be happy to fandangle data into any format for this, but my ideal structure would look something like:
|
I do not care much how you design it. The data needs to be massaged into the chart anyway, so massaging tooltips one way or another is a wash. I do want to give it my full support though, because being able to change tooltips in ruby would be a godsend for me. |
Is it possible to include the full functionality of tooltip configuration as provided by Charts.js including callbacks? -> https://www.chartjs.org/docs/latest/configuration/tooltip.html I'd love the possibility to change the different elements of the tooltip like title, label etc. |
I'd like also to be able to customize the tooltips, directly from chartkick and not doing special JS hacks updating the chart. |
@MatthieuGC What did you use to wait for the chart to load before trying to access it? |
BTW for anyone having issues with this... for some reason, |
FYI for anyone wanting to customize the date/time format in a Chartjs time chart, you can already use such as:
for tooltips such as Follow this guide for labeling in the requested format: OR, you can pass
|
I am having an issue now where I am charting a numerical value, but want to display a formatted value in the tooltip. I have tried @MatthieuGC 's solution. I would also like to know the answer to @activklaus 's question. Can we configure using callbacks? If so, how? I cannot get it working like this in the line_chart options:
|
It would be great to pass in a partial that contains the layout of the custom tooltip. |
Hi,
I'm using
chartkick
andgroup_date
for a multiple series chart like the one in the readme, let's say:Is there a way to customize the tooltip via chartkick? (In the above example, I need to change
date
format and roundprice
to the second decimal)TIA
The text was updated successfully, but these errors were encountered: