echarts_scatterDrawMillionsNewYorkTaxiPoints.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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_echartsLinesMillions_nyTaxi"></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" include="echarts" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  26. <script type="text/javascript">
  27. var attribution = "<a href='https://www.mapbox.com/about/maps/' target='_blank'>© Mapbox </a>" +
  28. " with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a> | </span>" +
  29. " Image <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a> | </span>" +
  30. " <a href='https://echarts.baidu.com' target='_blank'>© 2018 " + resources.title_3baidu + " ECharts</a>";
  31. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  32. var tileURL = host + "/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}";
  33. var map = new mapboxgl.Map({
  34. container: 'map',
  35. style: {
  36. "version": 8,
  37. "sources": {
  38. "raster-tiles": {
  39. "attribution": attribution,
  40. "type": "raster",
  41. "tiles": [tileURL],
  42. "tileSize": 256,
  43. },
  44. },
  45. "layers": [{
  46. "id": "simple-tiles",
  47. "type": "raster",
  48. "source": "raster-tiles",
  49. "minzoom": 0,
  50. "maxzoom": 18
  51. }]
  52. },
  53. center: [-73.931577, 40.765654],
  54. zoom: 10.5,
  55. itemStyle: {
  56. normal: {
  57. color: 'transparent',
  58. borderColor: 'rgba(255,255,255,0.1)',
  59. borderWidth: 1
  60. }
  61. },
  62. roam: true,
  63. silent: true
  64. });
  65. map.addControl(new mapboxgl.NavigationControl(), 'top-left');
  66. var echartslayer = new EchartsLayer(map);
  67. var CHUNK_COUNT = 19;
  68. function fetchData(idx) {
  69. if (idx >= CHUNK_COUNT) {
  70. return;
  71. }
  72. var dataURL = "https://iclient.supermap.io/web/data/bigdata_nytaxi/data_" + idx + ".bin";
  73. var xhr = new XMLHttpRequest();
  74. xhr.open('GET', dataURL, true);
  75. xhr.responseType = 'arraybuffer';
  76. xhr.onload = function (e) {
  77. var rawData = new Float32Array(this.response);
  78. echartslayer.chart
  79. .appendData({
  80. seriesIndex: 0,
  81. data: rawData
  82. });
  83. fetchData(idx + 1);
  84. };
  85. xhr.send();
  86. }
  87. echartslayer.chart.setOption({
  88. title: {
  89. top: '10px',
  90. text: resources.text_echartsLinesMillions_nyTaxi,
  91. subtext: resources.text_echartsLinesMillions_nyTaxi_subtext,
  92. left: 'center',
  93. textStyle: {
  94. color: '#fff'
  95. },
  96. subtextStyle: {
  97. color: '#fff'
  98. }
  99. },
  100. GLMap: {
  101. roam: true
  102. },
  103. series: [{
  104. type: 'scatter',
  105. progressive: 1e5,
  106. coordinateSystem: 'GLMap',
  107. symbolSize: 0.5,
  108. blendMode: 'lighter',
  109. large: true,
  110. itemStyle: {
  111. color: '#FF3300',
  112. },
  113. postEffect: {
  114. enable: true
  115. },
  116. silent: true,
  117. dimensions: ['lng', 'lat'],
  118. data: new Float32Array()
  119. }]
  120. });
  121. fetchData(0);
  122. </script>
  123. </body>
  124. </html>