开发预览 更新于 2026-05-10

ArcDiagram 弧线图

节点排在一条轴上,边由半圆弧连接;适合显示线性序列的依赖关系。

基础用法

nodes 沿水平轴等距排列,group 控制节点颜色,size 控制节点半径。edges 的权重映射到弧线透明度。

背景 视口
authapiordersusersbillingcachepgqueue
src/App.vue
<script setup lang="ts">
import { CfArcDiagram } from '@chufix-design/vue';

const nodes = [
  { id: 'auth', label: 'auth', group: 'edge', size: 2 },
  { id: 'api', label: 'api', group: 'edge', size: 3 },
  { id: 'orders', label: 'orders', group: 'core', size: 2 },
  { id: 'users', label: 'users', group: 'core', size: 2.5 },
  { id: 'billing', label: 'billing', group: 'core', size: 2 },
  { id: 'cache', label: 'cache', group: 'data', size: 1.6 },
  { id: 'pg', label: 'pg', group: 'data', size: 2.2 },
  { id: 'queue', label: 'queue', group: 'data', size: 1.6 },
];

const edges = [
  { source: 'auth', target: 'api', weight: 3 },
  { source: 'api', target: 'orders', weight: 4 },
  { source: 'api', target: 'users', weight: 3 },
  { source: 'api', target: 'billing', weight: 2 },
  { source: 'orders', target: 'pg', weight: 4 },
  { source: 'users', target: 'pg', weight: 3 },
  { source: 'billing', target: 'pg', weight: 2 },
  { source: 'orders', target: 'cache', weight: 2 },
  { source: 'api', target: 'cache', weight: 3 },
  { source: 'billing', target: 'queue', weight: 1 },
  { source: 'orders', target: 'queue', weight: 2 },
];
</script>
<template>
  <CfArcDiagram :nodes="nodes" :edges="edges" :width="660" :height="280" />
</template>
<script setup>
import { CfArcDiagram } from '@chufix-design/vue';

const nodes = [
  { id: 'auth', label: 'auth', group: 'edge', size: 2 },
  { id: 'api', label: 'api', group: 'edge', size: 3 },
  { id: 'orders', label: 'orders', group: 'core', size: 2 },
  { id: 'users', label: 'users', group: 'core', size: 2.5 },
  { id: 'billing', label: 'billing', group: 'core', size: 2 },
  { id: 'cache', label: 'cache', group: 'data', size: 1.6 },
  { id: 'pg', label: 'pg', group: 'data', size: 2.2 },
  { id: 'queue', label: 'queue', group: 'data', size: 1.6 },
];

const edges = [
  { source: 'auth', target: 'api', weight: 3 },
  { source: 'api', target: 'orders', weight: 4 },
  { source: 'api', target: 'users', weight: 3 },
  { source: 'api', target: 'billing', weight: 2 },
  { source: 'orders', target: 'pg', weight: 4 },
  { source: 'users', target: 'pg', weight: 3 },
  { source: 'billing', target: 'pg', weight: 2 },
  { source: 'orders', target: 'cache', weight: 2 },
  { source: 'api', target: 'cache', weight: 3 },
  { source: 'billing', target: 'queue', weight: 1 },
  { source: 'orders', target: 'queue', weight: 2 },
];
</script>
<template>
  <CfArcDiagram :nodes="nodes" :edges="edges" :width="660" :height="280" />
</template>
import { CfArcDiagram } from '@chufix-design/react';

export default function Demo() {
  const nodes = [
    { id: 'auth', label: 'auth', group: 'edge', size: 2 },
    { id: 'api', label: 'api', group: 'edge', size: 3 },
    { id: 'orders', label: 'orders', group: 'core', size: 2 },
    { id: 'users', label: 'users', group: 'core', size: 2.5 },
    { id: 'billing', label: 'billing', group: 'core', size: 2 },
    { id: 'cache', label: 'cache', group: 'data', size: 1.6 },
    { id: 'pg', label: 'pg', group: 'data', size: 2.2 },
    { id: 'queue', label: 'queue', group: 'data', size: 1.6 },
  ];
  const edges = [
    { source: 'auth', target: 'api', weight: 3 },
    { source: 'api', target: 'orders', weight: 4 },
    { source: 'api', target: 'users', weight: 3 },
    { source: 'api', target: 'billing', weight: 2 },
    { source: 'orders', target: 'pg', weight: 4 },
    { source: 'users', target: 'pg', weight: 3 },
    { source: 'billing', target: 'pg', weight: 2 },
    { source: 'orders', target: 'cache', weight: 2 },
    { source: 'api', target: 'cache', weight: 3 },
    { source: 'billing', target: 'queue', weight: 1 },
    { source: 'orders', target: 'queue', weight: 2 },
  ];
  return (
    <>
      <CfArcDiagram nodes={nodes} edges={edges} width={660} height={280} />
    </>
  );
}
import { CfArcDiagram } from '@chufix-design/react';

export default function Demo() {
  const nodes = [
    { id: 'auth', label: 'auth', group: 'edge', size: 2 },
    { id: 'api', label: 'api', group: 'edge', size: 3 },
    { id: 'orders', label: 'orders', group: 'core', size: 2 },
    { id: 'users', label: 'users', group: 'core', size: 2.5 },
    { id: 'billing', label: 'billing', group: 'core', size: 2 },
    { id: 'cache', label: 'cache', group: 'data', size: 1.6 },
    { id: 'pg', label: 'pg', group: 'data', size: 2.2 },
    { id: 'queue', label: 'queue', group: 'data', size: 1.6 },
  ];
  const edges = [
    { source: 'auth', target: 'api', weight: 3 },
    { source: 'api', target: 'orders', weight: 4 },
    { source: 'api', target: 'users', weight: 3 },
    { source: 'api', target: 'billing', weight: 2 },
    { source: 'orders', target: 'pg', weight: 4 },
    { source: 'users', target: 'pg', weight: 3 },
    { source: 'billing', target: 'pg', weight: 2 },
    { source: 'orders', target: 'cache', weight: 2 },
    { source: 'api', target: 'cache', weight: 3 },
    { source: 'billing', target: 'queue', weight: 1 },
    { source: 'orders', target: 'queue', weight: 2 },
  ];
  return (
    <>
      <CfArcDiagram nodes={nodes} edges={edges} width={660} height={280} />
    </>
  );
}

适用场景

  • 服务依赖图、词义共现网络、社交关系链
  • ConnectionGraph 的对比:ConnectionGraph 是力导向自由布局;ArcDiagram 强制 1D 排列以避免遮挡。

API

属性类型默认值说明
nodesArcNode[]{ id, label?, group?, size? }[]
edgesArcEdge[]{ source, target, weight? }[]
width / heightnumber640/280
arcSide'top' | 'bottom''top'弧线在轴的上方还是下方

Events

VueReact载荷
edge-enter / edge-leaveonEdgeEnter / onEdgeLeave{ edge }

反馈与讨论

ArcDiagram 弧线图 的讨论

0
0 / 600
正在加载评论...