利用 jquery flot 生成柱状图

来源:互联网 发布:php和java哪个好找工作 编辑:程序博客网 时间:2024/05/01 03:22

具体效果:

代码如下:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>http://kmnk03.com/hxpfk/mny/48.html
  4. <title></title>
  5. <script type='text/javascript' src="jquery-1.8.3.js" ></script>
  6. <script type="text/javascript" src="jquery.flot.js"></script>
  7. <script type="text/javascript">
  8. $(function () {
  9. var d1 = [
  10. { label: "Bar", data: [ [1, 13], [2, 11], [3, 7] ] }
  11. ];http://kmnk03.com/hxpfk/bpy/122.html
  12. var stack = 0, bars = true, lines = false, steps = false;
  13. $.plot($("#bar1"), d1, {
  14. series: {
  15. color: '#333',
  16. abel: 'morris',
  17. stack: 0,http://kmnk03.com/hxpfk/bpy/119.html
  18. lines: {
  19. //show: true,
  20. fill: true,
  21. steps: false
  22. },
  23. point: {
  24. show: true,
  25. },
  26. bars: {
  27. show: true,http://kmnk03.com/hxpfk/npx/124.html
  28. barWidth: 0.6
  29. }
  30. }
  31. });
  32. });
  33. $(function(){
  34. var d1 = [
  35. { label: "Bar1", data: [ [0,14], [1, 13], [2, 11], [3, 7] ] ,color: '#abcdef' },
  36. { label: "Bar2", data: [ [0,8], [1, 22], [2, 33], [3, 11] ] , color: '#fedcba'}
  37. ];
  38. $.plot($("#bar2"), d1, {
  39. series: {
  40. bars: {
  41. show: true
  42. }
  43. },
  44. bars: {
  45. align: "center",
  46. barWidth: 0.5
  47. },
  48. xaxis: {
  49. show: true,
  50. //position: 'left',
  51. //color: '#ccc',http://kmnk03.com/hxpfk/bpy/120.html
  52. //tickColor: '#fff',
  53. ticks: [[0,'a'],[1,'b'],[2,'c'],[3,'d']],
  54. tickSize: 2,
  55. axisLabelUseCanvas: true,
  56. axisLabelFontSizePixels: 12,
  57. axisLabelFontFamily: 'Verdana, Arial',
  58. axisLabelPadding: 10
  59. },
  60. });
  61. });http://kmnk03.com/hxpfk/npx/125.html
  62. $(function(){
  63. var d1 = [
  64. { label: "Bar1", data: [ [10, 0], [11, 1], [12, 2], [13, 3] ] ,color: '#abcdef' },
  65. { label: "Bar2", data: [ [13,0], [12, 1], [11, 2], [10, 3] ] , color: '#fedcba'}
  66. ];
  67. $.plot($("#bar3"), d1, {
  68. series: {
  69. bars: {
  70. show: true
  71. }
  72. },
  73. bars: {
  74. align: "center",
  75. barWidth: 0.5,
  76. horizontal: true,
  77. },
  78. xaxis: {
  79. show: true,
  80. tickSize: 2,
  81. axisLabelUseCanvas: true,
  82. axisLabelFontSizePixels: 12,
  83. axisLabelFontFamily: 'Verdana, Arial',
  84. axisLabelPadding: 10
  85. },
  86. yaxis: {
  87. show: true,
  88. ticks: [[0,'a'],[1,'b'],[2,'c'],[3,'d']],
  89. tickSize: 2,
  90. axisLabelUseCanvas: true,
  91. axisLabelFontSizePixels: 12,
  92. axisLabelFontFamily: 'Verdana, Arial',
  93. axisLabelPadding: 10
  94. },http://kmnk03.com/hxpfk/hhb/126.html
  95. });
  96. });
  97. </script>
  98. </head>
  99. <body>
  100. <div style="width:300px;height:300px;text-align:center;margin:10px">
  101. <div id="bar1" style="width:100%;height:100%;"></div>
  102. </div>
  103. <div style="width:300px;height:300px;text-align:center;margin:10px">
  104. <div id="bar2" style="width:100%;height:100%;"></div>
  105. </div>http://kmnk03.com/hxpfk/bpy/127.html
  106. <div style="width:300px;height:300px;text-align:center;margin:10px">
  107. <div id="bar3" style="width:100%;height:100%;"></div>
  108. </div>kmnk03.com
  109. </body>http://kmnk03.com/hxpfk/npx/128.html
  110. </html>www.kmnk03.com
复制代码

柱状图, jquery, flot
0 0
原创粉丝点击