Skip to content

Commit 9c6bcfd

28-
+ "| <a href='http://echarts.baidu.com' target='_blank'>© 2017 "+resources.title_3baidu+" ECharts</a>";
27+
"| Image <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span>" + " with <span>© <a href='http://iclient.supermap.io' target='_blank'>SuperMap iClient </a></span>"
28+
+ "| <a href='http://echarts.baidu.com' target='_blank'>© 2017 " + resources.title_3baidu + " ECharts</a>";
2929
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
3030
var tileURL = host + "/iserver/services/map-china400/rest/maps/ChinaDark/zxyTileImage.png?z={z}&x={x}&y={y}";
3131

@@ -55,55 +55,52 @@
5555
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
5656
var uploadedDataURL = "../data/changchunBus.json";
5757

58-
map.on('load', function () {
59-
$.get(uploadedDataURL, function (data) {
58+
$.get(uploadedDataURL, function (data) {
59+
option = {
60+
GLMap: {
61+
roam: true
62+
},
63+
coordinateSystem: 'GLMap',
64+
geo: {
65+
map: 'GLMap',
66+
},
6067

61-
option = {
62-
GLMap: {
63-
roam: true
68+
series: [{
69+
type: 'lines',
70+
polyline: true,
71+
data: data,
72+
silent: true,
73+
lineStyle: {
74+
normal: {
75+
opacity: 0.2,
76+
width: 1
77+
}
6478
},
79+
progressiveThreshold: 500,
80+
progressive: 100
81+
}, {
82+
83+
type: 'lines',
6584
coordinateSystem: 'GLMap',
66-
geo: {
67-
map: 'GLMap',
85+
polyline: true,
86+
data: data,
87+
lineStyle: {
88+
normal: {
89+
width: 0.2
90+
}
6891
},
92+
effect: {
93+
constantSpeed: 40,
94+
show: true,
95+
trailLength: 0.02,
96+
symbolSize: 2
97+
},
98+
zlevel: 1
99+
}]
100+
};
101+
var echartslayer = new EchartsLayer(map);
102+
echartslayer.chart.setOption(option);
69103

70-
series: [{
71-
type: 'lines',
72-
polyline: true,
73-
data: data,
74-
silent: true,
75-
lineStyle: {
76-
normal: {
77-
opacity: 0.2,
78-
width: 1
79-
}
80-
},
81-
progressiveThreshold: 500,
82-
progressive: 100
83-
}, {
84-
85-
type: 'lines',
86-
coordinateSystem: 'GLMap',
87-
polyline: true,
88-
data: data,
89-
lineStyle: {
90-
normal: {
91-
width: 0.2
92-
}
93-
},
94-
effect: {
95-
constantSpeed: 40,
96-
show: true,
97-
trailLength: 0.02,
98-
symbolSize: 2
99-
},
100-
zlevel: 1
101-
}]
102-
};
103-
var echartslayer = new EchartsLayer(map);
104-
echartslayer.chart.setOption(option);
105-
106-
});
107104
});
108105
</script>
109106
</body>
28-
+ "| <a href='http://echarts.baidu.com' target='_blank'>© 2017 "+resources.title_3baidu+" ECharts</a>";
27+
"| Image <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span>" + " with <span>© <a href='http://iclient.supermap.io' target='_blank'>SuperMap iClient </a></span>"
28+
+ "| <a href='http://echarts.baidu.com' target='_blank'>© 2017 " + resources.title_3baidu + " ECharts</a>";
2929
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
3030
var tileURL = host + '/iserver/services/map-world/rest/maps/世界地图_Gray/zxyTileImage.png?prjCoordSys={"epsgCode":3857}&z={z}&x={x}&y={y}';
3131
var url = host + "/iserver/services/map-china400/rest/maps/China_4326";
@@ -59,59 +59,56 @@
5959
map.addImage('positionPoint', image);
6060
});
6161

62-
map.on('load', function () {
63-
64-
option = {
65-
legend: {
66-
data: [resources.text_rainfall, resources.text_runoff],
67-
align: 'left'
68-
},
69-
toolbox: {
70-
feature: {
71-
magicType: {
72-
type: ['stack', 'tiled']
73-
},
74-
saveAsImage: {
75-
pixelRatio: 2
76-
}
77-
}
78-
},
79-
tooltip: {},
80-
xAxis: {
81-
data: [resources.text_monday, resources.text_tuesday, resources.text_wednesday, resources.text_thursday, resources.text_friday, resources.text_saturday, resources.text_sunday],
82-
silent: false,
83-
splitLine: {
84-
show: false
85-
}
86-
},
87-
yAxis: {},
88-
series: [{
89-
name: 'bar',
90-
type: 'bar',
91-
animationDelay: function (idx) {
92-
return idx * 10;
93-
}
94-
}, {
95-
name: 'bar2',
96-
type: 'bar',
97-
animationDelay: function (idx) {
98-
return idx * 10 + 100;
62+
option = {
63+
legend: {
64+
data: [resources.text_rainfall, resources.text_runoff],
65+
align: 'left'
66+
},
67+
toolbox: {
68+
feature: {
69+
magicType: {
70+
type: ['stack', 'tiled']
71+
},
72+
saveAsImage: {
73+
pixelRatio: 2
9974
}
100-
}],
101-
animationEasing: 'elasticOut',
102-
animationDelayUpdate: function (idx) {
103-
return idx * 5;
10475
}
105-
};
76+
},
77+
tooltip: {},
78+
xAxis: {
79+
data: [resources.text_monday, resources.text_tuesday, resources.text_wednesday, resources.text_thursday, resources.text_friday, resources.text_saturday, resources.text_sunday],
80+
silent: false,
81+
splitLine: {
82+
show: false
83+
}
84+
},
85+
yAxis: {},
86+
series: [{
87+
name: 'bar',
88+
type: 'bar',
89+
animationDelay: function (idx) {
90+
return idx * 10;
91+
}
92+
}, {
93+
name: 'bar2',
94+
type: 'bar',
95+
animationDelay: function (idx) {
96+
return idx * 10 + 100;
97+
}
98+
}],
99+
animationEasing: 'elasticOut',
100+
animationDelayUpdate: function (idx) {
101+
return idx * 5;
102+
}
103+
};
106104

107-
div = document.createElement('div');
108-
chart = echarts.init(div, '', {
109-
width: 500,
110-
height: 300
111-
});
112-
chart.setOption(option);
113-
query();
105+
div = document.createElement('div');
106+
chart = echarts.init(div, '', {
107+
width: 500,
108+
height: 300
114109
});
110+
chart.setOption(option);
111+
query();
115112

116113
function query() {
117114
var sqlParam = new SuperMap.QueryBySQLParameters({
@@ -156,7 +153,7 @@
156153
data2.push(data * (Math.random() + 1.5));
157154
}
158155

159-
chart.setOption({
156+
chart.setOption({
160157
title: {
161158
text: e.features[0].properties.NAME,
162159
subtext: resources.text_fictitiouData

examples/mapboxgl/echarts_cellMap.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@
105105
});
106106
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
107107

108-
map.on("load", function () {
109-
echartsLayer = new EchartsLayer(map);
110-
echartsLayer.chart.setOption(option);
111-
});
108+
echartsLayer = new EchartsLayer(map);
109+
echartsLayer.chart.setOption(option);
112110

113111
//自定义渲染:
114112
function renderItem(params, api) {
@@ -142,9 +140,9 @@
142140
var key = lngIndex + '-' + latIndex;
143141

144142
return coords[key] || (coords[key] = api.coord([
145-
+(latExtent[0] + lngIndex * cellSizeCoord[0]).toFixed(6),
146-
+(lngExtent[0] + latIndex * cellSizeCoord[1]).toFixed(6)
147-
]));
143+
+(latExtent[0] + lngIndex * cellSizeCoord[0]).toFixed(6),
144+
+(lngExtent[0] + latIndex * cellSizeCoord[1]).toFixed(6)
145+
]));
148146
}
149147

150148

0 commit comments

Comments
 (0)