Highcharts do not inherit the number format you set up in wpDataTables, and there are no built-in options to change the number format in the chart, but you can use wpdatachart callbacks. Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. You can use it for adding options that are available in Highcharts API.

In this example we will show you how to use Highcharts.setOptions to change the decimal separator from point ( . ) to a comma ( , ). In the callback you can see how to change the number of decimal places after the separator ( , ) from default 2 to 3. We use the method wpDataChartsCallbacks where 93 is id of the chart for which we want to apply these settings.

<script type="text/javascript">
jQuery(window).load(function(){
Highcharts.setOptions({
        lang: {
            decimalPoint: ','
        }
    });
    if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
    wpDataChartsCallbacks[93] = function(obj){
        obj.options.tooltip = {
            pointFormat: "Distance: {point.y:.3f} km"
        };
    }
});
</script>

Was this answer helpful ? Yes (0) No (0)

Comments are closed.

Do you have the best

essential plugins installed?

Grab the best 46 plugins. Tested and sorted.

Plugins for SEO, Caching, Security, Design and UX, Stats & analytics, Social sharing. Only the best ones.

By clicking "subscribe" you consent that the information you provide via this form will be securely processed and stored in compliance with EU privacy laws (GDPR).

Thank you for subscribing! Please check your inbox to download the WordPress goodies.