1

我的 X 轴包含年份。如何删除格式中的千位分隔符?或者,我如何告诉 Highcharts 这是一年?

http://jsfiddle.net/nicholasduffy/BDQVV/

$(function () {
    var chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'column',
            },
            xAxis : {
                label: {
                    formatter: function () {
                        return Highcharts.numberFormat(this.x, 0, '', ''); // Remove the thousands sep?
                    }
                }
            },
            series: [{"data": [[2006, 1], [2007, 5], [2008, 7], [2009, 7], [2010, 13], [2011, 14], [2012, 16], [2013, 20]], "name": "Series1"}, {"data": [[2012, 3], [2013, 3]], "name": "Series2"}, {"data": [[2002, 1], [2003, 1], [2004, 6], [2005, 7], [2006, 10], [2007, 17], [2008, 23], [2009, 25], [2010, 34], [2011, 44], [2012, 51], [2013, 64]], "name": "Series3"}]
    });
});
4

2 回答 2

5

你很亲密。是标签,不是标签。此外,该值是 this.value,而不是 this.x

xAxis : {
            labels: {
                formatter: function () {
                    return Highcharts.numberFormat(this.value, 0, '', ''); // Remove the thousands sep?
                }
            }
        },

http://jsfiddle.net/H2XQR/

于 2013-03-17T17:29:22.950 回答
1

您还可以使用语言选项http://api.highcharts.com/highcharts#lang

于 2013-03-18T09:10:31.560 回答