logo

X6

  • Tutorials
  • API
  • Examples
  • Q&A
  • Change Log
  • XFlow
  • Productsantv logo arrow
  • 2.x
  • start
    • Introduction
    • Quick Start
  • component
    • XFlowGraph Canvas
    • Background
    • Grid
    • Clipboard Copy and Paste
    • History Undo Redo
    • Minimap
    • Snapline Alignment Lines
    • Transform
    • Control Controller
  • Hook
    • useGraphInstance
    • useGraphStore
    • useGraphEvent
    • useDnd
    • useClipboard
    • useExport
    • useHistory
    • useKeyboard
  • Store

Store

Previous
useKeyboard

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

Xflow provides unified management of data on the canvas, with all canvas data stored in a single store, making development very easy.

You can conveniently manipulate the store using useGraphStore, allowing you to update the canvas data and achieve canvas updates.

Initialization State

initData(data, options)

This function is used to initialize the state manager, setting the initial nodes and edges.

Parameters:

  • data: An object containing two arrays, nodes and edges, which store the data for nodes and edges, respectively.
  • options: An optional object. When set to { silent: true }, the initialization operation will not be recorded in the change list changeList.

Node Operations

addNodes(ns, options)

Adds new nodes to the state manager.

Parameters:

  • ns: An array of node objects.
  • options: An optional object. When { silent: true }, the add operation will not be recorded in the change list.

removeNodes(ids, options)

Removes nodes by an array of IDs.

Parameters:

  • ids: An array containing node IDs.
  • options: An optional object. When { silent: true }, the remove operation will not be recorded in the change list.

updateNode(id, data, options)

Updates a node by its ID. Modifying the node's id or shape properties is not allowed.

Parameters:

  • id: The ID of the node to be updated.
  • data: An object or a function containing the data to be updated.
  • options: An optional object. When { silent: true }, the update operation will not be recorded in the change list.

Edge Operations

addEdges(es, options)

Adds new edges to the state manager.

Parameters:

  • es: An array of edge objects.
  • options: An optional object. When { silent: true }, the add operation will not be recorded in the change list.

removeEdges(ids, options)

Removes edges by an array of IDs.

Parameters:

  • ids: An array containing edge IDs.
  • options: An optional object. When { silent: true }, the remove operation will not be recorded in the change list.

updateEdge(id, data, options)

Updates an edge by its ID. Modifying the edge's id or shape properties is not allowed.

Parameters:

  • id: The ID of the edge to be updated.
  • data: An object or a function containing the data to be updated.
  • options: An optional object. When { silent: true }, the update operation will not be recorded in the change list.