JavaScript diagramming library that uses SVG and HTML for rendering.
- π± easy-to-customize: based on well known SVG/HTML/CSS or React to custom nodes and edges
- π out-of-the-box: built-in 10+ plugins, such as selection, dnd, redo/undo, snapline, minimap, etc.
- 𧲠data-driven: base on MVC architecture, you can focus on data logic and business logic
- π― highly-event-driven: you can react on any event that happens inside the graph
# npm
$ npm install @antv/x6 --save
# yarn
$ yarn add @antv/x6
For learning purposes, you can use the latest version with one of the CDN:
- https://unpkg.com/@antv/x6/dist/x6.js
- https://cdn.jsdelivr.net/npm/@antv/x6/dist/x6.js
- https://cdnjs.cloudflare.com/ajax/libs/antv-x6/1.3.20/x6.js (the latest version is not supported)
<script src="https://unpkg.com/@antv/x6/dist/x6.js"></script>
For production, we recommend linking to a specific version number to avoid unexpected breakage from newer versions:
- https://unpkg.com/@antv/x6@1.1.1/dist/x6.js
- https://cdn.jsdelivr.net/npm/@antv/x6@1.1.1/dist/x6.js
- https://cdnjs.cloudflare.com/ajax/libs/antv-x6/1.1.1/x6.js
<script src="https://unpkg.com/@antv/x6@1.1.1/dist/x6.js"></script>
Step 1: specify a container the render the diagram.
<div id="container" style="width: 600px; height: 400px"></div>
Step 2: render nodes and edges.
import { Graph } from '@antv/x6'
// Create an instance of Graph.
const graph = new Graph({
container: document.getElementById('container'),
grid: true
})
// Render source node.
const source = graph.addNode({
x: 300,
y: 40,
width: 80,
height: 40,
label: 'Hello',
})
// Render target node.
const target = graph.addNode({
x: 420,
y: 180,
width: 80,
height: 40,
label: 'World',
})
// Render edge from source to target.
graph.addEdge({
source,
target,
})
A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.
- Online Demo: https://x6.antv.vision/apps/draw
- Source Code: https://github.com/antvis/x6/tree/master/examples/x6-app-draw
DAG is short for Directed Acyclic Graph, which is a directed graph with no directed cycles. It was originally a common data structure in the computer field. Due to the excellent characteristics brought by the unique topology structure, it is often used to deal with dynamic programming, searching for the shortest path in navigation, data compression and other algorithms.
- Online Demo: https://x6.antv.vision/apps/dag
- Source Code: https://github.com/antvis/x6/tree/master/examples/x6-app-dag
An entity relationship diagram (ERD) shows the relationships of entity sets stored in a database. An entity in this context is an object, a component of data. An entity set is a collection of similar entities. These entities can have attributes that define its properties. By defining the entities, their attributes, and showing the relationships between them, an ER diagram illustrates the logical structure of databases.
- Online Demo: https://x6.antv.vision/apps/er
- Source Code: https://github.com/antvis/x6/tree/master/examples/x6-app-er
Welcome to join the X6 Communication Group (Scan the QR Code to Join us). We also welcome the github issues.
# install yarn and lerna
$ npm install yarn -g
$ npm install lerna -g
# install deps and build
$ yarn bootstrap
# run tests
$ yarn test
# build
$ yarn build
Please let us know how can we help. Do check out issues for bug reports or suggestions first.
To become a contributor, please follow our contributing guide.
The scripts and documentation in this project are released under the MIT License.