function chart1(){
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
}
function chart2(){
var chart = new Highcharts.Chart({
chart: {
renderTo:'container2',//目标容器
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
}
function chart3(){
var option = new Object();
option.chart = new Object();
var x = '${param.xAxis}';
var n = '${param.data}';
var prizeName = '${param.dataName}';
var xAxis=x.split(",");
var ydata = n.split(",");
var prize = prizeName.split(",");
//票数
var vote1=[1,2];//第一个电影两个奖项分别得到的票数
var vote2=[3,4];//第二个电影两个奖项分别得到的票数
//var voteNum=[[1,2],[3,4]];
var voteNum = new Array();
voteNum[3] = new Array();
var voteNum=new Array();
for(var i=0; i<ydata.length; i++){
voteNum[i]=new Array();
}
for(var i=0; i<ydata.length; i++){
voteNum[i][0]=eval(ydata[i]);
console.log(voteNum[i][0]);
}
console.log(voteNum);
console.log(x);
console.log(n);
console.log(prizeName);
option.chart.type="column";
option.chart.renderTo="container";
option.title={title:"票数统计"};
//option.xAxis={categories:["新人奖","视频奖"],gridLineWidth:1};
option.yAxis={title:{text:"票数"},tickInterval:1};
option.series = new Array();
//add by luodaliang
option.xAxis = new Object();
option.xAxis.categories = new Array();
option.xAxis.categories = prize;
for (var i=0;i<xAxis.length;i++){
option.series[i] = new Object();
option.series[i].name=xAxis[i];
option.series[i].data=eval(voteNum[i]) ;
console.log(option.series[i].data);
console.log(option.series[i].name);
}
/* option.series[0] = new Object();
option.series[0].name="张三";
option.series[0].data=[1,3,5];
option.series[1] = new Object();
option.series[1].name="李四";
option.series[1].data=[6,1,5.5];
option.series[2] = new Object();
option.series[2].name="刘能";
option.series[2].data=[3,1,0.3]; */
var chart = new Highcharts.Chart(option);
}
$(function () {
//chart1();
//chart2();
chart3();
});
</script>