-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.html
55 lines (44 loc) · 1.41 KB
/
render.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
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html, body, #zebox { width: 100%; height: 100%; margin: 0; }
</style>
<body>
<div id="zebox"></div>
<div id="download" style="position: absolute; top: 0"></div>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/0.11.0/fetch.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser-polyfill.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.js"></script>
<script>module={}; exports={}</script>
<script type="text/babel" src="chart.js"></script>
<script>module['chart.js'] = exports</script>
<script type="text/babel">
async function download(url) {
let res = await fetch(url)
return res.text()
}
function renderJudet(judet) {
let zebox = d3.select('#zebox')
zebox.html('')
var svg = zebox.append('svg')
.attr('xmlns', 'http://www.w3.org/2000/svg')
.attr('width', `560mm`)
.attr('height', `345mm`)
.attr('viewBox', `0 0 56000 34500`)
.append('g')
.attr('transform', 'scale(.004)')
module['chart.js'].default(d3, svg, judet)
}
d3.tsv('sector3.tsv', function(error, data) {
let rows = {}
for(let row of data) {
rows[row.an] = row
}
renderJudet(rows)
})
async function main() {
let master = await download('master.svg')
}
//main().catch((e) => { console.error(e.stack || e) })
</script>