logo

G6

  • Docs
  • API
  • Playground
  • Community
  • Productsantv logo arrow
  • 5.0.45
  • Introduction
  • Data
  • Getting Started
    • Quick Start
    • Installation
    • Integration
      • react
      • vue
      • angular
    • Step-by-step guide
  • Graph
    • Extensions En
    • Graph
    • Options
    • extension
  • Element
    • Element Overview
    • Element State
    • Node
      • Node Overview
      • Build-in Node
        • Common Node Configurations
        • Diamond
        • Donut
        • Ellipse
        • Hexagon
        • Html
        • Image
        • Rect
        • Star
        • Triangle
        • Circle
      • Custom Node
      • Define Nodes with React
    • Edge
      • Edge Overview
      • Build-in Edge
        • Common Edge Configurations
        • Cubic Bezier Curve
        • CubicHorizontal Bezier Curve
        • CubicVertical Bezier Curve
        • Line
        • Polyline
        • Quadratic Bezier Curve
      • Custom Edge
    • Combo
      • Combo Overview
      • Build-in Combo
        • Circle
        • Combo Configuration Options
        • Rect
      • Custom Combo
    • Shape
      • Shape Overview
      • Shape Properties
  • Layout
    • Layout Overview
    • Build-in Layout
      • AntvDagre
      • Circular
      • ComboCombined
      • Common Layout Configuration Options
      • CompactBox
      • Concentric
      • D3Force
      • D3Force3D
      • Dagre
      • Dendrogram
      • Fishbone
      • Force
      • ForceAtlas2
      • Fruchterman
      • Grid Layout
      • Indented
      • Mds
      • Mindmap
      • Radial
      • Random
      • Snake
    • Custom Layout
  • Behavior
    • Behavior Overview
    • Build-in Behavior
      • AutoAdaptLabel
      • BrushSelect
      • ClickSelect
      • CollapseExpand
      • CreateEdge
      • DragCanvas
      • DragElement
      • DragElementForce
      • FixElementSize
      • FocusElement
      • HoverActivate
      • LassoSelect
      • OptimizeViewportTransform
      • ScrollCanvas
      • ZoomCanvas
    • Custom Behavior
  • Plugin
    • Plugin Overview
    • Build-in Plugin
      • Background
      • BubbleSets
      • Contextmenu
      • EdgeBundling
      • EdgeFilterLens
      • Fisheye
      • Fullscreen
      • GridLine
      • History
      • Hull
      • Legend
      • Minimap
      • Snapline
      • Timebar
      • Toolbar
      • Tooltip
      • Watermark
    • Custom Plugin
  • Transform
    • Data Transformation Overview
    • Build-in Transform
      • MapNodeSize
      • PlaceRadialLabels
      • ProcessParallelEdges
    • Custom Transform
  • Theme
    • Theme Overview
    • Custom Theme
    • Palette
    • Custom Palette
  • Animation
    • Animation Overview
    • Custom Animation
  • Further Reading
    • Event
    • renderer
    • coordinate
    • download-image
    • Using Iconfont
    • Use 3D
    • Bundle Project
  • What's new
    • Feature
    • Upgrade To 5.0
  • FAQ
  • contribute

Fishbone

Previous
Dendrogram
Next
Force

Resources

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

Overview

The Fishbone layout is a graphical layout method specifically designed to represent hierarchical data. By simulating the shape of a fishbone, it arranges data nodes according to their hierarchical structure, making the hierarchical relationships of the data clearer and more intuitive. The fishbone layout is particularly suitable for datasets that need to display causal relationships, hierarchical structures, or classification information.

Usage Scenarios

  • Displaying hierarchical data, such as organizational structures and classification systems
  • Displaying problem analysis processes, such as fault analysis and quality analysis
  • Displaying decision-making processes, such as decision trees and factor analysis

Online Experience

