echarts_linesDrawMillionsWaterSystem.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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_waterSystem"></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: [106, 37.94],
  54. zoom: 4,
  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_water_10w/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.appendData({
  79. seriesIndex: 0,
  80. data: rawData
  81. });
  82. fetchData(idx + 1);
  83. };
  84. xhr.send();
  85. }
  86. option = {
  87. progressive: 20000,
  88. GLMap: {
  89. roam: true
  90. },
  91. title: {
  92. top: '10px',
  93. text: resources.text_echartsLinesMillions_waterSystem,
  94. subtext: resources.text_echartsLinesMillions_waterSystem_subtext,
  95. left: 'center',
  96. textStyle: {
  97. color: '#fff'
  98. },
  99. subtextStyle: {
  100. color: '#fff'
  101. }
  102. },
  103. coordinateSystem: 'GLMap',
  104. series:
  105. [{
  106. type: 'lines',
  107. blendMode: 'lighter',
  108. coordinateSystem: 'GLMap',
  109. dimensions: ['value'],
  110. data: new Float64Array(),
  111. polyline: true,
  112. large: true,
  113. lineStyle: {
  114. color: '#0099FF',
  115. width: 1,
  116. opacity: 0.3
  117. }
  118. }]
  119. };
  120. fetchData(0);
  121. echartslayer.chart.setOption(option);
  122. </script>
  123. </body>
  124. </html>