-
Notifications
You must be signed in to change notification settings - Fork 1
/
Test.html
62 lines (57 loc) · 1.1 KB
/
Test.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
56
57
58
59
60
61
62
<html>
<head>
</head>
<script src="https://d3js.org/d3.v5.js"></script>
<script src="../dist/d3-tube-map.js"></script>
<script>
let station ={
"stations": {
"StationA": {
"label": "Station A"
},
"StationB": {
"label": "Station B"
}
},
"lines": [
{
"name": "LineA",
"color": "#FF0000",
"shiftCoords": [0, 0],
"nodes": [
{
"coords": [23, -4],
"name": "StationA",
"labelPos": "N"
},
{
"coords": [30, -4]
},
{
"coords": [31, -3],
"dir": "E"
},
{
"coords": [31, 2],
"name": "StationB",
"labelPos": "E"
}
]
}
]
}
var container = d3.select('#tube-map');
var width = 1600;
var height = 1024;
var map = d3.tubeMap(station)
.width(width)
.height(height)
.margin({
top: height / 50,
right: width / 7,
bottom: height / 10,
left: width / 7,
});
d3.json("./pubs.json").then(function(data) {
container.datum(data).call(map);
});