This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.html
55 lines (54 loc) · 1.42 KB
/
default.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>
<html>
<head>
<script src="https://unpkg.com/chart.js@3.8.0/dist/chart.js"></script>
<script src="https://unpkg.com/chartjs-chart-graph@3.6.0/build/index.umd.js"></script>
<script src="../build/index.umd.js"></script>
</head>
<body>
<div style="width: 75%">
<canvas id="canvas"></canvas>
</div>
<script>
fetch('./data.json')
.then((r) => r.json())
.then((data) => {
new Chart(document.getElementById('canvas').getContext('2d'), {
type: 'dagre',
data: {
labels: data.nodes.map((d) => d.id),
datasets: [
{
dagre: {
graph: {
rankdir: 'BT',
},
},
pointBackgroundColor: 'steelblue',
pointRadius: 5,
data: data.nodes,
edges: data.links,
},
],
},
options: {
elements: {
point: {
radius: 10,
hoverRadius: 12,
},
line: {
borderColor: 'black',
},
},
plugins: {
legend: {
display: true,
},
},
},
});
});
</script>
</body>
</html>