文档管理中心
指南地图服务JavaScript数据可视化

数据可视化

华为地图提供数据可视化插件echarts-extension-hwmap.min.js,结合ECharts可视化组件,可用于展示大量基于2D/3D的地理信息点线面数据,实现散点图、热力图、3D柱状图等炫酷的地图渲染效果。

实现步骤

  1. 引入华为地图API文件及相关插件,ECharts插件版本要求:echarts.js版本大于5,echarts-gl.js版本与echarts.js配套。
    收起
    自动换行
    深色代码主题
    复制
    1. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
      API KEY
      "></script>
    2. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
    3. <script type="text/javascript" src="assets/js/echarts.js"></script>
    4. <script type="text/javascript" src="assets/js/echarts-gl.js"></script>
    5. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  2. 引入数据源。
  3. 配置option,包括series和hwmap/hwmap3D(经纬度系统)等属性,hwmap3D不支持sourceType属性设置,默认为矢量图,且不支持覆盖物。
    • hwmap/hwmap3D基础属性请参见MapOptions。hwmap/hwmap3D新增属性:
      • hwmap
        1. renderOnMoving:是否开启实时渲染,默认true(开启)。
        2. roam:是否允许手势,默认true(允许)。
      • hwmap3D
        1. pitch:倾斜角度,最大60。
        2. boxHeight:柱状图或散点图高度。
    • series属性请参见ECharts官网,其中coordinateSystem经纬度系统属性配置为hwmap或hwmap3D。
  4. 调用chart.setOption,传入配置好的option参数,进行地图渲染和ECharts渲染。
说明

hwmap3D不支持sourceType属性设置,默认为矢量图,且不支持覆盖物。

2D类型scatter不兼容IE浏览器10以下的版本,echarts中的heatmap不兼容IE浏览器10及以下版本,3D和GL不兼容ie浏览器。

ScatterGL

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. window.initMap = function() {
  2. $.getJSON('
    assets/json/scatterGL.json
    ', function (data) {
  3. var chart = echarts.init(document.getElementById("echarts-map"));
  4. var option = {
  5. hwmap: {
  6. language: 'en',
  7. center: [ 2.352222, 48.856613],
  8. zoom: 15,
  9. presetStyleId: 'night',
  10. renderOnMoving: false,
  11. style:[]
  12. },
  13. series: [
  14. {
  15. type: 'scatterGL',
  16. progressive: 1e6,
  17. coordinateSystem: 'hwmap',
  18. symbolSize: 1,
  19. zoomScale: 0.002,
  20. blendMode: 'lighter',
  21. large: true,
  22. itemStyle: {
  23. color: '#f12201'
  24. },
  25. postEffect: {
  26. enable: true
  27. },
  28. sampling: 'average',
  29. silent: true,
  30. dimensions: ['lng', 'lat'],
  31. data: data,
  32. animation:false
  33. }
  34. ]
  35. };
  36. option && chart.setOption(option);
  37. })
  38. }
收起
自动换行
深色代码主题
复制
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="cleartype" content="on">
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <title>an example for echarts-extension-hwmap</title>
  11. <link rel="icon" href="data:;base64,=">
  12. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  13. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  14. <script type="text/javascript" src="echarts.js"></script>
  15. <script type="text/javascript" src="echarts-gl.js"></script>
  16. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  17. <script type="text/javascript" src="jquery.min.js"></script>
  18. <link rel="stylesheet" href="index.css">
  19. </head>
  20. <body>
  21. <div id="echarts-map"></div>
  22. <script src="index.js" type="text/javascript"></script>
  23. </body>
  24. </html>

