pie.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="ECharts">
  8. <meta name="author" content="kener.linfeng@gmail.com">
  9. <title>ECharts · Example</title>
  10. <link rel="shortcut icon" href="../asset/ico/favicon.png">
  11. <link href="../asset/css/font-awesome.min.css" rel="stylesheet">
  12. <link href="../asset/css/bootstrap.css" rel="stylesheet">
  13. <link href="../asset/css/carousel.css" rel="stylesheet">
  14. <link href="../asset/css/echartsHome.css" rel="stylesheet">
  15. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  16. <!--[if lt IE 9]>
  17. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  18. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  19. <![endif]-->
  20. <script src="./www/js/echarts.js"></script>
  21. <script src="../asset/js/codemirror.js"></script>
  22. <script src="../asset/js/javascript.js"></script>
  23. <link href="../asset/css/codemirror.css" rel="stylesheet">
  24. <link href="../asset/css/monokai.css" rel="stylesheet">
  25. </head>
  26. <body>
  27. <!-- Fixed navbar -->
  28. <div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
  29. <div class="container-fluid">
  30. <div class="row-fluid example">
  31. <div id="sidebar-code" class="col-md-4">
  32. <div class="well sidebar-nav">
  33. <div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
  34. <textarea id="code" name="code">
  35. option = {
  36. tooltip : {
  37. show: true,
  38. formatter: "{a} <br/>{b} : {c} ({d}%)"
  39. },
  40. legend: {
  41. orient : 'vertical',
  42. x : 'left',
  43. data:['直达','营销广告','搜索引擎','邮件营销','联盟广告','视频广告','百度','谷歌','必应','其他']
  44. },
  45. toolbox: {
  46. show : true,
  47. feature : {
  48. mark : {show: true},
  49. dataView : {show: true, readOnly: false},
  50. restore : {show: true},
  51. saveAsImage : {show: true}
  52. }
  53. },
  54. calculable : true,
  55. series : [
  56. {
  57. name:'访问来源',
  58. type:'pie',
  59. center : ['35%', 200],
  60. radius : 80,
  61. itemStyle : {
  62. normal : {
  63. label : {
  64. position : 'inner',
  65. formatter : function (params) {
  66. return (params.percent - 0).toFixed(0) + '%'
  67. }
  68. },
  69. labelLine : {
  70. show : false
  71. }
  72. },
  73. emphasis : {
  74. label : {
  75. show : true,
  76. formatter : "{b}\n{d}%"
  77. }
  78. }
  79. },
  80. data:[
  81. {value:335, name:'直达'},
  82. {value:679, name:'营销广告'},
  83. {value:1548, name:'搜索引擎'}
  84. ]
  85. },
  86. {
  87. name:'访问来源',
  88. type:'pie',
  89. center : ['35%', 200],
  90. radius : [110, 140],
  91. data:[
  92. {value:335, name:'直达'},
  93. {value:310, name:'邮件营销'},
  94. {value:234, name:'联盟广告'},
  95. {value:135, name:'视频广告'},
  96. {
  97. value:1048,
  98. name:'百度',
  99. itemStyle : {
  100. normal : {
  101. color : (function (){
  102. var zrColor = require('zrender/tool/color');
  103. return zrColor.getRadialGradient(
  104. 300, 200, 110, 300, 200, 140,
  105. [[0, 'rgba(255,255,0,1)'],[1, 'rgba(30,144,250,1)']]
  106. )
  107. })(),
  108. label : {
  109. textStyle : {
  110. color : 'rgba(30,144,255,0.8)',
  111. align : 'center',
  112. baseline : 'middle',
  113. fontFamily : '微软雅黑',
  114. fontSize : 30,
  115. fontWeight : 'bolder'
  116. }
  117. },
  118. labelLine : {
  119. length : 40,
  120. lineStyle : {
  121. color : '#f0f',
  122. width : 3,
  123. type : 'dotted'
  124. }
  125. }
  126. }
  127. }
  128. },
  129. {value:251, name:'谷歌'},
  130. {
  131. value:102,
  132. name:'必应',
  133. itemStyle : {
  134. normal : {
  135. label : {
  136. show : false
  137. },
  138. labelLine : {
  139. show : false
  140. }
  141. },
  142. emphasis : {
  143. label : {
  144. show : true
  145. },
  146. labelLine : {
  147. show : true,
  148. length : 50
  149. }
  150. }
  151. }
  152. },
  153. {value:147, name:'其他'}
  154. ]
  155. },
  156. {
  157. name:'访问来源',
  158. type:'pie',
  159. clockWise:true,
  160. startAngle: 135,
  161. center : ['75%', 200],
  162. radius : [80, 120],
  163. itemStyle : {
  164. normal : {
  165. label : {
  166. show : false
  167. },
  168. labelLine : {
  169. show : false
  170. }
  171. },
  172. emphasis : {
  173. color: (function (){
  174. var zrColor = require('zrender/tool/color');
  175. return zrColor.getRadialGradient(
  176. 650, 200, 80, 650, 200, 120,
  177. [[0, 'rgba(255,255,0,1)'],[1, 'rgba(255,0,0,1)']]
  178. )
  179. })(),
  180. label : {
  181. show : true,
  182. position : 'center',
  183. formatter : "{d}%",
  184. textStyle : {
  185. color : 'red',
  186. fontSize : '30',
  187. fontFamily : '微软雅黑',
  188. fontWeight : 'bold'
  189. }
  190. }
  191. }
  192. },
  193. data:[
  194. {value:335, name:'直达'},
  195. {value:310, name:'邮件营销'},
  196. {value:234, name:'联盟广告'},
  197. {value:135, name:'视频广告'},
  198. {value:1548, name:'搜索引擎'}
  199. ],
  200. markPoint : {
  201. symbol: 'star',
  202. data : [
  203. {name : '最大', value : 1548, x:'80%', y:50, symbolSize:32}
  204. ]
  205. }
  206. }
  207. ]
  208. };
  209. </textarea>
  210. </div><!--/.well -->
  211. </div><!--/span-->
  212. <div id="graphic" class="col-md-8">
  213. <div id="main" class="main"></div>
  214. <div>
  215. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  216. <span class="text-primary">切换主题</span>
  217. <select id="theme-select"></select>
  218. <span id='wrong-message' style="color:red"></span>
  219. </div>
  220. </div><!--/span-->
  221. </div><!--/row-->
  222. </div><!--/.fluid-container-->
  223. <footer id="footer"></footer>
  224. <!-- Le javascript
  225. ================================================== -->
  226. <!-- Placed at the end of the document so the pages load faster -->
  227. <script src="../asset/js/jquery.min.js"></script>
  228. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  229. <script src="../asset/js/bootstrap.min.js"></script>
  230. <script src="../asset/js/echartsExample.js"></script>
  231. </body>
  232. </html>