logo

G6

  • Docs
  • API
  • Playground
  • Community
  • Productsantv logo arrow
  • 5.0.47
  • 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 and KeyShape
      • Atomic Shapes and Their Properties
      • Design and Implementation of Composite Shape
  • Layout
    • Layout Overview
    • Build-in Layout
      • 3D Force-Directed Layout
      • AntvDagre Layout
      • Circular Layout
      • ComboCombined Layout
      • Common Layout Configuration Options
      • CompactBox
      • Concentric Layout
      • D3 Force-Directed Layout
      • Dagre Layout
      • Dendrogram Layout
      • Fishbone Layout
      • Force Force-directed Layout
      • ForceAtlas2 Force-directed Layout
      • Fruchterman Force-directed Layout
      • Grid Layout
      • Indented Tree
      • MDS High-dimensional Data Dimensionality Reduction Layout
      • Mindmap Tree
      • Radial Layout
      • Random Layout
      • Snake Layout
    • 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

Element Overview

Previous
extension
Next
Element State

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...

Element System

The core of G6 charts is composed of three basic elements: Node, Edge, and Combo. These elements are the fundamental units for building complex graphical networks.

Node

Nodes represent entities or concepts in the graph, such as people, places, objects, etc. G6 provides a rich set of built-in node types:

G6 also supports defining nodes using React or custom nodes to meet specific needs.

Edge

Edges represent the connections between nodes, such as friendships, transactions, etc. G6 has multiple built-in edge types:

When built-in edges do not meet the requirements, complex connection expressions can be achieved through custom edges.

Combo

Combos are special elements that can contain nodes and other combos, used to represent collections, groups, or hierarchical relationships. G6 has two built-in combo types:

  • Circle Combo(circle): Suitable for compact grouping
  • Rectangle Combo(rect): Suitable for regular layout grouping

Combos support nesting, dragging, expanding/collapsing, and other interactions, and more complex container behaviors can be achieved through custom combos.

Element Composition Principle

Each element is composed of one or more basic shapes. Shapes are the smallest graphical units in G6, including rectangle, circle, text, path, etc.

For example:

  • A node may consist of a background shape (such as a circle) and a text label
  • An edge may consist of a path, arrow, and text label
  • A combo may consist of a container shape, title text, and expand/collapse button

For more information about shapes, see Shape Overview and Shape Style Properties.

Element State

Element State is a powerful mechanism for displaying visual changes of elements in different interactions or business scenarios. G6 provides a complete state management system:

  • Preset States: selected, highlight, active, etc.
  • State Overlay: Elements can have multiple states simultaneously, with styles overlaying according to priority
  • Custom States: Any state can be defined according to business needs

Configure Elements

G6 5.x adopts a flat configuration structure, where all element configurations are at the same level, making it easy to find and manage:

{
node: {
// Default node style
style: {
fill: 'orange',
labelText: 'node',
},
// Node styles in different states
state: {
selected: {
stroke: '#1890FF',
lineWidth: 2,
}
}
},
edge: {
// Default edge style
style: {
stroke: '#aaa',
},
// Edge styles in different states
state: {
highlight: {
stroke: 'red',
}
}
},
combo: {
// Default combo style
style: {
fill: 'lightblue',
stroke: 'blue',
}
}
};

There are three configuration methods, in order of priority from high to low:

  1. Dynamic configuration using instance methods: such as graph.setNode(), graph.setEdge(), graph.setCombo()
  2. Global configuration when instantiating the graph: specify configuration items in new Graph()
  3. Configuration in data: set in the data objects of nodes, edges, and combos

In editors like VSCode, you can see all configurable properties of elements and search based on keywords:

Extension Capabilities

G6 provides powerful extension capabilities to meet various customization needs:

  • Custom Nodes: Custom Node Guide
  • Custom Edges: Custom Edge Guide
  • Custom Combos: Custom Combo Guide
  • React Nodes: Define Nodes Using React
  • 3D Extension: Use 3D nodes through @antv/g6-extension-3d

Built-in Element Reference

Node Types

  • Built-in Node Library

Edge Types

  • Built-in Edge Library

Combo Types

  • Built-in Combo Library