createGraph(
{
data: {
nodes: [
{
id: 'Quality',
depth: 0,
children: ['Machine', 'Method', 'Material', 'Man Power', 'Measurement', 'Milieu'],
},
{
id: 'Machine',
depth: 1,
children: ['Mill', 'Mixer', 'Metal Lathe'],
},
{
id: 'Mill',
depth: 2,
},
{
id: 'Mixer',
depth: 2,
},
{
id: 'Metal Lathe',
depth: 2,
children: ['Milling'],
},
{
id: 'Milling',
depth: 3,
},
{
id: 'Method',
depth: 1,
},
{
id: 'Material',
depth: 1,
children: ['Masonite', 'Marscapone', 'Meat'],
},
{
id: 'Masonite',
depth: 2,
children: ['spearMint', 'pepperMint', 'test1'],
},
{
id: 'spearMint',
depth: 3,
},
{
id: 'pepperMint',
depth: 3,
children: ['test3'],
},
{
id: 'test3',
depth: 4,
},
{
id: 'test1',
depth: 3,
children: ['test4'],
},
{
id: 'test4',
depth: 4,
},
{
id: 'Marscapone',
depth: 2,
children: ['Malty', 'Minty'],
},
{
id: 'Malty',
depth: 3,
},
{
id: 'Minty',
depth: 3,
},
{
id: 'Meat',
depth: 2,
children: ['Mutton'],
},
{
id: 'Mutton',
depth: 3,
},
{
id: 'Man Power',
depth: 1,
children: ['Manager', "Master's Student", 'Magician', 'Miner', 'Magister', 'Massage Artist'],
},
{
id: 'Manager',
depth: 2,
},
{
id: "Master's Student",
depth: 2,
},
{
id: 'Magician',
depth: 2,
},
{
id: 'Miner',
depth: 2,
},
{
id: 'Magister',
depth: 2,
children: ['Malpractice'],
},
{
id: 'Malpractice',
depth: 3,
},
{
id: 'Massage Artist',
depth: 2,
children: ['Masseur', 'Masseuse'],
},
{
id: 'Masseur',
depth: 3,
},
{
id: 'Masseuse',
depth: 3,
},
{
id: 'Measurement',
depth: 1,
children: ['Malleability'],
},
{
id: 'Malleability',
depth: 2,
},
{
id: 'Milieu',
depth: 1,
children: ['Marine'],
},
{
id: 'Marine',
depth: 2,
},
],
edges: [
{
source: 'Quality',
target: 'Machine',
},
{
source: 'Quality',
target: 'Method',
},
{
source: 'Quality',
target: 'Material',
},
{
source: 'Quality',
target: 'Man Power',
},
{
source: 'Quality',
target: 'Measurement',
},
{
source: 'Quality',
target: 'Milieu',
},
{
source: 'Machine',
target: 'Mill',
},
{
source: 'Machine',
target: 'Mixer',
},
{
source: 'Machine',
target: 'Metal Lathe',
},
{
source: 'Metal Lathe',
target: 'Milling',
},
{
source: 'Material',
target: 'Masonite',
},
{
source: 'Material',
target: 'Marscapone',
},
{
source: 'Material',
target: 'Meat',
},
{
source: 'Masonite',
target: 'spearMint',
},
{
source: 'Masonite',
target: 'pepperMint',
},
{
source: 'Masonite',
target: 'test1',
},
{
source: 'pepperMint',
target: 'test3',
},
{
source: 'test1',
target: 'test4',
},
{
source: 'Marscapone',
target: 'Malty',
},
{
source: 'Marscapone',
target: 'Minty',
},
{
source: 'Meat',
target: 'Mutton',
},
{
source: 'Man Power',
target: 'Manager',
},
{
source: 'Man Power',
target: "Master's Student",
},
{
source: 'Man Power',
target: 'Magician',
},
{
source: 'Man Power',
target: 'Miner',
},
{
source: 'Man Power',
target: 'Magister',
},
{
source: 'Man Power',
target: 'Massage Artist',
},
{
source: 'Magister',
target: 'Malpractice',
},
{
source: 'Massage Artist',
target: 'Masseur',
},
{
source: 'Massage Artist',
target: 'Masseuse',
},
{
source: 'Measurement',
target: 'Malleability',
},
{
source: 'Milieu',
target: 'Marine',
},
],
},
node: {
type: 'rect',
style: {
size: [32, 32],
// fill: () => randomColor(),
label: false,
labelFill: '#262626',
labelFontFamily: 'Gill Sans',
labelMaxLines: 2,
labelMaxWidth: '100%',
labelPlacement: 'center',
labelText: (d) => d.id,
labelWordWrap: true,
},
},
edge: {
type: 'polyline',
style: {
lineWidth: 3,
},
},
behaviors: ['drag-canvas', 'zoom-canvas', 'drag-element'],
autoFit: 'view',
layout: {
type: 'fishbone',
direction: 'RL',
hGap: 50,
vGap: 50,
getRibSep: () => 60,
},
},
{ width: 600, height: 400 },
(gui, graph) => {
const options = {
type: 'fishbone',
direction: 'RL',
hGap: 50,
vGap: 50,
getRibSep: 60,
};
const optionFolder = gui.addFolder('Fishbone Layout Options');
optionFolder.add(options, 'type').disable(true);
optionFolder.add(options, 'direction', ['RL', 'LR']);
optionFolder.add(options, 'hGap', 20, 100, 10);
optionFolder.add(options, 'vGap', 20, 100, 10);
optionFolder.add(options, 'getRibSep', 30, 100, 10);
optionFolder.onChange(async ({ property, value }) => {
graph.setLayout(
Object.assign({}, graph.getLayout(), {
[property]: property === 'getRibSep' ? () => value : value,
}),
);
await graph.layout();
// 调整 direction 后部分node可能会溢出屏幕,重新执行下fitView
if (property === 'direction') {
graph.fitView();
}
});
},
);

