map.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1" />
  5. <script src="esl.js"></script>
  6. <script src="config.js"></script>
  7. <script src="lib/jquery.min.js"></script>
  8. <script src="lib/facePrint.js"></script>
  9. </head>
  10. <body>
  11. <style>
  12. html, body, #main {
  13. width: 100%;
  14. height: 100%;
  15. margin: 0;
  16. }
  17. </style>
  18. <div id="main"></div>
  19. <script>
  20. require([
  21. 'echarts',
  22. 'echarts/chart/map',
  23. 'echarts/component/title',
  24. 'echarts/component/legend',
  25. 'echarts/component/visualMap',
  26. 'echarts/component/markPoint'
  27. ], function (echarts) {
  28. require(['map/js/china'], function () {
  29. var chart = echarts.init(document.getElementById('main'));
  30. var itemStyle = {
  31. normal:{
  32. borderColor: 'rgba(0, 0, 0, 0.2)'
  33. },
  34. emphasis:{
  35. shadowOffsetX: 0,
  36. shadowOffsetY: 0,
  37. shadowBlur: 20,
  38. borderWidth: 0,
  39. shadowColor: 'rgba(0, 0, 0, 0.5)'
  40. }
  41. }
  42. chart.setOption({
  43. title : {
  44. text: 'iphone销量',
  45. subtext: '纯属虚构',
  46. left: 'center'
  47. },
  48. legend: {
  49. orient: 'vertical',
  50. left: 'left',
  51. data:['iphone3','iphone4','iphone5']
  52. },
  53. visualMap: {
  54. min: 0,
  55. max: 1500,
  56. left: 'left',
  57. top: 'bottom',
  58. text:['高','低'], // 文本,默认为数值文本
  59. calculable : true
  60. },
  61. selectedMode: 'single',
  62. series : [
  63. {
  64. name: 'iphone3',
  65. type: 'map',
  66. map: 'china',
  67. itemStyle: itemStyle,
  68. showLegendSymbol: true,
  69. zoom: 10,
  70. roam: true,
  71. center: [115.97, 29.71],
  72. markPoint: {
  73. data: [{
  74. coord: [115.97, 29.71]
  75. }]
  76. },
  77. label: {
  78. normal: {
  79. show: true
  80. },
  81. emphasis: {
  82. show: true
  83. }
  84. },
  85. data:[
  86. {name: '北京',value: Math.round(Math.random()*1000)},
  87. {name: '天津',value: Math.round(Math.random()*1000)},
  88. {name: '上海',value: Math.round(Math.random()*1000)},
  89. {name: '重庆',value: Math.round(Math.random()*1000)},
  90. {name: '河北',value: Math.round(Math.random()*1000)},
  91. {name: '河南',value: Math.round(Math.random()*1000)},
  92. {name: '云南',value: Math.round(Math.random()*1000)},
  93. {name: '辽宁',value: Math.round(Math.random()*1000)},
  94. {name: '黑龙江',value: Math.round(Math.random()*1000)},
  95. {name: '湖南',value: Math.round(Math.random()*1000)},
  96. {name: '安徽',value: Math.round(Math.random()*1000)},
  97. {name: '山东',value: Math.round(Math.random()*1000)},
  98. {name: '新疆',value: Math.round(Math.random()*1000)},
  99. {name: '江苏',value: Math.round(Math.random()*1000)},
  100. {name: '浙江',value: Math.round(Math.random()*1000)},
  101. {name: '江西',value: Math.round(Math.random()*1000)},
  102. {name: '湖北',value: Math.round(Math.random()*1000)},
  103. {name: '广西',value: Math.round(Math.random()*1000)},
  104. {name: '甘肃',value: Math.round(Math.random()*1000)},
  105. {name: '山西',value: Math.round(Math.random()*1000)},
  106. {name: '内蒙古',value: Math.round(Math.random()*1000)},
  107. {name: '陕西',value: Math.round(Math.random()*1000)},
  108. {name: '吉林',value: Math.round(Math.random()*1000)},
  109. {name: '福建',value: Math.round(Math.random()*1000)},
  110. {name: '贵州',value: Math.round(Math.random()*1000)},
  111. {name: '广东',value: Math.round(Math.random()*1000)},
  112. {name: '青海',value: Math.round(Math.random()*1000)},
  113. {name: '西藏',value: Math.round(Math.random()*1000)},
  114. {name: '四川',value: Math.round(Math.random()*1000)},
  115. {name: '宁夏',value: Math.round(Math.random()*1000)},
  116. {name: '海南',value: Math.round(Math.random()*1000)},
  117. {name: '台湾',value: Math.round(Math.random()*1000)},
  118. {name: '香港',value: Math.round(Math.random()*1000)},
  119. {name: '澳门',value: Math.round(Math.random()*1000)}
  120. ]
  121. },
  122. {
  123. name: 'iphone4',
  124. type: 'map',
  125. mapType: 'china',
  126. itemStyle: itemStyle,
  127. showLegendSymbol: true,
  128. label: {
  129. normal: {
  130. show: true
  131. },
  132. emphasis: {
  133. show: true
  134. }
  135. },
  136. data:[
  137. {name: '北京',value: Math.round(Math.random()*1000)},
  138. {name: '天津',value: Math.round(Math.random()*1000)},
  139. {name: '上海',value: Math.round(Math.random()*1000)},
  140. {name: '重庆',value: Math.round(Math.random()*1000)},
  141. {name: '河北',value: Math.round(Math.random()*1000)},
  142. {name: '安徽',value: Math.round(Math.random()*1000)},
  143. {name: '新疆',value: Math.round(Math.random()*1000)},
  144. {name: '浙江',value: Math.round(Math.random()*1000)},
  145. {name: '江西',value: Math.round(Math.random()*1000)},
  146. {name: '山西',value: Math.round(Math.random()*1000)},
  147. {name: '内蒙古',value: Math.round(Math.random()*1000)},
  148. {name: '吉林',value: Math.round(Math.random()*1000)},
  149. {name: '福建',value: Math.round(Math.random()*1000)},
  150. {name: '广东',value: Math.round(Math.random()*1000)},
  151. {name: '西藏',value: Math.round(Math.random()*1000)},
  152. {name: '四川',value: Math.round(Math.random()*1000)},
  153. {name: '宁夏',value: Math.round(Math.random()*1000)},
  154. {name: '香港',value: Math.round(Math.random()*1000)},
  155. {name: '澳门',value: Math.round(Math.random()*1000)}
  156. ]
  157. },
  158. {
  159. name: 'iphone5',
  160. type: 'map',
  161. mapType: 'china',
  162. itemStyle: itemStyle,
  163. showLegendSymbol: true,
  164. label: {
  165. normal: {
  166. show: true
  167. },
  168. emphasis: {
  169. show: true
  170. }
  171. },
  172. data:[
  173. {name: '北京',value: Math.round(Math.random()*1000)},
  174. {name: '天津',value: Math.round(Math.random()*1000)},
  175. {name: '上海',value: Math.round(Math.random()*1000)},
  176. {name: '广东',value: Math.round(Math.random()*1000)},
  177. {name: '台湾',value: Math.round(Math.random()*1000)},
  178. {name: '香港',value: Math.round(Math.random()*1000)},
  179. {name: '澳门',value: Math.round(Math.random()*1000)}
  180. ]
  181. }
  182. ]
  183. });
  184. });
  185. });
  186. </script>
  187. </body>
  188. </html>