1 Star 1 Fork 0

FORK / X6

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.en-us.md 9.85 KB
一键复制 编辑 原始数据 按行查看 历史
newbyvector 提交于 2021-12-05 23:13 . docs: 📚️ update readme (#1621)

简体中文 | English

JavaScript diagramming library that uses SVG and HTML for rendering

Tutorials · Examples · API

build coverage Language grade: JavaScript NPM Package NPM Downloads

MIT License Language PRs Welcome website

Features

  • 🌱 easy-to-customize: based on well known SVG/HTML/CSS or React/Vue 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

Installation

NPM/Yarn

# npm
$ npm install @antv/x6 --save

# yarn
$ yarn add @antv/x6

CDNs

For learning purposes, you can use the latest version with one of the CDN:

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

<script src="https://unpkg.com/@antv/x6@1.1.1/dist/x6.js"></script>

Usage

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 from node_modules
import { Graph } from '@antv/x6'
// or use the global variable `X6` exported from CDN links
// const { Graph } = 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,
})
HelloWorld

Documentation

App Demos Build with X6

Flow Dag MindMap BPMN Class ORG ER SwimLane Tree ELK

Communication

Welcome to join the X6 Communication Group (Scan the QR Code to Join us). We also welcome the github issues.

X6 图可视化交流群1 X6 图可视化交流群2

Development

This repo is based on lerna with the following structure:

.
├── examples
│   ├── x6-app-dag            # example of dag graph
│   ├── x6-app-draw           # example of flowchart
│   ├── x6-app-er             # example of ER chart
│   └── x6-example-features   # example of basic features
├── packages
│   ├── x6                    # X6
│   ├── x6-react              # wrap X6 with react(reserved)
│   ├── x6-react-components   # react componets to build graph apps
│   ├── x6-react-shape        # support render node with react
│   └── x6-vue-shape          # support render node with vue
└── sites
    ├── x6-sites              # sites and documents
    ├── x6-sites-demos        # demos in documents
    └── x6-sites-demos-helper # tools to build demos

We need to install some necessary global tools before getting started.

# install yarn and lerna
$ npm install yarn -g
$ npm install lerna -g

# install deps and build
$ yarn bootstrap

Then we can cd to dirs to development and debugging.

Such as, we can start examples/x6-example-features locally:

cd examples/x6-example-features

yarn start

When need to fix some bugs of X6, we can start with watch mode:

cd packages/x6

// build esm to "em" dir
yarn build:watch:esm

// build commonjs to "lib" dir
yarn build:watch:cjs

Contributing

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.

Contributors

Contributors

License

The scripts and documentation in this project are released under the MIT License.

1
https://gitee.com/diven-fork/X6.git
git@gitee.com:diven-fork/X6.git
diven-fork
X6
X6
master

搜索帮助