echarts_scatterWeibo.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <html>
  5. <head>
  6. <meta charset='utf-8'/>
  7. <title data-i18n="resources.title_scatterWeibo"></title>
  8. <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no'/>
  9. <script type="text/javascript" include="jquery" src="../js/include-web.js"></script>
  10. <style>
  11. body {
  12. margin: 0;
  13. padding: 0;
  14. }
  15. #map {
  16. position: absolute;
  17. top: 0;
  18. bottom: 0;
  19. width: 100%;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div id='map'></div>
  25. <script type="text/javascript" exclude='iclient-mapboxgl' include="echarts"
  26. src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  27. <script type="text/javascript">
  28. var attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  29. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  30. " Image <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a> | </span>" +
  31. " <a href='https://echarts.baidu.com' target='_blank'>© 2018 " + resources.title_3baidu + " ECharts</a>";
  32. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  33. var tileURL = host + "/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}";
  34. var map = new mapboxgl.Map({
  35. container: 'map',
  36. style: {
  37. "version": 8,
  38. "sources": {
  39. "raster-tiles": {
  40. "attribution": attribution,
  41. "type": "raster",
  42. "tiles": [tileURL],
  43. "tileSize": 256,
  44. },
  45. },
  46. "layers": [{
  47. "id": "simple-tiles",
  48. "type": "raster",
  49. "source": "raster-tiles",
  50. "minzoom": 0,
  51. "maxzoom": 22
  52. }]
  53. },
  54. center: [112, 37.94],
  55. zoom: 3
  56. });
  57. map.addControl(new mapboxgl.NavigationControl(), 'top-left');
  58. $.get('../data/weibo.json', function (weiboData) {
  59. weiboData = weiboData.map(function (serieData, idx) {
  60. var px = serieData[0] / 1000;
  61. var py = serieData[1] / 1000;
  62. var res = [
  63. [px, py]
  64. ];
  65. for (var i = 2; i < serieData.length; i += 2) {
  66. var dx = serieData[i] / 1000;
  67. var dy = serieData[i + 1] / 1000;
  68. var x = px + dx;
  69. var y = py + dy;
  70. res.push([x.toFixed(2), y.toFixed(2), 1]);
  71. px = x;
  72. py = y;
  73. }
  74. return res;
  75. });
  76. var echartslayer = new EchartsLayer(map);
  77. echartslayer.chart.setOption(option = {
  78. GLMap: {
  79. roam: true
  80. },
  81. coordinateSystem: 'GLMap',
  82. title: {
  83. text: resources.text_weiboChina,
  84. subtext: 'From ThinkGIS',
  85. sublink: 'http://www.thinkgis.cn/public/sina',
  86. left: 'center',
  87. top: 'top',
  88. textStyle: {
  89. color: '#fff'
  90. }
  91. },
  92. tooltip: {},
  93. legend: {
  94. left: 'left',
  95. top: 'bottom',
  96. data: [resources.text_strong, resources.text_middle, resources.text_weak],
  97. textStyle: {
  98. color: '#ccc'
  99. }
  100. },
  101. geo: {
  102. name: resources.text_strong,
  103. type: 'scatter',
  104. map: 'GLMap',
  105. label: {
  106. emphasis: {
  107. show: false
  108. }
  109. },
  110. itemStyle: {
  111. normal: {
  112. areaColor: '#323c48',
  113. borderColor: '#111'
  114. },
  115. emphasis: {
  116. areaColor: '#2a333d'
  117. }
  118. }
  119. },
  120. series: [{
  121. name: resources.text_weak,
  122. type: 'scatter',
  123. coordinateSystem: 'GLMap',
  124. symbolSize: 1,
  125. large: true,
  126. itemStyle: {
  127. normal: {
  128. shadowBlur: 2,
  129. shadowColor: 'rgba(37, 140, 249, 0.8)',
  130. color: 'rgba(37, 140, 249, 0.8)'
  131. }
  132. },
  133. data: weiboData[0]
  134. }, {
  135. name: resources.text_middle,
  136. type: 'scatter',
  137. coordinateSystem: 'GLMap',
  138. symbolSize: 1,
  139. large: true,
  140. itemStyle: {
  141. normal: {
  142. shadowBlur: 2,
  143. shadowColor: 'rgba(14, 241, 242, 0.8)',
  144. color: 'rgba(14, 241, 242, 0.8)'
  145. }
  146. },
  147. data: weiboData[1]
  148. }, {
  149. name: resources.text_strong,
  150. type: 'scatter',
  151. coordinateSystem: 'GLMap',
  152. symbolSize: 1,
  153. large: true,
  154. itemStyle: {
  155. normal: {
  156. shadowBlur: 2,
  157. shadowColor: 'rgba(255, 255, 255, 0.8)',
  158. color: 'rgba(255, 255, 255, 0.8)'
  159. }
  160. },
  161. data: weiboData[2]
  162. }]
  163. });
  164. });
  165. </script>
  166. </body>
  167. </html>