antv-l7/demos/01_point_circle.html

106 lines
3.6 KiB
HTML
Raw Normal View History

2018-10-23 19:32:42 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="geometry" content="diagram">
<link rel="stylesheet" href="./assets/common.css">
2018-11-06 11:27:16 +08:00
<link rel="stylesheet" href="./assets/info.css">
2018-10-23 19:32:42 +08:00
<title>point_circle</title>
<style>
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id="map"></div>
2018-11-06 11:27:16 +08:00
<div class='info-panel top-right'>
<h4>杭州市微博签到数据</h4>
<p>
<label>min</label><input name="minaqi" type="range" step="1" min="0" max="30000" value=500> <label>500</label>
</p>
<p>
<label>max</label><input name="maxaqi" type="range" step="1" min="0" max="30000" value=30000><label>30000</label>
</p>
<p><label>color</label><select>
<option value ="blue">blue</option>
<option value ="red">red</option>
<option value="orange">orange</option>
<option value="green">green</option>
<option value="yellow">yellow</option>
<option value="purple">purple</option>
</select> </p>
<p><label>shape</label><select>
<option value ="circle">circle</option>
<option value ="triangle">triangle</option>
<option value="hexagon">hexagon</option>
<option value="square">square</option>
</select> </p>
<div>
2018-10-23 19:32:42 +08:00
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="./assets/dat.gui.min.js"></script>
<script src="../build/L7.js"></script>
<script>
2018-11-06 11:27:16 +08:00
const colorObj ={
blue: ["#E8FCFF", "#CFF6FF", "#98E3FA", "#65CEF7", "#3CB4F0", "#2894E0", "#1A76C7", "#105CB3", "#0D408C", "#002466"].reverse(),
red: ["#FFF4F2", "#FFDFDB", "#FAADAA", "#F77472", "#F04850", "#D63147", "#BD223E", "#A81642", "#820C37", "#5C0023"].reverse(),
orange:["#FFF7EB", "#FFECD4", "#FAD09D", "#F7B16A", "#F08D41", "#DB6C2C", "#C2491D", "#AD2B11", "#871D0C", "#610800"].reverse(),
green:["#FAFFF0", "#EBF7D2", "#C8E695", "#A5D660", "#7DC238", "#59A616", "#3F8C0B", "#237804", "#125200", "#082B00"].reverse(),
yellow:["#FFFFE8", "#FFFECC", "#FAF896", "#F7E463", "#F0CE3A", "#DBB125", "#C29117", "#AD7410", "#87500C", "#613000"].reverse(),
purple:["#FCF2FF", "#F5DEFF", "#DDB3F2", "#BE7BE3", "#9B4ECF", "#7737B3", "#5B2899", "#411C85", "#270F5E", "#100338"].reverse()
}
2018-10-23 19:32:42 +08:00
const scene = new L7.Scene({
id: 'map',
2018-10-30 11:22:18 +08:00
mapStyle: 'light', // 样式URL
2018-10-23 19:32:42 +08:00
center: [ 120.19382669582967, 30.258134 ],
pitch: 0,
2018-11-06 11:27:16 +08:00
zoom: 11.6
2018-10-23 19:32:42 +08:00
});
window.scene = scene;
2018-11-03 16:39:22 +08:00
scene.on('loaded', () => {
2018-10-23 19:32:42 +08:00
$.get('https://gw.alipayobjects.com/os/rmsportal/epnZEheZeDgsiSjSPcCv.json', data => {
2018-11-03 16:39:22 +08:00
const circleLayer = scene.PointLayer({
2018-10-23 19:32:42 +08:00
zIndex: 2
})
.source(data)
.shape('2d:circle')
2018-11-06 11:27:16 +08:00
.size('value', [ 1000, 5000]) // default 1
.active({fill:'blue'})
.filter('value', field_8 => {
2018-10-23 19:32:42 +08:00
return field_8 * 1 > 500;
2018-11-06 11:27:16 +08:00
})
.color('type', colorObj.blue.reverse())
2018-10-23 19:32:42 +08:00
.style({
stroke: 'rgb(255,255,255)',
strokeWidth: 1,
opacity: 0.9
})
.render();
2018-11-06 11:27:16 +08:00
$('.info-panel input').change(function(){
$(this).next().text($(this).val());
const min = $('.info-panel input').val();
const max = $($('.info-panel input')[1]).val();
circleLayer.filter('value',(value)=>{
return (value>=min && value<=max)
}).render();
})
$('.info-panel select').change(function(){
const color = $(this).val();
console.time('color');
circleLayer.color('type',colorObj[color]).render();
console.timeEnd('color')
})
2018-11-03 16:39:22 +08:00
2018-10-23 19:32:42 +08:00
});
2018-11-06 11:27:16 +08:00
2018-10-23 19:32:42 +08:00
});
</script>
</body>
</html>