AntV X6 Diagramming Guide

· 1 min read

Recently, a work requirement needed to draw DAG graphs with interactive operations. After research, I decided to use AntV X6 as the solution. After using it in practice, here’s a summary of common issues.

How to choose between X6, G6, and others

There are many visualization graph libraries under AntV, so how do you choose? In fact, each library has a different positioning, so use what fits your needs. Here’s the official introduction to each library.

AntV plugins

As you can see, AntV provides many plugins that can be loaded as needed. For example, to implement a component that deletes selected nodes with the backspace key, you need the selection and keyboard plugins.

For a specific list of plugins, see here: https://github.com/antvis/X6/tree/master/packages

Custom node styles

Automatic layout

  • Install the dependency package dagre
  • During initial rendering, just call the layout(graph) method.

The implementation code for layout is as follows, for reference only.

https://gist.githubusercontent.com/alanhe421/1e2942d8e7134a53f1e54d4802c3e437/raw/f0b06508525f12874d36831935e8fb04dcb39a4c/antv-x6-layout.ts

3D/2.5D support?

The official library doesn’t provide a solution for this; you currently need to solve it yourself.

2.0 Plan

👉 https://www.yuque.com/antv/x6/sk3zdn_nsgg4p

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover