Skip to content

Commit

Permalink
feat: 添加地图demo
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Nov 12, 2020
1 parent 1c613cc commit e5b764a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
30 changes: 30 additions & 0 deletions examples/other/map/demo/map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import F2 from '@antv/f2';
import '@antv/data-set';
const DataSet = window.DataSet;

fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/china-provinces.geo.json')
.then(res => res.json())
.then(GeoJSON => {
const geoDv = new DataSet.View().source(GeoJSON, {
type: 'GeoJSON'
});

const chart = new F2.Chart({
id: 'container',
padding: 0,
pixelRatio: window.devicePixelRatio
});
chart.legend(false);
chart.axis(false);
chart.tooltip(false);

chart.source(geoDv.rows);
chart.polygon()
.position('longitude*latitude')
.color('grey')
.style({
// opacity: 0.3
});

chart.render();
});
13 changes: 13 additions & 0 deletions examples/other/map/demo/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"title": {
"zh": "中文分类",
"en": "Category"
},
"demos": [
{
"filename": "map.js",
"title": "地图",
"screenshot": "https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/51d3f37a-d0ab-47d8-9037-d8fb7791f497.png"
}
]
}
5 changes: 5 additions & 0 deletions examples/other/map/index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Map
order: 1
---

5 changes: 5 additions & 0 deletions examples/other/map/index.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: 地图
order: 1
---

0 comments on commit e5b764a

Please sign in to comment.