mix9.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. title : {
  37. text: '某站点用户访问来源',
  38. subtext: '纯属虚构',
  39. x:'center'
  40. },
  41. tooltip : {
  42. trigger: 'item',
  43. formatter: "{a} <br/>{b} : {c} ({d}%)"
  44. },
  45. legend: {
  46. orient : 'vertical',
  47. x : 'left',
  48. data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
  49. },
  50. calculable : true,
  51. series : [
  52. {
  53. name:'访问来源',
  54. type:'pie',
  55. radius : '55%',
  56. center: ['50%', 225],
  57. data:[
  58. {value:335, name:'直接访问'},
  59. {value:310, name:'邮件营销'},
  60. {value:234, name:'联盟广告'},
  61. {value:135, name:'视频广告'},
  62. {value:1548, name:'搜索引擎'}
  63. ]
  64. }
  65. ]
  66. };
  67. option2 = {
  68. tooltip : {
  69. trigger: 'axis',
  70. axisPointer : {
  71. type: 'shadow'
  72. }
  73. },
  74. legend: {
  75. data:['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
  76. },
  77. toolbox: {
  78. show : true,
  79. orient : 'vertical',
  80. y : 'center',
  81. feature : {
  82. mark : {show: true},
  83. magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
  84. restore : {show: true},
  85. saveAsImage : {show: true}
  86. }
  87. },
  88. calculable : true,
  89. xAxis : [
  90. {
  91. type : 'category',
  92. data : ['周一','周二','周三','周四','周五','周六','周日']
  93. }
  94. ],
  95. yAxis : [
  96. {
  97. type : 'value',
  98. splitArea : {show : true}
  99. }
  100. ],
  101. grid: {
  102. x2:40
  103. },
  104. series : [
  105. {
  106. name:'直接访问',
  107. type:'bar',
  108. stack: '总量',
  109. data:[320, 332, 301, 334, 390, 330, 320]
  110. },
  111. {
  112. name:'邮件营销',
  113. type:'bar',
  114. stack: '总量',
  115. data:[120, 132, 101, 134, 90, 230, 210]
  116. },
  117. {
  118. name:'联盟广告',
  119. type:'bar',
  120. stack: '总量',
  121. data:[220, 182, 191, 234, 290, 330, 310]
  122. },
  123. {
  124. name:'视频广告',
  125. type:'bar',
  126. stack: '总量',
  127. data:[150, 232, 201, 154, 190, 330, 410]
  128. },
  129. {
  130. name:'搜索引擎',
  131. type:'bar',
  132. stack: '总量',
  133. data:[820, 932, 901, 934, 1290, 1330, 1320]
  134. }
  135. ]
  136. };
  137. myChart2 = echarts.init(document.getElementById('main2'));
  138. myChart2.setOption(option2);
  139. myChart.connect(myChart2);
  140. myChart2.connect(myChart);
  141. setTimeout(function (){
  142. window.onresize = function () {
  143. myChart.resize();
  144. myChart2.resize();
  145. }
  146. },200)
  147. </textarea>
  148. </div><!--/.well -->
  149. </div><!--/span-->
  150. <div id="graphic" class="col-md-8">
  151. <div id="main" class="main" style='width:45%;float:left;margin-right:0;padding-right:0;border-right-width:0'></div>
  152. <div id="main2" class="main" style='width:50%;margin-left:0;padding-left:0;border-left-width:0'></div>
  153. <div>
  154. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  155. <span class="text-primary">切换主题</span>
  156. <select id="theme-select"></select>
  157. <span id='wrong-message' style="color:red"></span>
  158. </div>
  159. </div><!--/span-->
  160. </div><!--/row-->
  161. </div><!--/.fluid-container-->
  162. <footer id="footer"></footer>
  163. <!-- Le javascript
  164. ================================================== -->
  165. <!-- Placed at the end of the document so the pages load faster -->
  166. <script src="../asset/js/jquery.min.js"></script>
  167. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  168. <script src="../asset/js/bootstrap.min.js"></script>
  169. <script src="../asset/js/echartsExample.js"></script>
  170. <script type="text/javascript">
  171. function refresh(isBtnRefresh){
  172. if (isBtnRefresh) {
  173. needRefresh = true;
  174. focusGraphic();
  175. myChart2.showLoading();
  176. return;
  177. }
  178. needRefresh = false;
  179. myChart = echarts.init(domMain);
  180. (new Function (editor.doc.getValue()))();
  181. myChart.setOption(option, true);
  182. domMessage.innerHTML = '';
  183. window.onresize = function () {
  184. myChart.resize();
  185. myChart2.resize();
  186. }
  187. }
  188. </script>
  189. </body>
  190. </html>