-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
275 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<link rel="stylesheet" href="https://gw.alipayobjects.com/os/rmsportal/PqLCOJpqoOUfuPRacUzE.css" /> | ||
<title>气泡图</title> | ||
<style> ::-webkit-scrollbar{display:none;}html,body{overflow:hidden;margin:0;} | ||
#map { position:absolute; top:0; bottom:0; width:100%; } | ||
</style> | ||
</head> | ||
<body> | ||
<div id="map"></div> | ||
<script>/*Fixing iframe window.innerHeight 0 issue in Safari*/ document.body.clientHeight; </script> | ||
<script src="https://webapi.amap.com/maps?v=1.4.8&key=15cd8a57710d40c9b7c0e3cc120f1200&plugin=Map3D"></script> | ||
<script src="https://gw.alipayobjects.com/os/antv/assets/lib/jquery-3.2.1.min.js"></script> | ||
<script src="https://gw.alipayobjects.com/os/antv/pkg/_antv.g2-3.5.1/dist/g2.min.js"></script> | ||
<script src="../build/l7.js"></script> | ||
<style> | ||
#map { position:absolute; top:0; bottom:0; width:100%; } | ||
</style> | ||
<script> | ||
G2.Global.renderer = 'svg' | ||
var scene = new L7.Scene({ | ||
id: 'map', | ||
mapStyle: 'light', // 样式URL | ||
center: [120.19382669582967, 30.258134], | ||
pitch: 0, | ||
minZoom:5, | ||
maxZoom:15, | ||
zoom: 3 | ||
}); | ||
window.scene = scene; | ||
scene.on('loaded', function() { | ||
$.getJSON('https://gw.alipayobjects.com/os/basement_prod/0b96cca4-7e83-449a-93d0-2a77053e74ab.json', function(data) { | ||
console.log(data); | ||
data.nodes.forEach(item=>{ | ||
const el = document.createElement('div'); | ||
const total = item.gdp.Agriculture + item.gdp.Industry + item.gdp.Service; | ||
|
||
const size =Math.max(Math.min(parseInt(total / 20000), 150),40) | ||
console.log(item.name, size); | ||
var data = [{ | ||
item: 'Agriculture', | ||
count: item.gdp.Agriculture, | ||
percent: item.gdp.Agriculture / total | ||
}, { | ||
item: 'Industry', | ||
count: item.gdp.Industry, | ||
percent: item.gdp.Industry / total | ||
}, { | ||
item: 'Service', | ||
count: item.gdp.Service, | ||
percent: item.gdp.Service / total | ||
}]; | ||
var chart = new G2.Chart({ | ||
container: el, | ||
width:size, | ||
height:size, | ||
render:'svg', | ||
padding:5, | ||
}); | ||
chart.source(data, { | ||
percent: { | ||
formatter: function formatter(val) { | ||
val = val * 100 + '%'; | ||
return val; | ||
} | ||
} | ||
}); | ||
chart.coord('theta', { | ||
radius: 1.0 | ||
}); | ||
chart.legend(false); | ||
chart.tooltip(false); | ||
chart.intervalStack().position('percent').color('item').style({ | ||
lineWidth: 1, | ||
stroke: '#fff' | ||
}); | ||
chart.render(); | ||
const popup = new L7.Popup({anchor:'left'}).setText(item.name); | ||
const marker = new L7.Marker({color:'blue', element:el}) | ||
.setLnglat( item.coordinates) | ||
.setPopup(popup) | ||
.addTo(scene); | ||
|
||
|
||
}) | ||
|
||
}) | ||
}); | ||
|
||
|
||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.