echarts4.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 src="//cdn.bootcss.com/echarts/3.3.2/extension/bmap.min.js" type="text/javascript"></script>
  27. <script type="text/javascript">
  28. // 基于准备好的dom,初始化echarts实例
  29. var myChart = echarts.init(document.getElementById('main'));
  30. // 指定图表的配置项和数据
  31. option = {
  32. backgroundColor: '#2c343c',
  33. title: {
  34. text: 'Customized Pie',
  35. left: 'center',
  36. top: 20,
  37. textStyle: {
  38. color: '#ccc'
  39. }
  40. },
  41. tooltip : {
  42. trigger: 'item',
  43. formatter: "{a} <br/>{b} : {c} ({d}%)"
  44. },
  45. visualMap: {
  46. show: false,
  47. min: 80,
  48. max: 600,
  49. inRange: {
  50. colorLightness: [0, 1]
  51. }
  52. },
  53. series : [
  54. {
  55. name:'访问来源',
  56. type:'pie',
  57. radius : '55%',
  58. center: ['50%', '50%'],
  59. data:[
  60. {value:335, name:'直接访问'},
  61. {value:310, name:'邮件营销'},
  62. {value:274, name:'联盟广告'},
  63. {value:235, name:'视频广告'},
  64. {value:400, name:'搜索引擎'}
  65. ].sort(function (a, b) { return a.value - b.value}),
  66. roseType: 'angle',
  67. label: {
  68. normal: {
  69. textStyle: {
  70. color: 'rgba(255, 255, 255, 0.3)'
  71. }
  72. }
  73. },
  74. labelLine: {
  75. normal: {
  76. lineStyle: {
  77. color: 'rgba(255, 255, 255, 0.3)'
  78. },
  79. smooth: 0.2,
  80. length: 10,
  81. length2: 20
  82. }
  83. },
  84. itemStyle: {
  85. normal: {
  86. color: '#c23531',
  87. shadowBlur: 200,
  88. shadowColor: 'rgba(0, 0, 0, 0.5)'
  89. }
  90. }
  91. }
  92. ]
  93. };
  94. // 使用刚指定的配置项和数据显示图表。
  95. myChart.setOption(option);
  96. </script>
  97. <script>
  98. var _hmt = _hmt || [];
  99. (function() {
  100. var hm = document.createElement("script");
  101. hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
  102. var s = document.getElementsByTagName("script")[0];
  103. s.parentNode.insertBefore(hm, s);
  104. })();
  105. </script>
  106. </body>
  107. </html>