rus*_*sty 33
您可以使用轴的tickFormatter属性来完成此操作.
xaxis: {
tickFormatter: function(val, axis) {
// insert comma logic here and return the string
}
}
Run Code Online (Sandbox Code Playgroud)
来源:http://people.iola.dk/olau/flot/API.txt(在"自定义轴"下)
此页面具有使用逗号格式化数字的功能:http://www.mredkj.com/javascript/nfbasic.html
例如yaxis:
$(function () {
var plotarea = $("#plotarea");
$.plot( plotarea , [data], {
xaxis: {mode: "time", timeformat: "%m/%d %H:%M:%S"},
yaxis: {tickFormatter: function numberWithCommas(x) {
return x.toString().replace(/\B(?=(?:\d{3})+(?!\d))/g, ",");
}
},
points: { show: true },
lines: { show: true, fill: true }
} );
});
Run Code Online (Sandbox Code Playgroud)