流向
依赖关系图
type: 'dependencywheel'圆形弦图,显示加权关系排列在圆周周围。
编辑右侧的JSON并按Run(或⌘/Ctrl + Enter)——数据、标题、类别和颜色全部实时更新。
实时
依赖关系图
编辑 · JSON
数据格式
{ from: string, to: string, weight: number }
数据结构
传入图表的 JSON——可直接放进你的 series。
data: [
{ from: '工程', to: '设计', weight: 8 },
{ from: '工程', to: 'QA', weight: 6 },
{ from: '设计', to: 'Marketing', weight: 5 }
]示例
import KatuCharts from 'katucharts.js';
KatuCharts.chart('container', {
chart: { type: 'dependencywheel' },
series: [{
data: [
{ from: '工程', to: '设计', weight: 8 },
{ from: '工程', to: 'QA', weight: 6 },
{ from: '设计', to: 'Marketing', weight: 5 }
]
}]
});类型特定选项
| 选项 | 描述 |
|---|---|
nodeWidth / linkOpacity | 弧宽 / 带状条不透明度。 |
labelType | 'max' | 'medium' | 'small' — 节点标签的精简密度。 |
变体
更宽的弧段与不透明度
增大 nodeWidth 和缎带不透明度,让环更醒目。
KatuCharts.chart('container', {
chart: { type: 'dependencywheel' },
series: [{
nodeWidth: 24, linkOpacity: 0.7,
data: [
{ from: '工程', to: '设计', weight: 8 },
{ from: '设计', to: 'Marketing', weight: 5 }
]
}]
});Common errors
- Why does my 依赖关系图 chart render as a line chart?
- The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
- Why do I get "Cannot read properties of null (reading 'appendChild')"?
- The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
- Why is the chart rendering with zero height?
- The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.
FAQ
- How do I create a 依赖关系图 chart in JavaScript?
- Install with `npm install katucharts.js`, then call KatuCharts.chart(container, { chart: { type: 'dependencywheel' }, series: [...] }).
- Why does my 依赖关系图 chart render as a line chart?
- The chart type was not registered. KatuCharts logs "KatuCharts: unknown series type "<type>", falling back to line" and draws a line chart rather than throwing. Import the module the type belongs to — for example `import 'katucharts.js/bio';` — before creating the chart.
- Why do I get "Cannot read properties of null (reading 'appendChild')"?
- The container element does not exist when the chart is created. Create the chart after the element is in the DOM: in React that means inside useEffect, not during render.
- Why is the chart rendering with zero height?
- The container has no height. A div with no content collapses to zero. Give it a height in CSS, or pass `chart: { height: 400 }` in the options.