Closed yvonneyx closed 5 months ago
类型定义
interface GraphinProps extends Pick<React.HTMLAttributes<HTMLDivElement>, 'id' | 'className' | 'style'> { onDestroy?: (graph: Graph) => void; onInit?: (graph: Graph) => void; onRender?: (graph: Graph) => void; options?: GraphOptions; }
Example
const Demo: React.FC = () => { const [layout, setLayout] = useState<SingleLayoutOptions>(layouts[0]); return ( <Graphin id="graphin-demo" className="graphin-container" style={{ width: '100%', height: '100%' }} options={{ data, layout, behaviors: ['zoom-canvas', 'drag-canvas'], }} > <LayoutSelector onChange={value => setLayout(layouts.find(layout => layout.type === value)!)} options={layouts} value={layout.type} /> </Graphin> ); };
效果截图
类型定义
Example
效果截图