highstock 的tooltip框里面的内容 保留两位小数的办法
$("#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);
}
最新文章
- Officel常用操作
- log4php的配置
- Android USB Host与HID通讯
- Linux覆盖率一点研究:获取覆盖率数据
- C# WinForm 技巧十: 开发工具
- format——MATLAB
- UML Distilled - Development Process
- MHA工作原理
- 【转】字符编码笔记:ASCII,Unicode和UTF-8
- UVa 10837 A Research Problem 欧拉函数
- Guava API学习之Multimap
- Android内存泄漏分析及调试
- 代码块(Block)回调一般阐述
- Asp.Net MVC 身份验证-Forms
- [Swift]LeetCode765. 情侣牵手 | Couples Holding Hands
- git tag 查看标签列表、切换标签
- 数据结构Java实现02----单向链表的插入和删除
- 更新node的版本,node没有安装到c盘,安装到了D盘
- Handler实现线程间的通信2
- 【libreOJ模板】并查集(输入挂,取模与find优化)
热门文章
- 警告 “util.NativeCodeLoader: Unable to load native-hadoop library for your platform”
- 【poj1741】 Tree
- js 日报 周报 月报 时间扩展 js
- SQL Server发布订阅功能研究
- SQL Server配置管理器”远程过程调用失败“的问题解决
- asp.net项目发布打包研究
- VC++ 比较两个字符串是否相等,字母大小写相关。
- K米--案例分析
- ASP.NET WEB API 测试
- 【Alpha阶段】第四次Scrum例会