Scatter3D

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. const chart = echarts.init(document.getElementById('echarts-map'));
  2. window.initMap = function() {
  3. $.getJSON('
    assets/json/scatter3D.json
    ', (data) => {
  4. chart.setOption({
  5. visualMap: [{
  6. show: false,
  7. seriesIndex: 0,
  8. text: ['scatter3D'],
  9. left: 'right',
  10. calculable: true,
  11. max: 35,
  12. inRange: {
  13. color: ['#6694aa', '#38e5eb', '#d94d4c'],
  14. },
  15. }],
  16. hwmap3D: {
  17. language:'en',
  18. presetStyleId: 'night',
  19. center: {lng: 0.95, lat: 47.156613},
  20. zoom: 6,
  21. boxHeight: 0,
  22. },
  23. series: [{
  24. name: 'scatter3D',
  25. type: 'scatter3D',
  26. coordinateSystem: 'hwmap3D',
  27. symbol: 'path://M512 490.666667C453.12 490.666667 405.333333 442.88 405.333333 384 405.333333 325.12 453.12 277.333333 512 277.333333 570.88 277.333333 618.666667 325.12 618.666667 384 618.666667 442.88 570.88 490.666667 512 490.666667M512 85.333333C346.88 85.333333 213.333333 218.88 213.333333 384 213.333333 608 512 938.666667 512 938.666667 512 938.666667 810.666667 608 810.666667 384 810.666667 218.88 677.12 85.333333 512 85.333333Z',
  28. symbolSize: [20, 25],
  29. opacity: 1,
  30. label: {
  31. show: false,
  32. formatter: '{b}',
  33. },
  34. itemStyle: {
  35. borderWidth: 0.5,
  36. borderColor: '#fff',
  37. },
  38. data,
  39. }],
  40. });
  41. window.onresize = chart.resize;
  42. });
  43. };
收起
自动换行
深色代码主题
复制
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <title>Map3D - ECHARTS-GL</title>
  7. <link rel="icon" href="data:;base64,=">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  11. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  12. <script type="text/javascript" src="echarts.min.js"></script>
  13. <script type="text/javascript" src="echarts-gl.js"></script>
  14. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  15. <script type="text/javascript" src="jquery.min.js"></script>
  16. <link rel="stylesheet" href="index.css">
  17. </head>
  18. <body>
  19. <div id="echarts-map"></div>
  20. <script src="index.js" type="text/javascript"> </script>
  21. </body>
  22. </html>

Heatmap

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. var chart = echarts.init(document.getElementById('echarts-map'));
  2. window.initMap=function(){
  3. $.getJSON('
    assets/json/heatmap.json
    ', function (data) {
  4. var option = {
  5. hwmap: {
  6. center: [9.888685440170336, 49.799172724734234],
  7. zoom: 4,
  8. // presetStyleId: 'night',
  9. language: 'en',
  10. renderOnMoving: true,
  11. echartsLayerInteractive: true,
  12. largeMode: false
  13. },
  14. visualMap: {
  15. show: true,
  16. right: 20,
  17. min: 0,
  18. max:1,
  19. seriesIndex: 0,
  20. calculable: true,
  21. inRange: {
  22. color: ['#7e06eb','#0a06eb', '#06d6eb', '#00ff2b','#eb7a06','#eb0606', 'red']
  23. }
  24. },
  25. animation: false,
  26. series: [
  27. {
  28. type: 'heatmap',
  29. coordinateSystem: 'hwmap',
  30. data: data,
  31. pointSize: 5,
  32. blurSize: 6
  33. }
  34. ]
  35. };
  36. chart.setOption(option);
  37. });
  38. }
收起
自动换行
深色代码主题
复制
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <title>an example for echarts-extension-hwmap</title>
  9. <link rel="icon" href="data:;base64,=">
  10. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  11. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  12. <script type="text/javascript" src="echarts.min.js"></script>
  13. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  14. <script type="text/javascript" src="jquery.min.js"></script>
  15. <link rel="stylesheet" href="index.css">
  16. </head>
  17. <body>
  18. <div id="echarts-map"></div>
  19. <script src="index.js" type="text/javascript"> </script>
  20. </body>
  21. </html>

Bar3D

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. const chart = echarts.init(document.getElementById('echarts-map'));
  2. window.initMap = function() {
  3. $.getJSON('
    assets/json/bar3DData.json
    ', (data) => {
  4. const options = {
  5. visualMap: [{
  6. show: false,
  7. min: 0,
  8. max: 100,
  9. seriesIndex: 0,
  10. calculable: true,
  11. inRange: {
  12. color: ['#a5f3fa', '#e8c6a3', '#f3683c', '#d73027', '#a50026'],
  13. },
  14. }],
  15. hwmap3D: {
  16. presetStyleId: 'night',
  17. sourceType: 'raster',
  18. center: {lng: -0.93, lat: 12.73},
  19. zoom: 9,
  20. pitch: 60,
  21. boxHeight: 120,
  22. language: 'en',
  23. },
  24. series: [{
  25. type: 'bar3D',
  26. roam: true,
  27. shading: 'realistic',
  28. coordinateSystem: 'hwmap3D',
  29. barSize: 5,
  30. bevelSize: 0.3,
  31. silent: true,
  32. data,
  33. }],
  34. };
  35. chart.setOption(options);
  36. const map = chart.getModel().getComponent('hwmap3D').getHWMap();
  37. const customPoi = new HWMapJsSDK.HWCustomPoi({
  38. map,
  39. icon: {
  40. anchor: 'bottom',
  41. scale: 1,
  42. opacity: 1,
  43. },
  44. label: {
  45. color: '#333',
  46. fontSize: '14px',
  47. text: 'point 1',
  48. offsetX: 0,
  49. offsetY: 0,
  50. },
  51. position: {lng: -0.93, lat: 12.73},
  52. zIndex: 0,
  53. collisionEnabled: true,
  54. variableLabelAnchor: ['top', 'bottom'],
  55. });
  56. });
  57. };
