3.2.0 • Published 10 months ago
@html-graph/html-graph v3.2.0
Graph visualization library that enables nodes customization using HTML
Instead of connecting nodes directly, this library utilizes the concept of ports, which provide greater flexibility in managing edges. A port is an entity on a node to which edges can be attached.
Visit the DOCUMENTATION for more details.
Getting started:
npm i @html-graph/html-graphimport { CanvasBuilder } from "@html-graph/html-graph";
function createNode({ name, x, y, frontPortId, backPortId }) {
const node = document.createElement("div");
const text = document.createElement("div");
const frontPort = document.createElement("div");
const backPort = document.createElement("div");
node.classList.add("node");
frontPort.classList.add("port");
backPort.classList.add("port");
text.innerText = name;
node.appendChild(frontPort);
node.appendChild(text);
node.appendChild(backPort);
return {
element: node,
x: x,
y: y,
ports: [
{ id: frontPortId, element: frontPort },
{ id: backPortId, element: backPort },
],
};
}
const element = document.getElementById("canvas");
const canvas = new CanvasBuilder()
.setElement(element)
.setDefaults({
edges: {
shape: {
hasTargetArrow: true,
},
},
})
.enableUserDraggableNodes()
.enableUserTransformableViewport()
.enableBackground()
.build();
canvas
.addNode(
createNode({
name: "Node 1",
x: 200,
y: 400,
frontPortId: "node-1-in",
backPortId: "node-1-out",
}),
)
.addNode(
createNode({
name: "Node 2",
x: 600,
y: 500,
frontPortId: "node-2-in",
backPortId: "node-2-out",
}),
)
.addEdge({ from: "node-1-out", to: "node-2-in" });3.2.0
10 months ago
3.1.0
10 months ago
3.0.0
10 months ago
2.5.0
11 months ago
2.4.0
11 months ago
2.3.0
11 months ago
2.2.2
11 months ago
2.2.1
11 months ago
2.2.0
11 months ago
2.1.0
11 months ago
2.0.1
12 months ago
2.0.0
12 months ago
1.3.0
12 months ago
1.2.0
12 months ago
1.1.1
12 months ago
1.1.0
12 months ago
1.0.0
1 year ago
0.1.7
1 year ago
0.1.6
1 year ago
0.1.5
1 year ago
0.1.4
1 year ago
0.1.3
1 year ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago
0.0.61
1 year ago
0.0.60
1 year ago
0.0.59
1 year ago
0.0.58
1 year ago
0.0.57
1 year ago
0.0.56
1 year ago
0.0.55
1 year ago
0.0.54
1 year ago
0.0.53
1 year ago
0.0.52
1 year ago
0.0.51
1 year ago
0.0.50
1 year ago
0.0.49
1 year ago
0.0.48
1 year ago
0.0.47
1 year ago
0.0.46
1 year ago
0.0.45
1 year ago
0.0.44
1 year ago
0.0.43
1 year ago