logo

X6

  • Tutorials
  • API
  • Examples
  • Q&A
  • Change Log
  • XFlow
  • Productsantv logo arrow
  • 2.x
  • Introduction
  • Quickstart
  • Basic
    • Graph
    • Nodes
    • Edges
    • Connection Pile
    • Interaction
    • Events
    • Data Serialization
  • 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 Version 2.x
  • Developer Tools

Connection Points

Previous
Data Serialization
Next
Tools

Resource

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-Interactive solution
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

In this chapter, we mainly introduce knowledge related to connection points. By reading, you can learn about

  • The concepts of anchor points and connection points
  • How to use anchor points and connection points to customize special connections

Let's start with an example:

When we move the node above, we will notice that the connection points of the edges and the node remain unchanged, and there is a gap between multiple edges. This is completely different from the phenomenon in the previous example. How is this achieved? Let's understand anchor points and connection points through the following diagram.

Introduction

By default, the anchor point is set to center, which means it is located at the center of the element. The connection point is a method for calculating intersection points, with the default set to boundary, meaning it calculates the intersection with the element's border. Therefore, the edge is drawn as a reference line from the anchor point of the starting element to the anchor point of the target element. The intersection point between the reference line and the element is determined by the calculation method specified by the connectionPoint, and this intersection point serves as the starting and ending point of the edge.

Connection Point

Usage

Both the anchor point anchor and the connection point connectionPoint have two usage methods. The first method is to configure them in connecting, which applies globally. The second method is to specify them when creating an edge in source and target.

// Configuring in connecting
const graph = new Graph({
connecting: {
sourceAnchor: {
name: 'right', // The anchor point will be offset 10px upwards from the center of the right side of the node
args: {
dy: -10,
},
},
targetAnchor: {
name: 'right', // The anchor point will be offset 10px upwards from the center of the right side of the node
args: {
dy: -10,
},
},
connectionPoint: 'anchor',
},
})
// You can also configure it when creating the edge, which takes higher priority
graph.addEdge({
source: {
cell: source,
anchor: {
name: 'right',
args: {
dy: -10,
},
},
connectionPoint: 'anchor',
},
target: {
cell: target,
anchor: {
name: 'left',
args: {
dy: -10,
},
},
connectionPoint: 'anchor',
},
})

Of course, X6 also supports a wide variety of anchor and connection point types. If you want to customize special connection edges, you can refer to NodeAnchor and ConnectionPoint.