【发布时间】:2015-11-06 22:42:06
【问题描述】:
我已经尝试了我在 Highcharts API 中找到的所有内容,我真的不知道为什么它不会更新。如果有人能指出我正确的方向,就如何正确地写出来或者这些信息在 API 中的位置,那就太好了,谢谢你的时间。
$(document).ready(function() {
var options = {
// basic chart options
chart: {
height: 300,
renderTo: 'container',
type: 'column',
marginRight: 130,
lang: {
thousandsSep: ','
},
marginBottom: 25,
// 3D initialization, comment out for non-3D columns
options3d: {
enabled: true,
alpha: 0,
beta: 2,
depth: 50,
viewDistance: 25
}
},
// main chart title (TOP)
title: {
text: 'Giving Trends',
x: -20 //center
},
// main chart sub-title (TOP)
subtitle: {
text: 'By Party of Filer',
x: -20
},
// xAxis title
xAxis: {
reversed: false,
title: {
text: 'Party'
},
categories: []
},
// yAxis title
yAxis: {
title: {
text: 'Dollar Amount'
},
// chart options for each plotted point
plotLines: [{
value: 1,
width: 1,
color: '#66837B'
}]
},
// tooltip on hover options
tooltip: {
lang: {
thousandsSep: ','
},
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': '+ this.y
}
},
legend: {
layout: 'horizontal',
align: 'left',
verticalAlign: 'top',
x: 0,
y: 0,
borderWidth: 0,
},
plotOptions: {
bar: {
dataLabels: {
enabled: true,
color: '#F2C45A'
}
},
allowDecimals: {
enabled: false
},
series: {
text: 'Total Dollar Amount',
color: '#66837B',
cursor: 'pointer',
connectNulls: true,
pointWidth: 50
},
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || '#F2C45A',
}
}
},
series: []
}
Highcharts.setOptions({
// sets comma for thousands separator
lang: {
thousandsSep: ','
},
tooltip: {
xDecimals: -2 // If you want to add 2 decimals
}
});
【问题讨论】:
标签: jquery json highcharts