@visactor/react-vgraph
v0.1.0
Published
The react version of VGraph
Readme
@visactor/react-vgraph
React bindings and helper components for VGraph.
Installation
npm install @visactor/vgraph @visactor/react-vgraph react react-domIf your application uses TypeScript, install React type packages in the app as usual:
npm install -D @types/react @types/react-domPeer Dependencies
@visactor/vgraphreactreact-dom
Exports
Viewer: Render React nodes and group titles on top of an existing VGraph instanceDataLineageGraph: Ready-to-use data lineage graph componentuseNodes,useEdges,useZoomRatio,useSelections: React hooks for VGraph state access
Quick Start
import React from "react";
import { Graph } from "@visactor/vgraph";
import { Viewer } from "@visactor/react-vgraph";
const graph = new Graph({
container: "container",
width: 800,
height: 600,
});
graph.data({
nodes: [{ id: "node-1", x: 100, y: 100 }],
edges: [],
});
export function App() {
return <Viewer graph={graph} setNode={(node) => <div>{node.id}</div>} />;
}Documentation
- Docs: https://visactor.io/vgraph
- Examples: https://visactor.io/vgraph/example