Basic Usage

const graph = new Graph({
layout: {
type: 'fishbone',
direction: 'LR',
hGap: 50,
vGap: 50,
getRibSep: () => 60,
},
});

Configuration Options

PropertyDescriptionTypeDefaultRequired
typeLayout typefishbone-✓
directionLayout direction, RL from right to left, fish head on the right; LR from left to right, fish head on the leftRL | LRRL
hGapHorizontal spacingnumber-
vGapVertical spacingnumber-
getRibSepGet fishbone spacing(node: NodeData) => number() => 60
widthLayout widthnumber-
heightLayout heightnumber-
nodeSizeNode sizenumber | [number, number] | [number, number, number] | ((node: NodeData) => number | [number, number] | [number, number, number])-
isLayoutInvisibleNodesWhether invisible nodes participate in the layout, takes effect when preLayout is trueboolean-
nodeFilterNodes involved in this layout(node: NodeData) => boolean-
preLayoutUse pre-layout to calculate the layout before initializing elements, not applicable to pipeline layoutboolean-

Code Examples

Basic Usage

Simplest configuration:

import { Graph, treeToGraphData } from '@antv/g6';
const graph = new Graph({
layout: {
type: 'fishbone',
},
autoFit: 'view',
data: treeToGraphData({
nodes: [
{ id: 'root', data: { label: 'Root' } },
{ id: 'child1', data: { label: 'Child 1' } },
{ id: 'child2', data: { label: 'Child 2' } },
{ id: 'child3', data: { label: 'Child 3' } },
],
edges: [
{ id: 'e1', source: 'root', target: 'child1' },
{ id: 'e2', source: 'root', target: 'child2' },
{ id: 'e3', source: 'root', target: 'child3' },
],
}),
edge: {
type: 'polyline',
style: {
lineWidth: 3,
},
},
behaviors: ['drag-canvas'],
});

The effect is as follows:

