logo

X6

  • Tutorials
  • API
  • Examples
  • Q&A
  • Change Log
  • Productsantv logo arrow
  • 3.x
  • Introduction
  • Quickstart
  • Basic
    • Graph
    • Nodes
    • Edges
    • Ports
    • Interaction
    • Events
    • Data Serialization
    • Animation
  • Intermediate
    • Connection Points
    • Tools
    • Group
    • React Nodes
    • Vue Nodes
    • Angular Nodes
    • HTML Nodes
  • Plugin
    • Graphic Transformations
    • Snapline
    • Clipboard
    • Keyboard
    • History
    • Selection Box
    • Scroller
    • Dnd
    • Mini Map
    • Stencil
    • Export
  • Upgrade to 3.x
  • Developer Tools

Connection Points

Previous
Animation
Next
Tools

Resource

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

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference
weavefoxWeaveFox-AI Developer Community

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-Interactive solution
weavefoxWeaveFox-AI Coding Assistant
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

This chapter mainly introduces knowledge related to connection points. By reading, you can learn about

  • Concepts of anchors and connection points
  • How to use anchors and connection points to customize special edges

Let's start with an example:

When you move the node above, the edge connection points on the node remain fixed, and multiple edges keep a gap between them. This differs from the previous example. How is this achieved? Let's understand anchors and connection points with the following diagram.

Introduction

By default, the anchor is center (the element center). connectionPoint specifies how to compute intersection points; its default is boundary (intersection with the element boundary). An edge is drawn by connecting a reference line from the source anchor to the target anchor. The intersection of that line with the element, computed per connectionPoint, becomes the edge's start/end point.

Connection Point

Usage

You can configure anchor and connectionPoint globally in connecting, or per edge via source and target.

// Configuring in connecting
const graph = new Graph({
connecting: {
sourceAnchor: {
name: 'right', // Offsets the anchor 10px upward from the center on the right side of the node
args: {
dy: -10,
},
},
targetAnchor: {
name: 'right', // Offsets the anchor 10px upward from the center on the right side of the node
args: {
dy: -10,
},
},
connectionPoint: 'anchor',
},
})
// Per-edge configuration takes precedence
graph.addEdge({
source: {
cell: source,
anchor: {
name: 'right',
args: {
dy: -10,
},
},
connectionPoint: 'anchor',
},
target: {
cell: target,
anchor: {
name: 'left',
args: {
dy: -10,
},
},
connectionPoint: 'anchor',
},
})

X6 also supports a wide variety of anchor and connection point types. To customize special edges, refer to NodeAnchor and ConnectionPoint.