components_echarts_react.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8" />
  8. <title data-i18n="resources.title_componentsEcharts_React"></title>
  9. <script type="text/javascript" include="react,jquery" src="../js/include-web.js"></script>
  10. <script include="antd,iclient-mapboxgl-react,mapbox-gl-enhance,echarts" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  11. <style>
  12. html,
  13. body {
  14. height: 100%;
  15. margin: 0;
  16. padding: 0;
  17. }
  18. #main {
  19. height: 100%;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <div id="main"></div>
  25. <script type="text/babel">
  26. var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
  27. var attribution =
  28. "<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. " Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> ";
  31. var SmWebMap = SuperMap.Components.SmWebMap;
  32. var SmEchartsLayer = SuperMap.Components.SmEchartsLayer;
  33. var mapOptions = {
  34. container: 'map', // container id
  35. style: {
  36. version: 8,
  37. sources: {
  38. 'raster-tiles': {
  39. attribution: attribution,
  40. type: 'raster',
  41. tiles: [host + '/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}'],
  42. tileSize: 256
  43. }
  44. },
  45. layers: [
  46. {
  47. id: 'simple-tiles',
  48. type: 'raster',
  49. source: 'raster-tiles',
  50. minzoom: 0,
  51. maxzoom: 22
  52. }
  53. ]
  54. },
  55. center: [125.35, 43.86],
  56. zoom: 10
  57. };
  58. $.get('../data/changchunBus.json', function(data) {
  59. var echartsOptions = {
  60. animation: false,
  61. GLMap: {
  62. roam: true
  63. },
  64. coordinateSystem: 'GLMap',
  65. geo: {
  66. map: 'GLMap'
  67. },
  68. series: [
  69. {
  70. type: 'lines',
  71. polyline: true,
  72. data: data,
  73. silent: true,
  74. lineStyle: {
  75. normal: {
  76. opacity: 0.2,
  77. width: 1
  78. }
  79. },
  80. progressiveThreshold: 500,
  81. progressive: 100
  82. },
  83. {
  84. type: 'lines',
  85. coordinateSystem: 'GLMap',
  86. polyline: true,
  87. data: data,
  88. lineStyle: {
  89. normal: {
  90. width: 0.2
  91. }
  92. },
  93. effect: {
  94. constantSpeed: 40,
  95. show: true,
  96. trailLength: 0.02,
  97. symbolSize: 2
  98. }
  99. }
  100. ]
  101. };
  102. ReactDOM.render(
  103. <SmWebMap mapOptions={mapOptions}>
  104. <SmEchartsLayer options={echartsOptions} />
  105. </SmWebMap>,
  106. document.getElementById('main')
  107. );
  108. });
  109. </script>
  110. </body>
  111. </html>