createGraph(
{
layout: {
type: 'fishbone',
},
autoFit: 'view',
data: {
nodes: [
{
id: 'Quality',
depth: 0,
children: ['Machine', 'Method', 'Material', 'Man Power', 'Measurement', 'Milieu'],
},
{
id: 'Machine',
depth: 1,
children: ['Mill', 'Mixer', 'Metal Lathe'],
},
{
id: 'Mill',
depth: 2,
},
{
id: 'Mixer',
depth: 2,
},
{
id: 'Metal Lathe',
depth: 2,
children: ['Milling'],
},
{
id: 'Milling',
depth: 3,
},
{
id: 'Method',
depth: 1,
},
{
id: 'Material',
depth: 1,
children: ['Masonite', 'Marscapone', 'Meat'],
},
{
id: 'Masonite',
depth: 2,
children: ['spearMint', 'pepperMint', 'test1'],
},
{
id: 'spearMint',
depth: 3,
},
{
id: 'pepperMint',
depth: 3,
children: ['test3'],
},
{
id: 'test3',
depth: 4,
},
{
id: 'test1',
depth: 3,
children: ['test4'],
},
{
id: 'test4',
depth: 4,
},
{
id: 'Marscapone',
depth: 2,
children: ['Malty', 'Minty'],
},
{
id: 'Malty',
depth: 3,
},
{
id: 'Minty',
depth: 3,
},
{
id: 'Meat',
depth: 2,
children: ['Mutton'],
},
{
id: 'Mutton',
depth: 3,
},
{
id: 'Man Power',
depth: 1,
children: ['Manager', "Master's Student", 'Magician', 'Miner', 'Magister', 'Massage Artist'],
},
{
id: 'Manager',
depth: 2,
},
{
id: "Master's Student",
depth: 2,
},
{
id: 'Magician',
depth: 2,
},
{
id: 'Miner',
depth: 2,
},
{
id: 'Magister',
depth: 2,
children: ['Malpractice'],
},
{
id: 'Malpractice',
depth: 3,
},
{
id: 'Massage Artist',
depth: 2,
children: ['Masseur', 'Masseuse'],
},
{
id: 'Masseur',
depth: 3,
},
{
id: 'Masseuse',
depth: 3,
},
{
id: 'Measurement',
depth: 1,
children: ['Malleability'],
},
{
id: 'Malleability',
depth: 2,
},
{
id: 'Milieu',
depth: 1,
children: ['Marine'],
},
{
id: 'Marine',
depth: 2,
},
],
edges: [
{
source: 'Quality',
target: 'Machine',
},
{
source: 'Quality',
target: 'Method',
},
{
source: 'Quality',
target: 'Material',
},
{
source: 'Quality',
target: 'Man Power',
},
{
source: 'Quality',
target: 'Measurement',
},
{
source: 'Quality',
target: 'Milieu',
},
{
source: 'Machine',
target: 'Mill',
},
{
source: 'Machine',
target: 'Mixer',
},
{
source: 'Machine',
target: 'Metal Lathe',
},
{
source: 'Metal Lathe',
target: 'Milling',
},
{
source: 'Material',
target: 'Masonite',
},
{
source: 'Material',
target: 'Marscapone',
},
{
source: 'Material',
target: 'Meat',
},
{
source: 'Masonite',
target: 'spearMint',
},
{
source: 'Masonite',
target: 'pepperMint',
},
{
source: 'Masonite',
target: 'test1',
},
{
source: 'pepperMint',
target: 'test3',
},
{
source: 'test1',
target: 'test4',
},
{
source: 'Marscapone',
target: 'Malty',
},
{
source: 'Marscapone',
target: 'Minty',
},
{
source: 'Meat',
target: 'Mutton',
},
{
source: 'Man Power',
target: 'Manager',
},
{
source: 'Man Power',
target: "Master's Student",
},
{
source: 'Man Power',
target: 'Magician',
},
{
source: 'Man Power',
target: 'Miner',
},
{
source: 'Man Power',
target: 'Magister',
},
{
source: 'Man Power',
target: 'Massage Artist',
},
{
source: 'Magister',
target: 'Malpractice',
},
{
source: 'Massage Artist',
target: 'Masseur',
},
{
source: 'Massage Artist',
target: 'Masseuse',
},
{
source: 'Measurement',
target: 'Malleability',
},
{
source: 'Milieu',
target: 'Marine',
},
],
},
edge: {
type: 'polyline',
style: {
lineWidth: 3,
},
},
behaviors: ['drag-canvas'],
},
{ width: 600, height: 400 },
);

Practical Examples

  • Fishbone Layout