mix3.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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: '2011全国GDP(亿元)',
  38. subtext: '数据来自国家统计局'
  39. },
  40. tooltip : {
  41. trigger: 'item'
  42. },
  43. legend: {
  44. x:'right',
  45. selectedMode:false,
  46. data:['北京','上海','广东']
  47. },
  48. dataRange: {
  49. orient: 'horizontal',
  50. min: 0,
  51. max: 55000,
  52. text:['高','低'], // 文本,默认为数值文本
  53. splitNumber:0
  54. },
  55. toolbox: {
  56. show : true,
  57. orient: 'vertical',
  58. x:'right',
  59. y:'center',
  60. feature : {
  61. mark : {show: true},
  62. dataView : {show: true, readOnly: false}
  63. }
  64. },
  65. series : [
  66. {
  67. name: '2011全国GDP分布',
  68. type: 'map',
  69. mapType: 'china',
  70. mapLocation: {
  71. x: 'left'
  72. },
  73. selectedMode : 'multiple',
  74. itemStyle:{
  75. normal:{label:{show:true}},
  76. emphasis:{label:{show:true}}
  77. },
  78. data:[
  79. {name:'西藏', value:605.83},
  80. {name:'青海', value:1670.44},
  81. {name:'宁夏', value:2102.21},
  82. {name:'海南', value:2522.66},
  83. {name:'甘肃', value:5020.37},
  84. {name:'贵州', value:5701.84},
  85. {name:'新疆', value:6610.05},
  86. {name:'云南', value:8893.12},
  87. {name:'重庆', value:10011.37},
  88. {name:'吉林', value:10568.83},
  89. {name:'山西', value:11237.55},
  90. {name:'天津', value:11307.28},
  91. {name:'江西', value:11702.82},
  92. {name:'广西', value:11720.87},
  93. {name:'陕西', value:12512.3},
  94. {name:'黑龙江', value:12582},
  95. {name:'内蒙古', value:14359.88},
  96. {name:'安徽', value:15300.65},
  97. {name:'北京', value:16251.93, selected:true},
  98. {name:'福建', value:17560.18},
  99. {name:'上海', value:19195.69, selected:true},
  100. {name:'湖北', value:19632.26},
  101. {name:'湖南', value:19669.56},
  102. {name:'四川', value:21026.68},
  103. {name:'辽宁', value:22226.7},
  104. {name:'河北', value:24515.76},
  105. {name:'河南', value:26931.03},
  106. {name:'浙江', value:32318.85},
  107. {name:'山东', value:45361.85},
  108. {name:'江苏', value:49110.27},
  109. {name:'广东', value:53210.28, selected:true}
  110. ]
  111. },
  112. {
  113. name:'2011全国GDP对比',
  114. type:'pie',
  115. roseType : 'area',
  116. tooltip: {
  117. trigger: 'item',
  118. formatter: "{a} <br/>{b} : {c} ({d}%)"
  119. },
  120. center: [document.getElementById('main').offsetWidth - 250, 225],
  121. radius: [30, 120],
  122. data:[
  123. {name: '北京', value: 16251.93},
  124. {name: '上海', value: 19195.69},
  125. {name: '广东', value: 53210.28}
  126. ]
  127. }
  128. ],
  129. animation: false
  130. };
  131. var ecConfig = require('echarts/config');
  132. myChart.on(ecConfig.EVENT.MAP_SELECTED, function (param){
  133. var selected = param.selected;
  134. var mapSeries = option.series[0];
  135. var data = [];
  136. var legendData = [];
  137. var name;
  138. for (var p = 0, len = mapSeries.data.length; p < len; p++) {
  139. name = mapSeries.data[p].name;
  140. //mapSeries.data[p].selected = selected[name];
  141. if (selected[name]) {
  142. data.push({
  143. name: name,
  144. value: mapSeries.data[p].value
  145. });
  146. legendData.push(name);
  147. }
  148. }
  149. option.legend.data = legendData;
  150. option.series[1].data = data;
  151. myChart.setOption(option, true);
  152. })
  153. </textarea>
  154. </div><!--/.well -->
  155. </div><!--/span-->
  156. <div id="graphic" class="col-md-8">
  157. <div id="main" class="main"></div>
  158. <div>
  159. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  160. <span class="text-primary">切换主题</span>
  161. <select id="theme-select"></select>
  162. <span id='wrong-message' style="color:red"></span>
  163. </div>
  164. </div><!--/span-->
  165. </div><!--/row-->
  166. </div><!--/.fluid-container-->
  167. <footer id="footer"></footer>
  168. <!-- Le javascript
  169. ================================================== -->
  170. <!-- Placed at the end of the document so the pages load faster -->
  171. <script src="../asset/js/jquery.min.js"></script>
  172. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  173. <script src="../asset/js/bootstrap.min.js"></script>
  174. <script src="../asset/js/echartsExample.js"></script>
  175. </body>
  176. </html>