【发布时间】:2016-03-22 17:20:03
【问题描述】:
我有以下代码从 JSON 数据生成基本面积图,在图表上我希望能够显示逗号分隔的数字而不是整个整数,即图表中的所有数字都应该用逗号显示为 483,533,30 而不仅仅是 48353330。
我按照各种示例中的建议添加了这一点,但似乎不起作用
Highcharts.setOptions({
lang: {
thousandsSep: ','
}
});
我的工作代码可以在这里看到fiddle
$(document).ready(function() {
Highcharts.setOptions({
lang: {
thousandsSep: ','
}
});
var options = {
chart: {
renderTo: 'container',
type: 'area',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Deposit Institution',
x: -20 //center
},
subtitle: {
text: '',
x: -20
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'Amount'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': $'+ this.y;
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: []
}
$.getJSON("data1.json", function(json) {
options.xAxis.categories = json[0]['data'];
options.series[0] = json[1];
options.series[1] = json[2];
chart = new Highcharts.Chart(options);
});
});
【问题讨论】:
标签: jquery json highcharts