echarts2.html 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>统计图表-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
  6. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  9. <meta http-equiv="Cache-Control" content="no-siteapp" />
  10. <link rel="stylesheet" href="../../static/css/font.css">
  11. <link rel="stylesheet" href="../../static/css/weadmin.css">
  12. </head>
  13. <body>
  14. <div class="weadmin-body">
  15. <blockquote class="layui-elem-quote">
  16. 特别声明:ECharts,一个纯 Javascript 的图表库,可以流畅的运行在 PC 和移动设备上,兼容当前绝大部分浏览器(IE8/9/10/11,Chrome,Firefox,Safari等),底层依赖轻量级的 Canvas 类库 ZRender,提供直观,生动,可交互,可高度个性化定制的数据可视化图表。WeAdmin提示:如需使用或者详细更多案例可以访问官网 <a href="http://echarts.baidu.com/" style="color:red">ECharts</a>。
  17. </blockquote>
  18. <!-- 为 ECharts 准备一个具备大小(宽高)的 DOM -->
  19. <div id="main" style="width: 100%;height:400px;"></div>
  20. <blockquote class="layui-elem-quote">
  21. 注意:本案例的Echarts图表库由cdn引入,需要在线才能正常使用,若要离线使用,请至Echarts官网下载。
  22. </blockquote>
  23. </div>
  24. <script src="//cdn.bootcss.com/echarts/4.0.2/echarts.min.js"></script>
  25. <script type="text/javascript">
  26. // 基于准备好的dom,初始化echarts实例
  27. var myChart = echarts.init(document.getElementById('main'));
  28. // 指定图表的配置项和数据
  29. var labelRight = {
  30. normal: {
  31. position: 'right'
  32. }
  33. };
  34. option = {
  35. title: {
  36. text: '交错正负轴标签',
  37. subtext: 'From ExcelHome',
  38. sublink: 'http://e.weibo.com/1341556070/AjwF2AgQm'
  39. },
  40. tooltip : {
  41. trigger: 'axis',
  42. axisPointer : { // 坐标轴指示器,坐标轴触发有效
  43. type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
  44. }
  45. },
  46. grid: {
  47. top: 80,
  48. bottom: 30
  49. },
  50. xAxis: {
  51. type : 'value',
  52. position: 'top',
  53. splitLine: {lineStyle:{type:'dashed'}},
  54. },
  55. yAxis: {
  56. type : 'category',
  57. axisLine: {show: false},
  58. axisLabel: {show: false},
  59. axisTick: {show: false},
  60. splitLine: {show: false},
  61. data : ['ten', 'nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'two', 'one']
  62. },
  63. series : [
  64. {
  65. name:'生活费',
  66. type:'bar',
  67. stack: '总量',
  68. label: {
  69. normal: {
  70. show: true,
  71. formatter: '{b}'
  72. }
  73. },
  74. data:[
  75. {value: -0.07, label: labelRight},
  76. {value: -0.09, label: labelRight},
  77. 0.2, 0.44,
  78. {value: -0.23, label: labelRight},
  79. 0.08,
  80. {value: -0.17, label: labelRight},
  81. 0.47,
  82. {value: -0.36, label: labelRight},
  83. 0.18
  84. ]
  85. }
  86. ]
  87. };
  88. // 使用刚指定的配置项和数据显示图表。
  89. myChart.setOption(option);
  90. </script>
  91. </body>
  92. </html>