Format Highcharts y-axis labels

后端 未结 2 1128
甜味超标
甜味超标 2021-02-12 03:35

I\'m using Highcharts to generate a line chart that shows currency values. By default the y-axis labels use metric prefixes for abbreviation, e.g. 3k is displayed instead of 300

2条回答
  •  暖寄归人
    2021-02-12 04:32

    You can call the original formatter from your formatter function:

    $(function () {
        $('#container').highcharts({
    
            yAxis: {            
                labels: {
                    formatter: function () {
                        return '$' + this.axis.defaultLabelFormatter.call(this);
                    }            
                }
            },
    
            series: [{
                data: [15000, 20000, 30000]
            }]
    
        });
    });
    

    http://jsfiddle.net/x6b0onkp/2/

提交回复
热议问题