Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Jun 25, 2024
1 parent c3c2ef3 commit 44222f9
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 42 deletions.
25 changes: 8 additions & 17 deletions README.en-US.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

<img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> English | [简体中文](./README.md)

<h1 align="center">
<b>G6: A Graph Visualization Framework in TypeScript</b>
</h1>

> The G6 5.0 beta version has been released. There are still many details and experience issues, and we welcome you to try it out and provide feedback. Use it with caution in production environments for now. The official version will be released with 6.6!
![](https://user-images.githubusercontent.com/6113694/45008751-ea465300-b036-11e8-8e2a-166cbb338ce2.png)

[![npm Version](https://img.shields.io/npm/v/@antv/g6.svg)](https://www.npmjs.com/package/@antv/g6)
Expand Down Expand Up @@ -35,7 +32,6 @@

<img src="https://user-images.githubusercontent.com/6113694/44995293-02858600-afd5-11e8-840c-349e4730d63d.gif" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*I9OdTbXJIi0AAAAAAAAAAABkARQnAQ" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*xoufSYcjK2AAAAAAAAAAAABkARQnAQ" height=150 alt='' />


## ✨ Features

G6, as a professional graph visualization engine, boasts the following features:
Expand All @@ -48,17 +44,12 @@ G6, as a professional graph visualization engine, boasts the following features:
- **Multi-Environment Rendering**: Harnessing the power of [G](https://github.com/antvis/g), it supports rendering in Canvas, SVG, and WebGL, as well as server-side rendering with Node.js; it also offers plugin packages that provide powerful 3D rendering and spatial interactions based on WebGL.
- **React Ecosystem**: By utilizing the React front-end ecosystem, it supports React nodes, significantly enriching the presentational styles of G6 nodes.


## 🔨 Getting Started

G6 is usually installed via a package manager such as npm or Yarn.

```bash
$ npm install @antv/g6@next
```

```bash
$ yarn add @antv/g6@next
$ npm install @antv/g6
```

The `Graph` object then can be imported from G6.
Expand All @@ -67,26 +58,28 @@ The `Graph` object then can be imported from G6.
<div id="container"></div>
```


```ts
import { Graph } from '@antv/g6';

// Get the Data.
const data = {
nodes: [/* your nodes data */],
edges: [/* your edges data */],
nodes: [
/* your nodes data */
],
edges: [
/* your edges data */
],
};

// Create the Graph instance.
const graph = new Graph({
container: 'container',
autoFit: 'view',
data,
node: {
palette: {
type: 'group',
field: 'cluster',
}
},
},
layout: {
type: 'force',
Expand All @@ -102,15 +95,13 @@ All goes well, you can get the following lovely graph!

<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ue4iTYurc6sAAAAAAAAAAAAADmJ7AQ/fmt.webp" height="300" />


## 🌍 Ecosystem

- **Ant Design Charts**: A React chart library based on G2, G6, X6, L7.
- **Graphin**: A simple React wrapper based on G6, as well as an SDK for developing graph visualization applications.

For more ecosystem open-source projects, contributions are welcome. Please feel free to submit a PR for inclusion.


## 📮 Contributing

- **Issue Reporting**: If you encounter any issues with G6 during use, please feel free to submit an issue, along with the minimal sample code that can reproduce the problem.
Expand Down
29 changes: 10 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

<img src="https://gw.alipayobjects.com/zos/antfincdn/R8sN%24GNdh6/language.svg" width="18"> [English](./README.en-US.md) | 简体中文

<h1 align="center">
<b>G6:图可视分析引擎</b>
</h1>

> G6 5.0 beta 版本已经发布,还有不少的细节体验问题,欢迎试用和反馈,线上产品暂时谨慎使用,6.6 发布正式版本!
![](https://user-images.githubusercontent.com/6113694/45008751-ea465300-b036-11e8-8e2a-166cbb338ce2.png)

[![npm Version](https://img.shields.io/npm/v/@antv/g6.svg)](https://www.npmjs.com/package/@antv/g6)
Expand Down Expand Up @@ -35,7 +32,6 @@

<img src="https://user-images.githubusercontent.com/6113694/44995293-02858600-afd5-11e8-840c-349e4730d63d.gif" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*I9OdTbXJIi0AAAAAAAAAAABkARQnAQ" height=150 alt='' /><img src="https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*xoufSYcjK2AAAAAAAAAAAABkARQnAQ" height=150 alt='' />


## ✨ 特性

G6 作为一款专业的图可视化引擎,具有以下特性:
Expand All @@ -48,17 +44,12 @@ G6 作为一款专业的图可视化引擎,具有以下特性:
- **多环境渲染**:发挥 [G](https://github.com/antvis/g) 能力, 支持 Canvas、SVG 以及 WebGL,和 Node.js 服务端渲染;基于 WebGL 提供强大 3D 渲染和空间交互的插件包。
- **React 体系**:利用 React 前端生态,支持 React 节点,大大丰富 G6 的节点呈现样式。


## 🔨 开始使用

可以通过 NPM 或 Yarn 等包管理器来安装。

```bash
$ npm install @antv/g6@next
```

```bash
$ yarn add @antv/g6@next
$ npm install @antv/g6
```

成功安装之后,可以通过 import 导入 `Graph` 对象。
Expand All @@ -72,20 +63,23 @@ import { Graph } from '@antv/g6';

// 准备数据
const data = {
nodes: [/* your nodes data */],
edges: [/* your edges data */],
nodes: [
/* your nodes data */
],
edges: [
/* your edges data */
],
};

// 初始化图表实例
const graph = new Graph({
container: 'container',
autoFit: 'view',
data,
node: {
palette: {
type: 'group',
field: 'cluster',
}
},
},
layout: {
type: 'force',
Expand All @@ -101,15 +95,13 @@ graph.render();

<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*ue4iTYurc6sAAAAAAAAAAAAADmJ7AQ/fmt.webp" height="300" />


## 🌍 生态

- **Ant Design Charts**: React 图表库,基于 G2、G6、X6、L7。
- **Graphin**:基于 G6 的 React 简单封装,以及图可视化应用研发的 SDK。
- **Ant Design Charts**: React 图表库,基于 G2、G6、X6、L7。
- **Graphin**:基于 G6 的 React 简单封装,以及图可视化应用研发的 SDK。

更多生态开源项目,欢迎 PR 收录进来。


## 📮 贡献

- **问题反馈**:使用过程遇到的 G6 的问题,欢迎提交 Issue,并附上可以复现问题的最小案例代码。
Expand All @@ -121,7 +113,6 @@ graph.render();
<img src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*yXJGSY8RC68AAAAAAAAAAAAADmJ7AQ/fmt.webp" height="256" />
</div>


## 📄 License

[MIT](./LICENSE).
78 changes: 78 additions & 0 deletions packages/g6-extension-3d/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
## 3D extension for G6

<img width="300" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*lEL3TrCLnPsAAAAAAAAAAAAADmJ7AQ/original" />
<img width="300" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*yFa5RKilu6kAAAAAAAAAAAAADmJ7AQ/original" />

This extension package provides 3D elements, behaviors and plugins for G6.

## Usage

1. Install

```bash
npm install @antv/g6-extension-3d
```

2. Import and Register

> Where renderer, elements and lighting are necessary
```js
import { ExtensionCategory, register } from '@antv/g6';
import { DragCanvas3D, Light, Line3D, Sphere, renderer } from '@antv/g6-extension-3d';

// 3d light plugin
register(ExtensionCategory.PLUGIN, '3d-light', Light);
// sphere node element
register(ExtensionCategory.NODE, 'sphere', Sphere);
// line edge element
register(ExtensionCategory.EDGE, 'line3d', Line3D);
// drag canvas in 3d scene
register(ExtensionCategory.BEHAVIOR, 'drag-canvas-3d', DragCanvas3D);
// camera setting plugin
register(ExtensionCategory.PLUGIN, 'camera-setting', CameraSetting);
```

3. Use

```js
import { Graph } from '@antv/g6';

const graph = new Graph({
container: 'container',
renderer, // use 3d renderer
data: {
// your data
},
node: {
type: 'sphere', // use sphere node
},
edge: {
type: 'line3d', // use 3d line edge
},
behaviors: ['drag-canvas-3d'],
plugins: [
// set camera configs, see: https://g.antv.antgroup.com/en/api/camera/intro
{
type: 'camera-setting',
projectionMode: 'perspective',
near: 0.1,
far: 1000,
fov: 45,
aspect: 1,
},
// add directional light
{
type: '3d-light',
directional: {
direction: [0, 0, 1],
},
},
],
});
```

## Resources

- [Lite Solar System](https://g6-next.antv.antgroup.com/en/examples/feature/default/#lite-solar-system)
- [3D Node](https://g6-next.antv.antgroup.com/en/examples/element/node/#3d-node)
5 changes: 3 additions & 2 deletions packages/g6-extension-3d/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@antv/g6-extension-3d",
"version": "0.1.1",
"description": "",
"description": "3D extension for G6",
"keywords": [
"antv",
"g6",
Expand All @@ -17,7 +17,8 @@
"src",
"esm",
"lib",
"dist"
"dist",
"README"
],
"scripts": {
"build": "run-p build:*",
Expand Down
87 changes: 87 additions & 0 deletions packages/g6-extension-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
## React extension for G6

<img width="500" src="https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*rWSiT6dnwfcAAAAAAAAAAAAADmJ7AQ/original" />

This extension allows you to define G6 node by React component and JSX syntax.

## Usage

1. Install

```bash
npm install @antv/g6-extension-react
```

2. Import and Register

```js
import { ExtensionCategory, register } from '@antv/g6';
import { ReactNode, GNode } from '@antv/g6-extension-react';

register(ExtensionCategory.NODE, 'react', ReactNode);
register(ExtensionCategory.NODE, 'g', GNode);
```

3. Define Node

React Node:

```jsx
const ReactNode = () => {
return <div>node</div>;
};
```

G Node:

```jsx
import { Group, Rect, Text } from '@antv/g6-extension-react';

const GNode = () => {
return <Group>
<Rect width={100} height={100}></Rect>
<Text text={"node"} />
<Group>
};
```

4. Use

Use ReactNode:

```jsx
const graph = new Graph({
// ... other options
node: {
type: 'react',
style: {
component: () => <GNode />,
},
},
});
```

Use GNode:

```jsx
const graph = new Graph({
// ... other options
node: {
type: 'g',
style: {
component: () => <ReactNode />,
},
},
});
```

## Q&A

1. Difference between ReactNode and GNode

ReactNode is a React component, while GNode support jsx syntax but can only use G tag node.

## Resources

- [React node](https://g6-next.antv.antgroup.com/examples/element/custom-node/#react-node)
- [G node with JSX syntax](https://g6-next.antv.antgroup.com/en/examples/element/custom-node/#react-g)
3 changes: 2 additions & 1 deletion packages/g6-extension-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"src",
"esm",
"lib",
"dist"
"dist",
"README"
],
"scripts": {
"build": "run-p build:*",
Expand Down
4 changes: 3 additions & 1 deletion packages/g6/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__tests__/**/*-actual.*
__tests__/**/*-actual.*

README.*
Loading

0 comments on commit 44222f9

Please sign in to comment.