Define a Global Custom Formatter for Highcharts

486 views Asked by At

We're using Highcharts to render many different charts in our web application.

We have a single Formatter object which utilizes Globalize.js to format numbers, currencies and dates. Our Formatter object basically wraps Globalize.js and it's set to format based on the users locale configuration.

In order to be consistent, we want to use the same Formatter to format the info in our charts - for example in the chart tooltips, labels, etc.

Up until now, for every chart we created, we added custom formatter functions (on the chart config) for fromatting the tooltips and labels.

Is there any way to define a global custom formatter in Highcharts for all currencies, numbers, dates, etc.?

1

There are 1 answers

0
Paweł Fus On

Of course, use Highcharts.setOptions() for example:

Highcharts.setOptions({
    tooltip: {
        formatter: function() {
            return "One tooltip to rule them all!";    
        }
    }
});

and jsfiddle: http://jsfiddle.net/3bQne/784/