`

flot画图

 
阅读更多
1.柱状图

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Flot Examples</title>
    <link href="layout.css" rel="stylesheet" type="text/css">
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
    <script language="javascript" type="text/javascript" src="../jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
 </head>
    <body>
    <h1>Flot Examples</h1>

    <div id="placeholder" style="width:600px;height:300px"></div>

    <p>Flot supports lines, points, filled areas, bars and any
    combinations of these, in the same plot and even on the same data
    series.</p>

<script type="text/javascript">
$(function () {
    
    var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
    var d3 = [[1, 2], [2, 4], [3, 3], [5, 6]];





var opts = { 
		yaxes:[{show:true,  //是否显示坐标轴,必须是grid.show==true时才生效
		max:20,		//最大值
		min:0,	//最小值
		tickSize:1,	//刻度单位,(max-min)/tickSize就可算出坐标轴上有多少个刻度
		position:'left'  //坐标轴在那边,左侧,右侧,上,下
		}],
		xaxes:[{show:false,  //是否显示坐标轴,必须是grid.show==true时才生效
		max:10,		//最大值
		min:0,	//最小值
		tickSize:1,	//刻度单位,(max-min)/tickSize就可算出坐标轴上有多少个刻度
		}]
};

                        
    $.plot($("#placeholder"), [
        
        {
        	color:'green',
        	label:'a',
            data: d2,
            bars: { show: true,fillColor:"green" }
        },
        {
        	color:'blue',
        	label:'b',
            data: d3,
            bars: { show: true,fillColor:"blue" }
        }
    ],opts);
});

</script>

 </body>
</html>

  • 大小: 46.5 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics