pie5.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. var labelTop = {
  36. normal : {
  37. label : {
  38. show : true,
  39. position : 'center',
  40. formatter : '{b}',
  41. textStyle: {
  42. baseline : 'bottom'
  43. }
  44. },
  45. labelLine : {
  46. show : false
  47. }
  48. }
  49. };
  50. var labelFromatter = {
  51. normal : {
  52. label : {
  53. formatter : function (params){
  54. return 100 - params.value + '%'
  55. },
  56. textStyle: {
  57. baseline : 'top'
  58. }
  59. }
  60. },
  61. }
  62. var labelBottom = {
  63. normal : {
  64. color: '#ccc',
  65. label : {
  66. show : true,
  67. position : 'center'
  68. },
  69. labelLine : {
  70. show : false
  71. }
  72. },
  73. emphasis: {
  74. color: 'rgba(0,0,0,0)'
  75. }
  76. };
  77. var radius = [40, 55];
  78. option = {
  79. legend: {
  80. x : 'center',
  81. y : 'center',
  82. data:[
  83. 'GoogleMaps','Facebook','Youtube','Google+','Weixin',
  84. 'Twitter', 'Skype', 'Messenger', 'Whatsapp', 'Instagram'
  85. ]
  86. },
  87. title : {
  88. text: 'The App World',
  89. subtext: 'from global web index',
  90. x: 'center'
  91. },
  92. toolbox: {
  93. show : true,
  94. feature : {
  95. dataView : {show: true, readOnly: false},
  96. magicType : {
  97. show: true,
  98. type: ['pie', 'funnel'],
  99. option: {
  100. funnel: {
  101. width: '20%',
  102. height: '30%',
  103. itemStyle : {
  104. normal : {
  105. label : {
  106. formatter : function (params){
  107. return 'other\n' + params.value + '%\n'
  108. },
  109. textStyle: {
  110. baseline : 'middle'
  111. }
  112. }
  113. },
  114. }
  115. }
  116. }
  117. },
  118. restore : {show: true},
  119. saveAsImage : {show: true}
  120. }
  121. },
  122. series : [
  123. {
  124. type : 'pie',
  125. center : ['10%', '30%'],
  126. radius : radius,
  127. x: '0%', // for funnel
  128. itemStyle : labelFromatter,
  129. data : [
  130. {name:'other', value:46, itemStyle : labelBottom},
  131. {name:'GoogleMaps', value:54,itemStyle : labelTop}
  132. ]
  133. },
  134. {
  135. type : 'pie',
  136. center : ['30%', '30%'],
  137. radius : radius,
  138. x:'20%', // for funnel
  139. itemStyle : labelFromatter,
  140. data : [
  141. {name:'other', value:56, itemStyle : labelBottom},
  142. {name:'Facebook', value:44,itemStyle : labelTop}
  143. ]
  144. },
  145. {
  146. type : 'pie',
  147. center : ['50%', '30%'],
  148. radius : radius,
  149. x:'40%', // for funnel
  150. itemStyle : labelFromatter,
  151. data : [
  152. {name:'other', value:65, itemStyle : labelBottom},
  153. {name:'Youtube', value:35,itemStyle : labelTop}
  154. ]
  155. },
  156. {
  157. type : 'pie',
  158. center : ['70%', '30%'],
  159. radius : radius,
  160. x:'60%', // for funnel
  161. itemStyle : labelFromatter,
  162. data : [
  163. {name:'other', value:70, itemStyle : labelBottom},
  164. {name:'Google+', value:30,itemStyle : labelTop}
  165. ]
  166. },
  167. {
  168. type : 'pie',
  169. center : ['90%', '30%'],
  170. radius : radius,
  171. x:'80%', // for funnel
  172. itemStyle : labelFromatter,
  173. data : [
  174. {name:'other', value:73, itemStyle : labelBottom},
  175. {name:'Weixin', value:27,itemStyle : labelTop}
  176. ]
  177. },
  178. {
  179. type : 'pie',
  180. center : ['10%', '70%'],
  181. radius : radius,
  182. y: '55%', // for funnel
  183. x: '0%', // for funnel
  184. itemStyle : labelFromatter,
  185. data : [
  186. {name:'other', value:78, itemStyle : labelBottom},
  187. {name:'Twitter', value:22,itemStyle : labelTop}
  188. ]
  189. },
  190. {
  191. type : 'pie',
  192. center : ['30%', '70%'],
  193. radius : radius,
  194. y: '55%', // for funnel
  195. x:'20%', // for funnel
  196. itemStyle : labelFromatter,
  197. data : [
  198. {name:'other', value:78, itemStyle : labelBottom},
  199. {name:'Skype', value:22,itemStyle : labelTop}
  200. ]
  201. },
  202. {
  203. type : 'pie',
  204. center : ['50%', '70%'],
  205. radius : radius,
  206. y: '55%', // for funnel
  207. x:'40%', // for funnel
  208. itemStyle : labelFromatter,
  209. data : [
  210. {name:'other', value:78, itemStyle : labelBottom},
  211. {name:'Messenger', value:22,itemStyle : labelTop}
  212. ]
  213. },
  214. {
  215. type : 'pie',
  216. center : ['70%', '70%'],
  217. radius : radius,
  218. y: '55%', // for funnel
  219. x:'60%', // for funnel
  220. itemStyle : labelFromatter,
  221. data : [
  222. {name:'other', value:83, itemStyle : labelBottom},
  223. {name:'Whatsapp', value:17,itemStyle : labelTop}
  224. ]
  225. },
  226. {
  227. type : 'pie',
  228. center : ['90%', '70%'],
  229. radius : radius,
  230. y: '55%', // for funnel
  231. x:'80%', // for funnel
  232. itemStyle : labelFromatter,
  233. data : [
  234. {name:'other', value:89, itemStyle : labelBottom},
  235. {name:'Instagram', value:11,itemStyle : labelTop}
  236. ]
  237. }
  238. ]
  239. };
  240. </textarea>
  241. </div><!--/.well -->
  242. </div><!--/span-->
  243. <div id="graphic" class="col-md-8">
  244. <div id="main" class="main"></div>
  245. <div>
  246. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  247. <span class="text-primary">切换主题</span>
  248. <select id="theme-select"></select>
  249. <span id='wrong-message' style="color:red"></span>
  250. </div>
  251. </div><!--/span-->
  252. </div><!--/row-->
  253. </div><!--/.fluid-container-->
  254. <footer id="footer"></footer>
  255. <!-- Le javascript
  256. ================================================== -->
  257. <!-- Placed at the end of the document so the pages load faster -->
  258. <script src="../asset/js/jquery.min.js"></script>
  259. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  260. <script src="../asset/js/bootstrap.min.js"></script>
  261. <script src="../asset/js/echartsExample.js"></script>
  262. </body>
  263. </html>