收起
自动换行
深色代码主题
复制
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="cleartype" content="on">
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <title>an example for echarts-extension-hwmap</title>
  11. <link rel="icon" href="data:;base64,=">
  12. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  13. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  14. <script type="text/javascript" src="echarts.min.js"></script>
  15. <script type="text/javascript" src="echarts-gl.js"></script>
  16. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  17. <script type="text/javascript" src="jquery.min.js"></script>
  18. <link rel="stylesheet" href="index.css">
  19. </head>
  20. <body>
  21. <div id="echarts-map"></div>
  22. <script src="index.js" type="text/javascript"> </script>
  23. </body>
  24. </html>

FlowGL

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. var chart = echarts.init(document.getElementById("echarts-map"));
  2. window.initMap = function() {
  3. $.getJSON('
    assets/json/flowGL.json
    ', function (data) {
  4. var max = 0;
  5. var min = Infinity;
  6. data.map(item =>{
  7. item.push(Math.sqrt(item[2] * item[2] + item[3] * item[3]))
  8. })
  9. data.map(item=> {
  10. max = Math.max(item[4], max);
  11. min = Math.min(item[4], min);
  12. })
  13. const option = {
  14. hwmap: {
  15. center: {lng:9.888685440170336, lat: 49.799172724734234},
  16. zoom: 1,
  17. language: 'en',
  18. style:[],
  19. renderOnMoving: true,
  20. },
  21. visualMap: {
  22. left: 'right',
  23. min,
  24. max,
  25. dimension: 4,
  26. inRange: {
  27. color: ['#0a06eb', '#06d6eb','#eb7a06','#eb0606', 'red']
  28. },
  29. calculable: true,
  30. textStyle: {
  31. color: '#fff'
  32. }
  33. },
  34. series: [
  35. {
  36. type: 'flowGL',
  37. coordinateSystem: 'hwmap',
  38. data: data,
  39. supersampling: 4,
  40. particleType: 'line',
  41. particleDensity: 128,
  42. particleSpeed: 1,
  43. gridWidth: Math.floor(max),
  44. gridHeight: Math.floor(max),
  45. itemStyle: {
  46. opacity: 0.7
  47. }
  48. }
  49. ]
  50. };
  51. chart.setOption(option);
  52. })
  53. }
收起
自动换行
深色代码主题
复制
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <title>an example for echarts-extension-hwmap</title>
  9. <link rel="icon" href="data:;base64,=">
  10. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  11. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  12. <script type="text/javascript" src="echarts.min.js"></script>
  13. <script type="text/javascript" src="echarts-gl.js"></script>
  14. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  15. <script type="text/javascript" src="jquery.min.js"></script>
  16. <link rel="stylesheet" href="index.css">
  17. </head>
  18. <body>
  19. <div id="echarts-map"></div>
  20. <script src="index.js" type="text/javascript"> </script>
  21. </body>
  22. </html>

