1、其实数据填充很简单,它们就是json的格式,然后后台按照这种格式去套数据发给前端;前端再做一下连接处理等就行了。

     $('#program_statistics_bar').highcharts({
chart: {
type: 'bar'
},
title: {
text: bar_title
},
exporting :{
url:'../../plugin common/Highcharts-3.0.9/exporting-server/php/php-batik/index.php',
width:1000
},
xAxis: {
categories: (function() {
var temp_data = []; for (var key in bar_data)
{
if ('undefined' != typeof(bar_prog_name[key]))
{
temp_data.push(bar_prog_name[key].toString() + '( ' + key.toString() + ' )');
}
else
{
temp_data.push(key.toString());
}
} return temp_data;
})()
},
yAxis: {
min: 0,
title: {
text: 'View Count' + '( ' + bar_type + ' : ' + number + ' )',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
valueSuffix: ' times'
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -40,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: '#FFFFFF',
shadow: true
},
credits: {
enabled: false
},
series: (function() {
var obj = new Object();
var view_count = [];
var temp_data = []; for (var key in bar_data)
{
view_count.push(bar_data[key]);
} obj['name'] = "View Count";
obj['data'] = view_count; temp_data.push(obj);
return temp_data;
})()
});
 $('#program_statistics_pie').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
colors:[
'#DDDDDD',
'#FF88C2',
'#FF8888',
'#FFA488',
'#FFBB66',
'#FFDD55',
'#FFFF77',
'#DDFF77',
'#66FF66',
'#77FFEE',
'#77DDFF',
],
title: {
text: pie_title
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: 'Views',
data: (function() {
var temp_data = []; for (var key in pie_data)
{
if ('undefined' != typeof(pie_prog_name[key]))
{
arr = [pie_prog_name[key] + '( ' + key + ' )', pie_data[key]];
}
else
{
arr = [key, pie_data[key]];
} temp_data.push(arr);
} return temp_data;
})()
}]
});
05-11 13:26