利用 jquery flot 生成柱状图
来源:互联网 发布:php和java哪个好找工作 编辑:程序博客网 时间:2024/05/01 03:22
具体效果:
代码如下:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>http://kmnk03.com/hxpfk/mny/48.html
- <title></title>
- <script type='text/javascript' src="jquery-1.8.3.js" ></script>
- <script type="text/javascript" src="jquery.flot.js"></script>
- <script type="text/javascript">
- $(function () {
- var d1 = [
- { label: "Bar", data: [ [1, 13], [2, 11], [3, 7] ] }
- ];http://kmnk03.com/hxpfk/bpy/122.html
- var stack = 0, bars = true, lines = false, steps = false;
- $.plot($("#bar1"), d1, {
- series: {
- color: '#333',
- abel: 'morris',
- stack: 0,http://kmnk03.com/hxpfk/bpy/119.html
- lines: {
- //show: true,
- fill: true,
- steps: false
- },
- point: {
- show: true,
- },
- bars: {
- show: true,http://kmnk03.com/hxpfk/npx/124.html
- barWidth: 0.6
- }
- }
- });
- });
- $(function(){
- var d1 = [
- { label: "Bar1", data: [ [0,14], [1, 13], [2, 11], [3, 7] ] ,color: '#abcdef' },
- { label: "Bar2", data: [ [0,8], [1, 22], [2, 33], [3, 11] ] , color: '#fedcba'}
- ];
- $.plot($("#bar2"), d1, {
- series: {
- bars: {
- show: true
- }
- },
- bars: {
- align: "center",
- barWidth: 0.5
- },
- xaxis: {
- show: true,
- //position: 'left',
- //color: '#ccc',http://kmnk03.com/hxpfk/bpy/120.html
- //tickColor: '#fff',
- ticks: [[0,'a'],[1,'b'],[2,'c'],[3,'d']],
- tickSize: 2,
- axisLabelUseCanvas: true,
- axisLabelFontSizePixels: 12,
- axisLabelFontFamily: 'Verdana, Arial',
- axisLabelPadding: 10
- },
- });
- });http://kmnk03.com/hxpfk/npx/125.html
- $(function(){
- var d1 = [
- { label: "Bar1", data: [ [10, 0], [11, 1], [12, 2], [13, 3] ] ,color: '#abcdef' },
- { label: "Bar2", data: [ [13,0], [12, 1], [11, 2], [10, 3] ] , color: '#fedcba'}
- ];
- $.plot($("#bar3"), d1, {
- series: {
- bars: {
- show: true
- }
- },
- bars: {
- align: "center",
- barWidth: 0.5,
- horizontal: true,
- },
- xaxis: {
- show: true,
- tickSize: 2,
- axisLabelUseCanvas: true,
- axisLabelFontSizePixels: 12,
- axisLabelFontFamily: 'Verdana, Arial',
- axisLabelPadding: 10
- },
- yaxis: {
- show: true,
- ticks: [[0,'a'],[1,'b'],[2,'c'],[3,'d']],
- tickSize: 2,
- axisLabelUseCanvas: true,
- axisLabelFontSizePixels: 12,
- axisLabelFontFamily: 'Verdana, Arial',
- axisLabelPadding: 10
- },http://kmnk03.com/hxpfk/hhb/126.html
- });
- });
- </script>
- </head>
- <body>
- <div style="width:300px;height:300px;text-align:center;margin:10px">
- <div id="bar1" style="width:100%;height:100%;"></div>
- </div>
- <div style="width:300px;height:300px;text-align:center;margin:10px">
- <div id="bar2" style="width:100%;height:100%;"></div>
- </div>http://kmnk03.com/hxpfk/bpy/127.html
- <div style="width:300px;height:300px;text-align:center;margin:10px">
- <div id="bar3" style="width:100%;height:100%;"></div>
- </div>kmnk03.com
- </body>http://kmnk03.com/hxpfk/npx/128.html
- </html>www.kmnk03.com
复制代码柱状图, jquery, flot
0 0