首页 > 代码库 > highcahrts动态绑定数据
highcahrts动态绑定数据
<html>
<head>
<title>Highcharts Example</title>
<script language="javascript" type="text/javascript" src="http://www.mamicode.com/js/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="http://www.mamicode.com/js/highcharts.js"></script>
<script language="javascript" type="text/javascript" src="http://www.mamicode.com/js/exporting.js"></script>
<script type="text/javascript">
var chart;
$(document).ready(function() {
var options = {
chart: {
renderTo: ‘container‘,
type: ‘line‘,
marginRight: 130,
marginBottom: 25
},
title: {
text: ‘每天的分布情况‘,
x: -20 //center
},
xAxis: {
categories: [‘0‘, ‘1‘, ‘2‘, ‘3‘,‘4‘,‘5‘,‘6‘,‘7‘,‘8‘,‘9‘]
},
yAxis: {
title: {
text: ‘Y轴‘
},
plotLines: [{
value: 0,
width: 1,
color: ‘#808080‘
}]
},
tooltip: {
formatter: function() {
return ‘<b>‘+ this.series.name +‘</b><br/>‘ + this.x +‘: ‘+ this.y ;
}
},
legend: {
layout: ‘vertical‘,
align: ‘right‘,
verticalAlign: ‘top‘,
x: -10,
y: 100,
borderWidth: 0
},
series: []
}
options.series = new Array();
var i;
for(i=0;i<10;i++)
{
options.series[i] = new Object();
options.series[i].name = ‘Sample‘+i;
options.series[i].data = http://www.mamicode.com/new Array(0+i, 1+i, 2+i, 3+i,4+i,5+i,6+i,7+i,8+i,9+i);
}
chart = new Highcharts.Chart(options);
});
</script>
</head>
<body>
<div id="container" style="width: 800px;height: 400px"></div>
</body>
</html>
highcahrts动态绑定数据
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。