-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
132 lines (108 loc) · 3.48 KB
/
index.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Story Map</title>
<script src="3rdparty/d3/d3.v5.min.js"></script>
<script src="3rdparty/d3/d3-selection-multi.v1.min.js"></script>
<script src="3rdparty/d3/d3-polygon.v1.min.js"></script>
<script src="3rdparty/d3/d3-textwrap.min.js"></script>
<script src="3rdparty/usm.io/usmio.min.js"></script>
<style type="text/css">
html,
body {
margin: 0;
padding: 0;
}
#usm {
/* position: absolute; */
/* width: 300px; */
width: 100%;
height: 400px;
/* height: 100%; */
margin-top: 20px;
overflow-y: scroll;
/* overflow: hidden; */
/* "overflow: hidden" is a fix for the little gap
at the bottom, that appears in combination with
"height: 100%" on the svg element.
*/
box-sizing: border-box;
font-size: 14px;
}
#usm svg {
width: 100%;
/* height: 100%; */
background: #eee;
}
#usm .card {
cursor: pointer;
}
#usm .card rect {
fill: #ee9 !important;
}
#usm .activity>.card rect {
fill: #9ae !important;
}
#usm .step>.card rect {
fill: #9d9 !important;
}
#usm .card.active rect {
stroke: #f00 !important;
fill: #fcc !important;
}
#details {
margin: 20px;
}
#details p {
line-height: 14px;
}
</style>
<script>
const apiEndpoint = "http://localhost:8080"
const margins = {
top: 40,
right: 20,
bottom: 40,
left: 20
}
document.addEventListener("DOMContentLoaded", function (event) {
var url = apiEndpoint + "/data"
d3.json(url)
.then((result) => {
console.log("#usm (width x height)", parseInt(d3.select("#usm").style("width")) + " x " + parseInt(d3.select("#usm").style("height")))
/**
* scaleToWidth and scaleToHeight are optional.
* If given,the svg is scaled to fit the box defined by
* the given hight and/or width.
* If not given, it's rendered to it's original size.
* Use "overflow: scroll" on the container!
*/
var dimensions = {
scaleToWidth: parseInt(d3.select("#usm").style("width")),
// scaleToHeight: parseInt(d3.select("#usm").style("height")),
marginTop: 40,
marginRight: 20,
marginBottom: 40,
marginLeft: 20
}
var myUsm = new usm.USM(result.data)
myUsm.render(
d3.select("#usm"), {
detailsContainer: d3.select("#details")
},
dimensions,
false
)
})
.catch((error) => {
console.error("Error:", error)
})
})
</script>
</head>
<body>
<div id="usm"></div>
<div id="details"></div>
</body>
</html>