var highchartsOptions = {
chart:{
renderTo:'container'
},
title:{
text:'指标数据'
},
tooltip:{
pointFormat:'{series.name}:<b>{point.y}</b>'
},
xAxis:{
categories:[]
},
yAxis:{
title:{
text:'数值'
}
},
series:[]
};
/**
*categories:[]
*series:[
* {
* name:''
* data:[]
* }
* ]
*/
function changeHighchartsOption(categories,series){
highchartsOptions.xAxis.categories = categories;
highchartsOptions.series = series;
newHighcharts('line');
}
function newHighcharts(type){
highchartsOptions.chart.type = type;
new Highcharts.Chart(highchartsOptions);
}
![](https://images0.cnblogs.com/i/314639/201408/051736556937674.png)