How can I use chart tooltip formatter?
See original GitHub issueHi, how can I use chart tooltip formatter?
I have config like this:
const CHART_CONFIG = {
...
tooltip: {
formatter: (tooltip) => {
var s = '<b>' + this.x + '</b>';
_.each(this.points, () => {
s += '<br/>' + this.series.name + ': ' + this.y + 'm';
});
return s;
},
shared: true
},
...
}
But I can’t access chart scope using this keyword and also I can’t get point from tooltip param.
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
tooltip.formatter | highcharts API Reference
To find the actual hovered Point instance, use this.chart.hoverPoint . For shared or split tooltips, all the hover points are available in this.chart....
Read more >Highcharts tooltip formatter - Stack Overflow
The tooltip formatter function has access to a number of different parameters. Instead of this.x , you could use this.point.name .
Read more >Tooltip - Chart.js
Generally this is used to create an HTML tooltip instead of an on-canvas tooltip. The external option takes a function which is passed...
Read more >How to Format Dates in the Tooltip in Chart.js - YouTube
How to Format Dates in the Tooltip in Chart.jsIn this video we will explore how to format dates in the tooltip in Chart.js....
Read more >JavaScript Chart Tooltips Formatting - jQWidgets
The first one is to specify format settings that will be applied when the tooltip is displayed. The second option is to define...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found the solution to this problem for those using Typescript. I thought I would share it for other Google Sleuthers
I think it should be:
Notice that the function name was missing parentheses.