123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <!--********************************************************************
- * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
- *********************************************************************-->
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title data-i18n="resources.title_GraphLine"></title>
- </head>
- <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
- <div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
- <script type="text/javascript" src="../js/include-web.js"></script>
- <script type="text/javascript" include="echarts" src="../../dist/leaflet/include-leaflet.js"></script>
- <script type="text/javascript">
- var host = window.isLocal ? window.server : "https://iserver.supermap.io";
- var map, resultLayer, url = host + "/iserver/services/map-world/rest/maps/世界地图_Gray";
- var url2 = host + "/iserver/services/map-china400/rest/maps/China";
- map = L.map('map', {
- crs: L.CRS.EPSG4326,
- center: [31.6, 105.2],
- maxZoom: 18,
- zoomControl: false,
- zoom: 5
- });
- L.supermap.tiledMapLayer(url, {zoomControl: false}).addTo(map);
- var option = {
- title: {
- subtext: resources.text_fictitiou
- },
- tooltip: {
- trigger: 'axis'
- },
- legend: {
- //data:["最高气温"]
- data:[resources.text_maxTemperature,resources.text_minTemperature]
- },
- toolbox: {
- show: true,
- feature: {
- dataZoom: {
- yAxisIndex: 'none'
- },
- magicType: {type: ['line', 'bar']},
- restore: {},
- saveAsImage: {}
- }
- },
- xAxis: {
- type: 'category',
- boundaryGap: false,
- data: [resources.text_monday,resources.text_tuesday,resources.text_wednesday,resources.text_thursday,resources.text_friday,resources.text_saturday,resources.text_sunday]
- },
- yAxis: {
- type: 'value',
- axisLabel: {
- formatter: '{value} °C'
- }
- },
- series: [
- {
- name: resources.text_maxTemperature,
- type: 'line',
- data: [11, 11, 15, 13, 12, 13, 10],
- markPoint: {
- data: [
- {type: 'max', name:resources.text_max},
- {type: 'min', name:resources.text_min}
- ]
- },
- markLine: {
- data: [
- {type: 'average', name:resources.text_averageValue},
- [{
- symbol: 'none',
- x: '90%',
- yAxis: 'max'
- }, {
- symbol: 'circle',
- label: {
- normal: {
- position: 'start',
- formatter:resources.text_max
- }
- },
- type: 'max',
- name: resources.text_maxHighDot
- }]
- ]
- }
- },
- {
- name:resources.text_minTemperature,
- type: 'line',
- data: [1, -2, 2, 5, 3, 2, 0],
- markPoint: {
- data: [
- {type: 'max', name:resources.text_max},
- {type: 'min', name:resources.text_min}
- ]
- },
- markLine: {
- data: [
- {type: 'average', name:resources.text_averageValue},
- [{
- symbol: 'none',
- x: '90%',
- yAxis: 'min'
- }, {
- symbol: 'circle',
- label: {
- normal: {
- position: 'start',
- formatter: resources.text_min
- }
- },
- type: 'min',
- name: resources.text_minLowDot
- }]
- ]
- }
- }
- ]
- };
- var div = L.DomUtil.create('div');
- var chart = echarts.init(div, '', {
- width: 600,
- height: 400
- });
- chart.setOption(option);
- query();
- function query() {
- clearLayer();
- var param = new SuperMap.QueryBySQLParameters({
- queryParams: [{
- name: "China_ProCenCity_pt@China",
- attributeFilter: "1 = 1"
- }, {
- name: "China_Capital_pt@China",
- attributeFilter: "1 = 1"
- }]
- });
- L.supermap
- .queryService(url2)
- .queryBySQL(param, function (serviceResult) {
- serviceResult.result.recordsets.map(function (record) {
- resultLayer = L.geoJSON(record.features, {
- coordsToLatLng: function (coords) {
- var latlng = L.CRS.EPSG3857.unproject(L.point(coords[0], coords[1]));
- latlng.alt = coords[2];
- return latlng;
- }
- }).bindPopup(function (layer) {
- var city = layer.feature.properties.NAME;
- chart.setOption({
- title: {
- text: city+resources.text_nextWeekTemperature,
- },
- series: [
- {
- name: resources.text_maxTemperature,
- data: [10 + Math.ceil(Math.random() * 10), 10 + Math.ceil(Math.random() * 10), 10 + Math.ceil(Math.random() * 10), 10 + Math.ceil(Math.random() * 10), 10 + Math.ceil(Math.random() * 10), 10 + Math.ceil(Math.random() * 10), 10 + Math.ceil(Math.random() * 10)],
- },
- {
- name:resources.text_minTemperature,
- data: [8 - Math.ceil(Math.random() * 10), 8 - Math.ceil(Math.random() * 10), 8 - Math.ceil(Math.random() * 10), 8 - Math.ceil(Math.random() * 10), 8 - Math.ceil(Math.random() * 10), 8 - Math.ceil(Math.random() * 10), 8 - Math.ceil(Math.random() * 10)],
- }
- ]
- });
- return chart.getDom();
- }, {maxWidth: 700}).addTo(map);
- })
- });
- }
- function clearLayer() {
- if (resultLayer) {
- resultLayer.removeFrom(map);
- }
- }
- </script>
- </body>
- </html>
|