-
Notifications
You must be signed in to change notification settings - Fork 1
/
heatmap.html
96 lines (96 loc) · 2.75 KB
/
heatmap.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>echarts extension azuremaps</title>
<link
href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.css"
rel="stylesheet"
/>
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/3/atlas.min.js"></script>
<!-- ECharts CDN -->
<script
type="text/javascript"
src="https://fastly.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"
></script>
<script type="text/javascript" src="../dist/echarts-extension-azure-map.min.js"></script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
html,
body,
#app,
#echarts-azuremap {
width: 100%;
height: 100%;
overflow: hidden;
}
</style>
</head>
<body onload="loadMap()">
<div id="app">
<div id="echarts-azuremap"></div>
</div>
</body>
<script>
const linesDataURI =
'https://fastly.jsdelivr.net/gh/apache/echarts-examples/public/data/asset/data/hangzhou-tracks.json';
function loadMap() {
fetch(linesDataURI, { method: 'GET' })
.then((response) => response.json())
.then((data) => {
const points = [].concat.apply(
[],
data.map(function (track) {
return track.map(function (seg) {
return seg.coord.concat([1]);
});
}),
);
// set the data for heatmap
const option = {
azuremap: {
view: 'Auto',
language: 'en-US',
center: [120.098776, 30.226665],
zoom: 10,
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: 'your subscriptionKey',
},
},
visualMap: {
show: true,
right: 20,
min: 0,
max: 5,
seriesIndex: 0,
calculable: true,
inRange: {
color: ['blue', 'blue', 'green', 'yellow', 'red'],
},
},
animation: false,
series: [
{
type: 'heatmap',
coordinateSystem: 'azuremap',
data: points,
pointSize: 5,
blurSize: 6,
},
],
};
const chart = echarts.init(document.getElementById('echarts-azuremap'));
chart.setOption(option);
})
.catch((e) => {
console.log('error: ' + e.toString());
});
}
</script>
</html>