No Description

map1.html 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <div id="main" style="width: 800px;height: 600px;"></div>
  9. </body>
  10. <script src="js/echarts.min.js"></script>
  11. <script src="js/jquery.min.js"></script>
  12. <script type="text/javascript">
  13. var uploadedDataURL = "https://geo.datav.aliyun.com/areas_v2/bound/410500_full.json";
  14. var myChart = echarts.init(document.getElementById('main'));
  15. var center = {
  16. "安阳县": [114.295989, 36.231785],
  17. "北关区": [114.379621, 36.137115],
  18. "滑县": [114.667181, 35.465867],
  19. "龙安区": [114.254489, 36.044375],
  20. "高新区": [114.310095, 36.115555],
  21. "殷都区": [114.289197, 36.133648],
  22. "文峰区": [114.418257, 36.034251],
  23. "汤阴县": [114.455689, 35.902302],
  24. "内黄县": [114.8165, 35.900576],
  25. "林州市": [113.854634, 36.010256]
  26. }
  27. console.log(Object.keys(center).map(name => {return {
  28. name: name,
  29. value: Math.random()*100
  30. }}))
  31. var points = [{
  32. name: '安阳县',
  33. value: [114.295989,36.231785]
  34. },
  35. {
  36. name: '北关区',
  37. value: [114.379621,36.137115]
  38. },
  39. {
  40. name: '滑县',
  41. value: [ 114.667181,35.465867]
  42. },
  43. {
  44. name: '龙安区',
  45. value: [114.254489,36.044375]
  46. },
  47. {
  48. name: '林州市',
  49. value: [113.854634,36.010256]
  50. },
  51. {
  52. name: '内黄县',
  53. value: [114.8165,35.900576]
  54. },
  55. {
  56. name: '汤阴县',
  57. value: [ 114.455689,35.902302]
  58. },
  59. {
  60. name: '文峰区',
  61. value: [114.418257,36.034251]
  62. },
  63. {
  64. name: '殷都区',
  65. value:[114.289197,36.133648]
  66. }
  67. ];
  68. var option = null;
  69. $.get(uploadedDataURL, function(json) {
  70. echarts.registerMap('js', json);
  71. option = {
  72. visualMap: {
  73. show: true,
  74. max: 100,
  75. seriesIndex: [0],
  76. calculable: true,
  77. },
  78. geo: [{
  79. map: 'js',
  80. roam: false, //是否允许缩放
  81. zoom: 1.1, //默认显示级别
  82. scaleLimit: {
  83. min: 0,
  84. max: 3
  85. }, //缩放级别
  86. itemStyle: {
  87. normal: {
  88. // areaColor: '#013C62',
  89. shadowColor: '#013C62',
  90. shadowBlur: 20,
  91. shadowOffsetX: -5,
  92. shadowOffsetY: 15,
  93. }
  94. },
  95. tooltip: {
  96. show: false
  97. }
  98. }],
  99. series: [
  100. //地图
  101. {
  102. type: 'map',
  103. mapType: 'js',
  104. geoIndex: -1,
  105. zoom: 1.1, //默认显示级别
  106. label: {
  107. show: true,
  108. color: '#ffffff',
  109. emphasis: {
  110. color: 'white',
  111. show: false
  112. }
  113. },
  114. itemStyle: {
  115. normal: {
  116. borderColor: '#2980b9',
  117. borderWidth: 1,
  118. areaColor: '#12235c'
  119. },
  120. emphasis: {
  121. areaColor: '#FA8C16',
  122. borderWidth: 0,
  123. color: 'green'
  124. }
  125. },
  126. data: Object.keys(center).map(name => {return {
  127. name: name,
  128. value: Math.random()*100
  129. }})
  130. },
  131. {
  132. type: 'effectScatter',
  133. coordinateSystem: 'geo',
  134. showEffectOn: 'render',
  135. rippleEffect: {
  136. period: 5,
  137. scale: 5,
  138. brushType: 'fill'
  139. },
  140. hoverAnimation: true,
  141. // label: {
  142. // formatter: '{b}',
  143. // position: 'right',
  144. // offset: [15, 0],
  145. // color: '#f0f',
  146. // show: true
  147. // },
  148. itemStyle: {
  149. normal: {
  150. color: '#f0f',
  151. shadowBlur: 10,
  152. shadowColor: '#ff0'
  153. }
  154. },
  155. emphasis: {
  156. show: false,
  157. itemStyle: {
  158. opacity: 1, //线条宽度
  159. }
  160. },
  161. data: points
  162. }, {
  163. name: '供应商A',
  164. type: 'lines',
  165. zlevel: 2,
  166. symbol: ['none', 'arrow'],
  167. symbolSize: 7,
  168. effect: {
  169. show: true,
  170. period: 4,
  171. trailLength: 0.02,
  172. symbol: 'circle',
  173. symbolSize: 4,
  174. color: '#fff'
  175. },
  176. lineStyle: {
  177. color: '#f0f',
  178. width: 0.5, //线条宽度
  179. opacity: 0.5, //尾迹线条透明度
  180. curveness: .3, //尾迹线条曲直度
  181. shadowBlur: 10,
  182. },
  183. emphasis: {
  184. lineStyle: {
  185. width: 2, //线条宽度
  186. }
  187. },
  188. data: [{
  189. name: '供应商A->BossSoft',
  190. // value: 40,
  191. coords: [
  192. [113.854634,36.010256],
  193. [114.418257,36.034251]
  194. ],
  195. }]
  196. }, {
  197. name: '供应商B',
  198. type: 'lines',
  199. zlevel: 2,
  200. symbol: ['none', 'arrow'],
  201. symbolSize: 7,
  202. effect: {
  203. show: true,
  204. period: 4,
  205. trailLength: 0.02,
  206. symbol: 'circle',
  207. symbolSize: 4,
  208. color: '#fff'
  209. },
  210. lineStyle: {
  211. width: 0.5, //线条宽度
  212. opacity: 0.5, //尾迹线条透明度
  213. curveness: 0.3, //尾迹线条曲直度
  214. shadowBlur: 10,
  215. },
  216. emphasis: {
  217. lineStyle: {
  218. width: 2, //线条宽度
  219. }
  220. },
  221. data: [{
  222. name: '供应商B->BossSoft',
  223. // value: 80,
  224. coords: [
  225. [114.295989,36.231785],
  226. [114.418257,36.034251]
  227. ]
  228. }]
  229. }
  230. ]
  231. };
  232. myChart.setOption(option);
  233. });
  234. </script>
  235. </html>