1 Star 0 Fork 72

老鼠见到猫 / gg-editor

forked from 高力 / gg-editor 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 2.74 KB
一键复制 编辑 原始数据 按行查看 历史
高力 提交于 2018-09-20 13:49 . docs(README): Update Usage

English | 简体中文

GGEditor

language GitHub license npm version npm downloads

A visual graph editor based on G6 and React.

Demo

Flow

Flow

Mind

Mind

Installation

npm

npm install --save gg-editor

umd

<script src="https://unpkg.com/gg-editor@${version}/dist/bundle.js"></script>

run demo

$ git clone https://github.com/gaoli/GGEditor.git
$ cd gg-editor
$ npm install
$ npm start

Usage

Flow

import GGEditor, { Flow } from 'gg-editor';

const data = {
  nodes: [{
    type: 'node',
    size: '70*70',
    shape: 'flow-circle',
    color: '#FA8C16',
    label: '起止节点',
    x: 55,
    y: 55,
    id: 'ea1184e8',
    index: 0,
  }, {
    type: 'node',
    size: '70*70',
    shape: 'flow-circle',
    color: '#FA8C16',
    label: '结束节点',
    x: 55,
    y: 255,
    id: '481fbb1a',
    index: 2,
  }],
  edges: [{
    source: 'ea1184e8',
    sourceAnchor: 2,
    target: '481fbb1a',
    targetAnchor: 0,
    id: '7989ac70',
    index: 1,
  }],
};

<GGEditor>
  <Flow style={{ width: 500, height: 500 }} data={data} />
</GGEditor>

Mind

import GGEditor, { Mind } from 'gg-editor';

const data = {
  roots: [{
    label: '中心主题',
    children: [{
      label: '分支主题 1',
    }, {
      label: '分支主题 2',
    }, {
      label: '分支主题 3',
    }],
  }],
};

<GGEditor>
  <Mind style={{ width: 500, height: 500 }} data={data} />
</GGEditor>

Documentation

DingTalk Group

DingTalk Group

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/tigger-home/gg-editor.git
git@gitee.com:tigger-home/gg-editor.git
tigger-home
gg-editor
gg-editor
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891