$(function(){
var chart=null;
var options={
chart:{
backgroundColor: 'dark',
},
title:{
text:"人口统计(职业类别)",
style:{ "color": "white", "fontSize": "18px" }
},
legend:{
style:{ "color": "white", "fontSize": "14px" },
align:'right',
y:-30,
layout: 'vertical',
itemStyle: {
color: 'white',
}
},
tooltip: {
headerFormat: '{series.name}<br>',
pointFormat: '{point.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: []
}
chart = new Highcharts.Chart('chart-jobpeople',options)
$.getJSON("jsonData/chart-jobpeople.json",function(data){
$.each(data,function(i, field){
chart.addSeries({
type:field.type,
name:field.name,
data:field.data
});
})
})
})