
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
react-directed-graph-visualizer
Advanced tools
A React component for interactive, customizable, and theme-friendly directed graph visualization based on D3.js. Supports node focus, keyboard navigation.
基于 D3.js 的 React 有向图可视化组件,支持节点高亮、键盘导航、主题自定义,适用于交互式数据可视化场景。
推荐使用 pnpm 安装
pnpm i react-directed-graph-visualizer -S
import { DirectedGraphVisualizer } from 'react-directed-graph-visualizer';
const nodes = [
{ id: '1', label: '节点1' },
{ id: '2', label: '节点2' },
];
const edges = [{ source: '1', target: '2' }];
export default () => (
<DirectedGraphVisualizer
nodes={nodes}
edges={edges}
width={800}
height={600}
onSelectNode={(id) => console.log('选中节点', id)}
/>
);
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| nodes | 节点数据 | Node[] | 必填 | - |
| edges | 边数据 | Edge[] | 必填 | - |
| selectedNodeId | 当前高亮节点 id | string | - | - |
| defaultSelectedNodeId | 默认高亮节点 id | string | - | - |
| onSelectNode | 节点点击回调 | (id: string) => void | - | - |
| width | 画布宽度 | number | 800 | - |
| height | 画布高度 | number | 600 | - |
| filterOrphan | 过滤孤立节点 | boolean | false | 1.1.0 |
| graphSettings | 主题与样式配置 | GraphSettings | 见下表 | - |
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| bg | 背景色 | string | white |
| focusColor | 选中节点色 | string | orange |
| nodeColor | 普通节点色 | string | mediumseagreen |
| linkColor | 普通边色 | string | slategray |
| grayColor | 非高亮色 | string | lightgray |
| hoverColor | 悬浮高亮色 | string | crimson |
| fontSize | 字体大小 | number | 16 |
| hoverFontSize | 悬浮字体大小 | number | 24 |
| graphOutColor | 出边高亮色 | string | royalblue |
| graphInColor | 入边高亮色 | string | goldenrod |
详情:CHANGELOG
Copyright © 2025 - present Wxh16144.
This project is MIT licensed.
FAQs
A React component for interactive, customizable, and theme-friendly directed graph visualization based on D3.js. Supports node focus, keyboard navigation.
The npm package react-directed-graph-visualizer receives a total of 7 weekly downloads. As such, react-directed-graph-visualizer popularity was classified as not popular.
We found that react-directed-graph-visualizer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.