Lines3D

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. window.initMap = function () {
  2. var myChart = echarts.init(document.getElementById("echarts-map"))
  3. $.getJSON("
    assets/json/buildingsgeo.json
    ", function(buildingsGeoJSON) {
  4. echarts.registerMap('buildings', buildingsGeoJSON)
  5. var regionsData = buildingsGeoJSON.features.map(function(feature) {
  6. return {
  7. name: feature.properties.name,
  8. value: Math.random(),
  9. height: Math.random() * 1000,
  10. label: feature.properties.name
  11. };
  12. })
  13. $.getJSON("“assets/json/taxiRoutes.json”", function(taxiRoutes) {
  14. var echartsOption = {
  15. visualMap: {
  16. show: true,
  17. seriesIndex: 1,
  18. min: 0,
  19. max: 1,
  20. inRange: {
  21. color: [
  22. '#313695',
  23. '#4575b4',
  24. '#74add1',
  25. '#abd9e9',
  26. '#e0f3f8',
  27. '#ffffbf',
  28. '#fee090',
  29. '#fdae61',
  30. '#f46d43',
  31. '#d73027',
  32. '#a50026'
  33. ]
  34. },
  35. calculable: true,
  36. textStyle: {
  37. color: '#fff'
  38. }
  39. },
  40. hwmap3D: {
  41. presetStyleId:'night',
  42. center: [13.5371, 22.801624],
  43. zoom: 12,
  44. language: 'en',
  45. pitch: 100,
  46. postEffect: {
  47. enable: true,
  48. SSAO: {
  49. enable: true,
  50. intensity: 1.3,
  51. radius: 5
  52. },
  53. screenSpaceReflection: {
  54. enable: false
  55. }
  56. },
  57. groundPlane: {
  58. show: true,
  59. color: '#333'
  60. },
  61. light: {
  62. main: {
  63. intensity: 6,
  64. shadow: true,
  65. shadowQuality: 'high',
  66. alpha: 30
  67. },
  68. ambient: {
  69. intensity: 0
  70. },
  71. ambientCubemap: {
  72. texture: 'assets/ambientCubemapTexture.hdr',
  73. exposure: 2,
  74. diffuseIntensity: 1,
  75. specularIntensity: 2
  76. }
  77. }
  78. },
  79. series: [{
  80. type: 'lines3D',
  81. coordinateSystem: 'hwmap3D',
  82. effect: {
  83. show: true,
  84. constantSpeed: 5,
  85. trailWidth: 2,
  86. trailLength: 0.4,
  87. trailOpacity: 1,
  88. spotIntensity: 10
  89. },
  90. blendMode: 'lighter',
  91. polyline: true,
  92. lineStyle: {
  93. width: 0.1,
  94. color: 'yellow',
  95. opacity: 0.0
  96. },
  97. data: taxiRoutes
  98. }, {
  99. type: 'map3D',
  100. map: 'buildings',
  101. data: regionsData,
  102. shading: 'realistic',
  103. instancing: true,
  104. coordinateSystem: 'hwmap3D',
  105. silent: true,
  106. realisticMaterial: {
  107. metalness: 1,
  108. roughness: 0.2,
  109. },
  110. groundPlane: {
  111. show: true,
  112. color: '#333'
  113. },
  114. boxWidth: 200,
  115. boxHeight: 1,
  116. viewControl: {
  117. minBeta: -360,
  118. maxBeta: 360,
  119. autoRotate: true
  120. },
  121. }]
  122. }
  123. myChart.setOption(echartsOption)
  124. })
  125. })
  126. }
收起
自动换行
深色代码主题
复制
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="cleartype" content="on">
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <title>an example for echarts-extension-hwmap</title>
  11. <link rel="icon" href="data:;base64,=">
  12. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  13. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  14. <script type="text/javascript" src="echarts.min.js"></script>
  15. <script type="text/javascript" src="echarts-gl.js"></script>
  16. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  17. <script type="text/javascript" src="jquery.min.js"></script>
  18. <link rel="stylesheet" href="index.css">
  19. </head>
  20. <body>
  21. <div id="echarts-map"></div>
  22. <script src="index.js" type="text/javascript"> </script>
  23. </body>
  24. </html>

Lines

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. var chart = echarts.init(document.getElementById('echarts-map'));
  2. window.initMap = function(){
  3. $.getJSON('
    assets/json/lines.json
    ', function (data) {
  4. const options={
  5. hwmap: {
  6. center: [ 2.352222, 48.856613],
  7. zoom: 14,
  8. resizeEnable: true,
  9. presetStyleId: 'night',
  10. renderOnMoving: false,
  11. language: 'en',
  12. echartsLayerInteractive: true,
  13. largeMode: false
  14. },
  15. series: [{
  16. type: 'lines',
  17. coordinateSystem: 'hwmap',
  18. polyline: true,
  19. data: data,
  20. silent: true,
  21. lineStyle: {
  22. opacity: 0.3,
  23. width: 1
  24. },
  25. progressiveThreshold: 500,
  26. progressive: 200
  27. }, {
  28. type: 'lines',
  29. coordinateSystem: 'hwmap',
  30. polyline: true,
  31. data: data,
  32. lineStyle: {
  33. width: 0
  34. },
  35. effect: {
  36. constantSpeed: 20,
  37. show: true,
  38. trailLength: 0.1,
  39. symbolSize: 1.5
  40. },
  41. zlevel: 1
  42. }]
  43. }
  44. chart.setOption(options)
  45. });
  46. }
