question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to use callback function for tooltop.formatter?

See original GitHub issue

At javascript:

tooltip: {
    formatter: function () {
        return new Date(this.x).toLocaleString() + '<br><b>内存:</b>' + byte_to_string(this.y)
    }
}

But typescript this is a class.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ceborcommented, Sep 27, 2016

The options object gets extracted from the Charts object, so it should work as you described.

new Chart({
...
tooltip: {
  formatter: function () {
     return new Date(this.x).toLocaleString() + '<br><b>内存:</b>' + byte_to_string(this.y)
  }
}
...
});

Docs: http://www.highcharts.com/docs/chart-concepts/tooltip

0reactions
vapaocommented, Oct 9, 2016

yes, is solved. thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Format tooltip with custom callback function formatter
The following code shows how to format tooltip with custom callback function formatter. Example. <!DOCTYPE html> <html> ...
Read more >
tooltip.formatter | highcharts API Reference
A callback function to place the tooltip in a custom position. The callback receives three parameters: labelWidth , labelHeight and point , where...
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 . For example:...
Read more >
Tooltip - Chart.js
A tooltip item context is generated for each item that appears in the tooltip. This is the primary model that the callback methods...
Read more >
Chart Js Tooltip Callback Customize | Chartjs 3 - YouTube
Chart Js Tooltip Callback Customize | Chart.JS 3In this video we will answer a viewers question regarding to migrating from Chart.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found