[转]highcharts图表入门之:如何让highcharts图表自适应浏览器窗体的大小或者页面大小

本文转自:

http://jsfiddle.net/vCZ8V/1/

http://www.stepday.com/topic/?740

http://blog.csdn.net/yueritian/article/details/30777351

<html>
<head>
<title>Highcharts 教程 | 菜鸟教程(runoob.com)</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script> </head>
<body>
<div id="container" style="height: 50%">
<script language="JavaScript">
$(window).resize(function()
{
chart.setSize(
$(document).width(),
$(document).height()/2,
false
);
}); $(document).ready(function() { var chart = new Highcharts.Chart({ chart: {
renderTo: container,
spacingTop: 3,
spacingRight: 0,
spacingBottom: 3,
spacingLeft: 0
}, credits: {
enabled: false
}, xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
}, series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}] }); });
</script>
</body>
</html>
上一篇:unix环境高级编程基础知识之第四章


下一篇:highcharts图表组件入门教程:如何监听柱状图柱子点击事件动态更新当前数据点数值和所对应X轴刻度