$("#flux_chart_container").highcharts('
},
borderWidth : 1,
borderRadius : 10,
spacingTop : 2,
spacingBottom : 3,
spacingLeft : 1,
spacingRight : 3
},
credits:{
enabled : false
},
title: {
text: title + " 流量明细"
},
legend: {
enabled: true,
layout: 'vertical',
labelFormatter: function() {
if(this.name=='入流量'){
return
this.name +' 均值:' + Highcharts.numberFormat(datas.avginput,2) + ' kbps
峰值:' + Highcharts.numberFormat(datas.maxinput,2) + ' kbps';
}else if(this.name=='出流量'){
return
this.name +' 均值:' + Highcharts.numberFormat(datas.avgoutput,2) + ' kbps
峰值:' + Highcharts.numberFormat(datas.maxoutput,2) + ' kbps';
}else{
return this.name;
}
}
},
/*xAxis: {
categories : categories,
labels: {
step: step,
staggerLines : 2
}
},*/
yAxis: [{
title: {
text: "流量(kbps)"
},
tickPixelInterval:20,
offset:90,
labels: {
formatter: function() {
return Highcharts.numberFormat(this.value,2) +' kbps';
}
},
min:0
}],
plotOptions : {
series : {
marker: {
enabled: false
}
}
},
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.2f} kps</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
series:[{name:'入流量',tooltip:{valueSuffix:'Kbps'},data : inputs},{name:'出流量',tooltip:{valueSuffix:'Kbps'},data : outputs}]
//,{name:'入端口利用率',yAxis:
1,tooltip:{valueSuffix:'%'},data : intportur},{name:'出端口利用率',yAxis:
1,tooltip:{valueSuffix:'%'},data : outportur}
});
========================================highchart的使用和对比=====================
function initReport(chartId,chartTitle,chartCategories,chartY,chartSeries) {
var chart = new Highcharts.Chart({
chart: {
renderTo: chartId,
zoomType: 'x',
style: {
color: '#000000',
fontFamily: '楷体'
}
},
title: {
text: chartTitle,
style: {
fontWeight: 'bold'
}
},
xAxis: {
categories: chartCategories,
labels: {
rotation:340,
y:35,
style: {
color: 'black',
fontSize: 12,
fontFamily: '微软雅黑'
}
}
},
yAxis: [{
title: {
text: "流量(kbps)"
},
tickPixelInterval:20,
labels: {//highchart Y 轴保留两位小数点的办法
formatter: function() {
return Highcharts.numberFormat(this.value,2) +' kbps';
}
},
min:0
}],
tooltip: {
crosshairs: [{color:'blue',dashStyle: 'dot'},{color:'blue',dashStyle: 'dot'}],
shared: true
},
plotOptions : {
column: {//控制柱状宽度
pointPadding: 0.2,
borderWidth: 0,
pointWidth: 30
},
series : {
marker: {
enabled: false
},
cursor: 'pointer',
point : {
events : {
click: function(event) {
queryPortFlux(this.options.portid);
}
}
}
}
},
credits:{
enabled : false
},
series: chartSeries,
navigation: {
buttonOptions: {
enabled: false
}
}
});
reportCharts.push(chart);
}