收起
自动换行
深色代码主题
复制
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="cleartype" content="on">
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <title>an example for echarts-extension-hwmap</title>
  11. <link rel="icon" href="data:;base64,=">
  12. <script src=""></script>
  13. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  14. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  15. <script type="text/javascript" src="echarts.min.js"></script>
  16. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  17. <script type="text/javascript" src="jquery.min.js"></script>
  18. <link rel="stylesheet" href="index.css">
  19. </head>
  20. <body>
  21. <div id="echarts-map"></div>
  22. <script src="index.js" type="text/javascript"> </script>
  23. </body>
  24. </html>

Polygons3D

示例代码如下:
JavaScript
HTML
收起
自动换行
深色代码主题
复制
  1. var chart = echarts.init(document.getElementById('echarts-map'));
  2. window.initMap=function(){
  3. $.getJSON('
    assets/json/polygons3D.json
    ', function (data) {
  4. console.log(data)
  5. chart.setOption({
  6. visualMap: {
  7. left: 'right',
  8. min: 0,
  9. max: 1,
  10. inRange: {
  11. color: [
  12. '#313695',
  13. '#4575b4',
  14. '#74add1',
  15. '#abd9e9',
  16. '#e0f3f8',
  17. '#ffffbf',
  18. '#fee090',
  19. '#fdae61',
  20. '#f46d43',
  21. '#d73027',
  22. '#a50026'
  23. ]
  24. },
  25. textStyle: {
  26. color: '#fff'
  27. }
  28. },
  29. hwmap3D: {
  30. presetStyle:'night',
  31. language:'en',
  32. center: {lat: 48.856613, lng: 2.352222},
  33. zoom: 12,
  34. pitch: 50,
  35. postEffect: {
  36. enable: true,
  37. screenSpaceAmbientOcclusion: {
  38. enable: true,
  39. intensity: 1.2,
  40. radius: 5
  41. },
  42. screenSpaceReflection: {
  43. enable: true
  44. }
  45. },
  46. temporalSuperSampling: {
  47. enable: true
  48. },
  49. light: {
  50. main: {
  51. intensity: 1,
  52. shadow: false,
  53. shadowQuality: 'high'
  54. },
  55. ambient: {
  56. intensity: 0
  57. },
  58. ambientCubemap: {
  59. texture: 'assets/pisa.hdr',
  60. exposure: 1,
  61. diffuseIntensity: 0.5,
  62. specularIntensity: 2
  63. }
  64. }
  65. },
  66. series: [{
  67. type: 'polygons3D',
  68. coordinateSystem: 'hwmap3D',
  69. data,
  70. shading: 'realistic',
  71. silent: true,
  72. multiPolygon: true,
  73. progressiveThreshold: 500,
  74. progressive: 500,
  75. realisticMaterial: {
  76. metalness: 0,
  77. roughness: 1,
  78. }
  79. }]
  80. });
  81. window.addEventListener('resize', function () {
  82. chart.resize();
  83. });
  84. });
  85. }
收起
自动换行
深色代码主题
复制
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <base href="../../">
  5. <meta charset="utf-8">
  6. <title>Map3D - ECHARTS-GL</title>
  7. <link rel="icon" href="data:;base64,=">
  8. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js?callback=initMap&key=
    API KEY
    "></script>
  11. <script src="https://polyfill.io/v3/polyfill.min.js?features=default"></script>
  12. <script type="text/javascript" src="echarts.min.js"></script>
  13. <script type="text/javascript" src="echarts-gl.js"></script>
  14. <script src="https://mapapi.cloud.huawei.com/mapjs/v1/api/js/echarts-extension-hwmap.min.js"></script>
  15. <script type="text/javascript" src="dat.gui.js"></script>
  16. <script type="text/javascript" src="jquery.min.js"></script>
  17. <link rel="stylesheet" href="index.css">
  18. </head>
  19. <body>
  20. <div id="echarts-map"></div>
  21. <script src="index.js" type="text/javascript"> </script>
  22. </body>
  23. </html>

在 指南 中进行搜索
请输入您想要搜索的关键词