03_themeGraph.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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_themeGraph"></title>
  9. <script type="text/javascript" src="../js/include-web.js"></script>
  10. </head>
  11. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  12. <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
  13. <script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
  14. <script type="text/javascript">
  15. var host = window.isLocal ? window.server : "https://iserver.supermap.io";
  16. var map, themeService, themeGraph, themeParameters, themeLayer,
  17. mapUrl = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图",
  18. url = host + "/iserver/services/map-jingjin/rest/maps/京津地区人口分布图_专题图";
  19. map = L.map('map', {
  20. crs: L.CRS.EPSG4326,
  21. center: [40, 117],
  22. maxZoom: 18,
  23. zoom: 6
  24. });
  25. L.supermap.tiledMapLayer(mapUrl, {noWrap: true}).addTo(map);
  26. createTheme();
  27. function createTheme() {
  28. themeService = L.supermap.themeService(url);
  29. themeGraph = new SuperMap.ThemeGraph({
  30. items: [
  31. new SuperMap.ThemeGraphItem({
  32. caption: "1992-1995人口增长率",
  33. graphExpression: "Pop_Rate95",
  34. uniformStyle: new SuperMap.ServerStyle({
  35. fillForeColor: new SuperMap.ServerColor(92, 73, 234),
  36. lineWidth: 0.1
  37. })
  38. }),
  39. new SuperMap.ThemeGraphItem({
  40. caption: "1995-1999人口增长率",
  41. graphExpression: "Pop_Rate99",
  42. uniformStyle: new SuperMap.ServerStyle({
  43. fillForeColor: new SuperMap.ServerColor(211, 111, 240),
  44. lineWidth: 0.1
  45. })
  46. })
  47. ],
  48. barWidth: 0.03,
  49. graduatedMode: SuperMap.GraduatedMode.SQUAREROOT,
  50. graphAxes: new SuperMap.ThemeGraphAxes({
  51. axesDisplayed: true
  52. }),
  53. graphSize: new SuperMap.ThemeGraphSize({
  54. maxGraphSize: 1,
  55. minGraphSize: 0.35
  56. }),
  57. graphText: new SuperMap.ThemeGraphText({
  58. graphTextDisplayed: true,
  59. graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
  60. graphTextStyle: new SuperMap.ServerTextStyle({
  61. sizeFixed: true,
  62. fontHeight: 9,
  63. fontWidth: 5
  64. })
  65. }),
  66. graphType: SuperMap.ThemeGraphType.BAR3D
  67. });
  68. themeParameters = new SuperMap.ThemeParameters({
  69. themes: [themeGraph],
  70. dataSourceNames: ["Jingjin"],
  71. datasetNames: ["BaseMap_R"]
  72. });
  73. themeService.getThemeInfo(themeParameters, function (serviceResult) {
  74. var result = serviceResult.result;
  75. if (result && result.newResourceID) {
  76. themeLayer = L.supermap.tiledMapLayer(url, {
  77. noWrap: true,
  78. cacheEnabled: false,
  79. transparent: true,
  80. layersID: result.newResourceID
  81. }).addTo(map);
  82. }
  83. });
  84. }
  85. </script>
  86. </body>
  87. </html>