-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
radial.html
40 lines (39 loc) · 1.07 KB
/
radial.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
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/chart.js@3.8.0/dist/chart.js"></script>
<script src="../build/index.umd.js"></script>
</head>
<body>
<div style="width: 50vw; height: 50vw; position: absolute">
<canvas id="canvas" style="width: 50vw; height: 50vw; position: absolute"></canvas>
</div>
<script>
fetch('./tree.json')
.then((r) => r.json())
.then((nodes) => {
const chart = new Chart(document.getElementById('canvas').getContext('2d'), {
type: 'dendrogram',
data: {
labels: nodes.map((d) => d.name),
datasets: [
{
tree: {
orientation: 'radial',
},
pointBackgroundColor: 'steelblue',
pointRadius: 5,
data: nodes,
},
],
},
options: {
legend: {
display: false,
},
},
});
});
</script>
</body>
</html>