123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_themeGraph"></title>
- <script type="text/javascript" src="../js/include-web.js"></script>
- <script type="text/javascript" src="../../dist/ol/include-ol.js"></script>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%; position: absolute;top: 0;">
- <div id="map" style="width: 100%;height:100%"></div>
- <script type="text/javascript">
- var map, themeLayer, options,
- host = (window.isLocal ? window.server : "https://iserver.supermap.io"),
- mapUrl = host + "/iserver/services/map-jingjin/rest/maps/京津地区地图",
- url = host + "/iserver/services/map-jingjin/rest/maps/京津地区人口分布图_专题图";
- var mapService = new ol.supermap.MapService(url);
- mapService.getMapInfo(function (serviceResult) {
- var mapJSONObj = serviceResult.result;
- map = new ol.Map({
- target: 'map',
- controls: ol.control.defaults({attributionOptions: {collapsed: false}})
- .extend([new ol.supermap.control.Logo()]),
- view: new ol.View({
- center: [117, 40],
- zoom: 7,
- projection: "EPSG:4326",
- multiWorld: true
- })
- });
- options = ol.source.TileSuperMapRest.optionsFromMapJSON(mapUrl, mapJSONObj);
- var layer = new ol.layer.Tile({
- source: new ol.source.TileSuperMapRest(options)
- });
- map.addLayer(layer)
- createTheme();
- });
- function createTheme() {
- var themeGraph = new SuperMap.ThemeGraph({
- items: [
- new SuperMap.ThemeGraphItem({
- caption: "1992-1995人口增长率",
- graphExpression: "Pop_Rate95",
- uniformStyle: new SuperMap.ServerStyle({
- fillForeColor: new SuperMap.ServerColor(92, 73, 234),
- lineWidth: 0.1
- })
- }),
- new SuperMap.ThemeGraphItem({
- caption: "1995-1999人口增长率",
- graphExpression: "Pop_Rate99",
- uniformStyle: new SuperMap.ServerStyle({
- fillForeColor: new SuperMap.ServerColor(211, 111, 240),
- lineWidth: 0.1
- })
- })
- ],
- barWidth: 0.03,
- graduatedMode: SuperMap.GraduatedMode.SQUAREROOT,
- graphAxes: new SuperMap.ThemeGraphAxes({
- axesDisplayed: true
- }),
- graphSize: new SuperMap.ThemeGraphSize({
- maxGraphSize: 1,
- minGraphSize: 0.35
- }),
- graphText: new SuperMap.ThemeGraphText({
- graphTextDisplayed: true,
- graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
- graphTextStyle: new SuperMap.ServerTextStyle({
- sizeFixed: true,
- fontHeight: 9,
- fontWidth: 5
- })
- }),
- graphType: SuperMap.ThemeGraphType.BAR3D
- });
- var themeParameters = new SuperMap.ThemeParameters({
- themes: [themeGraph],
- dataSourceNames: ["Jingjin"],
- datasetNames: ["BaseMap_R"]
- });
- var extent = [114.59, 37.76, 119.51, 42.31];
- new ol.supermap.ThemeService(url).getThemeInfo(themeParameters, function (serviceResult) {
- var result = serviceResult.result;
- if (result && result.newResourceID) {
- themeLayer = new ol.layer.Tile({
- source: new ol.source.TileSuperMapRest({
- url: url,
- noWrap: true,
- cacheEnabled: false,
- tileGrid: new ol.tilegrid.TileGrid({
- extent: extent,
- resolutions: options.tileGrid.getResolutions()
- }),
- layersID: result.newResourceID,
- transparent: true
- })
- });
- map.addLayer(themeLayer);
- }
- });
- }
- </script>
- </body>
- </html>
|