vis-network
Example
unpkg.comで公開されているesmファイルは使えない
module解決方法がnode準拠
esm.shからも使えない
vis-util/esnext.d.tsをesm.shで解決できないみたい?
結局の所、DenoからはJSとして使うしかなさそう
型を使えないのは結構痛いな
code:run.sh
code:index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"></meta>
<title>My test page</title>
<script type="module" src="./index.js"></script>
<style>
height: 100%;
}
</style>
</head>
<body>
<div id="mynetwork"></div>
</body>
</html>
code:index.js
// CSS will be automatically injected into the page.
// create an array with nodes
const nodes = new DataSet([
{ id: 1, label: "Node 1" },
{ id: 2, label: "Node 2" },
{ id: 3, label: "Node 3" },
{ id: 4, label: "Node 4" },
{ id: 5, label: "Node 5" }
]);
// create an array with edges
const edges = new DataSet([
{ from: 1, to: 3 },
{ from: 1, to: 2 },
{ from: 2, to: 4 },
{ from: 2, to: 5 },
{ from: 3, to: 3 }
]);
// create a network
const container = document.getElementById("mynetwork");
const data = {
nodes: nodes,
edges: edges
};
const options = {};
const network = new Network(container, data, options);
大量のNodeを扱う時
References
使い方がわかりやすい