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>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值