echarts2.html 4.4 KB

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