fix: 修复l7-draw 版本

This commit is contained in:
thinkinggis 2020-11-08 17:13:10 +08:00
parent cd4d212da5
commit a26da1ea4b
4 changed files with 2467 additions and 2737 deletions

View File

@ -23,11 +23,6 @@
"filename": "fill.js",
"title": "连续填充图",
"screenshot": "https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*ouhFSJNcNvkAAAAAAAAAAABkARQnAQ"
},
{
"filename": "population.js",
"title": "世界地图 女性人口比例",
"screenshot": "https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*7c0eQYMfxwoAAAAAAAAAAABkARQnAQ"
}
]
}

View File

@ -1,68 +0,0 @@
import { Scene, PolygonLayer, LineLayer } from '@antv/l7';
import { Mapbox } from '@antv/l7-maps';
const scene = new Scene({
id: 'map',
map: new Mapbox({
pitch: 0,
style: 'light',
center: [ 3.438, 40.16797 ],
zoom: 0.51329
})
});
scene.on('loaded', () => {
Promise.all([
fetch(
'https://gw.alipayobjects.com/os/antvdemo/assets/data/world.geo.json'
).then(d => d.json()),
fetch(
'https://gw.alipayobjects.com/os/basement_prod/f3c467a4-9ae0-4f08-bb5f-11f9c869b2cb.json'
).then(d => d.json())
]).then(function onLoad([ world, population ]) {
const popobj = {};
population.forEach(element => {
popobj[element.Code] =
element['Population, female (% of total) (% of total)'];
});
// 数据绑定
world.features = world.features.map(fe => {
fe.properties.female = popobj[fe.id] * 1 || 0;
return fe;
});
const colors = [
'#0A3663',
'#1558AC',
'#3771D9',
'#4D89E5',
'#64A5D3',
'#72BED6',
'#83CED6',
'#A6E1E0',
'#B8EFE2',
'#D7F9F0'
];
const layer = new PolygonLayer({})
.source(world)
.scale('female', {
type: 'quantile'
})
.color('female', colors)
.shape('fill')
.active(true)
.style({
opacity: 0.9
});
const layer2 = new LineLayer({
zIndex: 2
})
.source(world)
.color('#fff')
.size(0.8)
.style({
opacity: 1
});
scene.addLayer(layer);
scene.addLayer(layer2);
});
});

View File

@ -7,10 +7,10 @@
},
"devDependencies": {
"@antv/g2": "^3.5.9",
"@antv/l7-draw": "^2.2.37",
"@antv/l7-react": "^2.2.37",
"@antv/l7-district": "^2.2.37",
"@antv/gatsby-theme-antv": "^0.10.71",
"@antv/l7-district": "2.2.42",
"@antv/l7-draw": "2.3.40",
"@antv/l7-react": "^2.2.37",
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/plugin-proposal-decorators": "^7.6.0",

5125
yarn.lock

File diff suppressed because it is too large Load Diff