Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts numberformat

name: 'Name',
data: [1.57,1.57,1.51,1.44,1.44,1.37,1.35,1.33,1.33,1.27,1.27,1.24,1.22,0.98],
    color: '#A61E22',
    dataLabels: {
        enabled: true,
        rotation: -90,
        color: '#000000',
        align: 'right',
        x: 4,
        y: -35,
        style: {
            fontSize: '10px',
            fontFamily: 'Verdana, sans-serif'
        }
    }                                       
}]

I have the following code. Is there any way to use the function number format throughout the series? I need to replace the dots by commas. I need the number format like this:

number_format (series_values, 2, ',', '.');
like image 415
Joaquimn Avatar asked Nov 28 '22 17:11

Joaquimn


2 Answers

Highcharts.setOptions({
    lang: {
        decimalPoint: ',',
        thousandsSep: '.'
    },

    tooltip: {
        yDecimals: 2 // If you want to add 2 decimals
    }
});

Demo

Reference

  • http://api.highcharts.com/highcharts#lang.decimalPoint
  • http://api.highcharts.com/highcharts#lang.thousandsSep
  • http://api.highcharts.com/highstock#tooltip.yDecimals
like image 173
Ricardo Alvaro Lohmann Avatar answered Dec 05 '22 01:12

Ricardo Alvaro Lohmann


Not sure yDecimals is working now. Seem to be tooltip.valueDecimals now.

Here what I'm using :

Highcharts.setOptions({
    lang: {
        decimalPoint: ',',
        thousandsSep: '.'
    }
});

And in the chart :

tooltip: {
    valueDecimals: 2 
},
like image 25
Yoann Augen Avatar answered Dec 05 '22 02:12

Yoann Augen