map7.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. <style type="text/css">
  26. .CodeMirror {
  27. height: 550px;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <!-- Fixed navbar -->
  33. <div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
  34. <div class="container-fluid">
  35. <div class="row-fluid example">
  36. <div id="sidebar-code" class="col-md-4">
  37. <div class="well sidebar-nav">
  38. <div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
  39. <textarea id="code" name="code">
  40. // 自定义扩展图表类型:mapType = USA
  41. require('echarts/util/mapData/params').params.USA = {
  42. getGeoJson: function (callback) {
  43. $.getJSON('geoJson/USA_geo.json', callback);
  44. },
  45. specialArea : {
  46. Alaska : { // 把阿拉斯加移到美国主大陆左下方
  47. left : -127, // 安放位置起始点为西经113
  48. top : 30, // 北纬31度
  49. width : 15, // 区间大小宽高不大于15度
  50. height : 15
  51. },
  52. Hawaii : {
  53. left : -110, // 夏威夷
  54. top : 28,
  55. width : 5,
  56. height : 5
  57. },
  58. 'Puerto Rico' : { // 波多黎各
  59. left : -76,
  60. top : 26,
  61. width : 2,
  62. height : 2
  63. }
  64. }
  65. }
  66. option = {
  67. title : {
  68. text: 'USA Population Estimates (2012)',
  69. subtext: 'Data from www.census.gov.',
  70. sublink: 'http://www.census.gov/popest/data/datasets.html',
  71. x:'right'
  72. },
  73. tooltip : {
  74. trigger: 'item',
  75. showDelay: 0,
  76. transitionDuration: 0.2,
  77. formatter : function (params) {
  78. var value = (params.value + '').split('.');
  79. value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,');
  80. return params.seriesName + '<br/>' + params.name + ' : ' + value;
  81. }
  82. },
  83. dataRange: {
  84. x : 'right',
  85. min: 500000,
  86. max: 38000000,
  87. color: ['orangered','yellow','lightskyblue'],
  88. text:['High','Low'], // 文本,默认为数值文本
  89. calculable : true
  90. },
  91. toolbox: {
  92. show : true,
  93. //orient : 'vertical',
  94. x: 'left',
  95. y: 'top',
  96. feature : {
  97. mark : {show: true},
  98. dataView : {show: true, readOnly: false},
  99. restore : {show: true},
  100. saveAsImage : {show: true}
  101. }
  102. },
  103. series : [
  104. {
  105. name: 'USA PopEstimates',
  106. type: 'map',
  107. roam: true,
  108. mapType: 'USA', // 自定义扩展图表类型
  109. itemStyle:{
  110. emphasis:{label:{show:true}}
  111. },
  112. // 文本位置修正
  113. textFixed : {
  114. Alaska : [20, -20]
  115. },
  116. data:[
  117. {name : 'Alabama', value : 4822023},
  118. {name : 'Alaska', value : 731449},
  119. {name : 'Arizona', value : 6553255},
  120. {name : 'Arkansas', value : 2949131},
  121. {name : 'California', value : 38041430},
  122. {name : 'Colorado', value : 5187582},
  123. {name : 'Connecticut', value : 3590347},
  124. {name : 'Delaware', value : 917092},
  125. {name : 'District of Columbia', value : 632323},
  126. {name : 'Florida', value : 19317568},
  127. {name : 'Georgia', value : 9919945},
  128. {name : 'Hawaii', value : 1392313},
  129. {name : 'Idaho', value : 1595728},
  130. {name : 'Illinois', value : 12875255},
  131. {name : 'Indiana', value : 6537334},
  132. {name : 'Iowa', value : 3074186},
  133. {name : 'Kansas', value : 2885905},
  134. {name : 'Kentucky', value : 4380415},
  135. {name : 'Louisiana', value : 4601893},
  136. {name : 'Maine', value : 1329192},
  137. {name : 'Maryland', value : 5884563},
  138. {name : 'Massachusetts', value : 6646144},
  139. {name : 'Michigan', value : 9883360},
  140. {name : 'Minnesota', value : 5379139},
  141. {name : 'Mississippi', value : 2984926},
  142. {name : 'Missouri', value : 6021988},
  143. {name : 'Montana', value : 1005141},
  144. {name : 'Nebraska', value : 1855525},
  145. {name : 'Nevada', value : 2758931},
  146. {name : 'New Hampshire', value : 1320718},
  147. {name : 'New Jersey', value : 8864590},
  148. {name : 'New Mexico', value : 2085538},
  149. {name : 'New York', value : 19570261},
  150. {name : 'North Carolina', value : 9752073},
  151. {name : 'North Dakota', value : 699628},
  152. {name : 'Ohio', value : 11544225},
  153. {name : 'Oklahoma', value : 3814820},
  154. {name : 'Oregon', value : 3899353},
  155. {name : 'Pennsylvania', value : 12763536},
  156. {name : 'Rhode Island', value : 1050292},
  157. {name : 'South Carolina', value : 4723723},
  158. {name : 'South Dakota', value : 833354},
  159. {name : 'Tennessee', value : 6456243},
  160. {name : 'Texas', value : 26059203},
  161. {name : 'Utah', value : 2855287},
  162. {name : 'Vermont', value : 626011},
  163. {name : 'Virginia', value : 8185867},
  164. {name : 'Washington', value : 6897012},
  165. {name : 'West Virginia', value : 1855413},
  166. {name : 'Wisconsin', value : 5726398},
  167. {name : 'Wyoming', value : 576412},
  168. {name : 'Puerto Rico', value : 3667084}
  169. ]
  170. }
  171. ]
  172. };
  173. </textarea>
  174. </div><!--/.well -->
  175. </div><!--/span-->
  176. <div id="graphic" class="col-md-8">
  177. <div id="main" class="main" style="height: 530px;"></div>
  178. <div>
  179. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  180. <span class="text-primary">切换主题</span>
  181. <select id="theme-select"></select>
  182. <span id='wrong-message' style="color:red"></span>
  183. </div>
  184. </div><!--/span-->
  185. </div><!--/row-->
  186. </div><!--/.fluid-container-->
  187. <footer id="footer"></footer>
  188. <!-- Le javascript
  189. ================================================== -->
  190. <!-- Placed at the end of the document so the pages load faster -->
  191. <script src="../asset/js/jquery.min.js"></script>
  192. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  193. <script src="../asset/js/bootstrap.min.js"></script>
  194. <script src="../asset/js/echartsExample.js"></script>
  195. </body>
  196. </html>