Migrated repository
Go to file
Yuxin 98a213ab70
perf: simplify plugin registration; add comments and unit tests (#5352)
* perf: refactor register;add comments and unit tests

* fix: ci

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-01-17 18:59:21 +08:00
.github chore: merge 5.1 branch into v5 (#5345) 2024-01-15 15:20:30 +08:00
.husky chore: update project lint staged config (#5256) 2023-12-12 10:53:57 +08:00
.vscode fix: fix typos (#5219) 2023-12-04 20:46:28 +08:00
packages perf: simplify plugin registration; add comments and unit tests (#5352) 2024-01-17 18:59:21 +08:00
.commitlintrc.js refactor: remove unused files, and add husky and commitlint (#4383) 2023-03-23 20:43:53 +08:00
.editorconfig refactor: remove unused files, and add husky and commitlint (#4383) 2023-03-23 20:43:53 +08:00
.eslintignore chore: optimize project configs (#5299) 2023-12-28 11:05:09 +08:00
.eslintrc.js chore: optimize project configs (#5299) 2023-12-28 11:05:09 +08:00
.gitignore feat: api reference builder (#5347) 2024-01-17 09:28:57 +08:00
.prettierignore chore: optimize project configs (#5299) 2023-12-28 11:05:09 +08:00
.prettierrc.js chore: optimize project configs (#5299) 2023-12-28 11:05:09 +08:00
CHANGELOG.md fix: combo link point 2023-09-21 16:52:05 +08:00
LICENSE chore: commit history cleaning 2023-02-02 10:31:36 +08:00
package.json chore: merge 5.1 branch into v5 (#5345) 2024-01-15 15:20:30 +08:00
pnpm-workspace.yaml feat: add react-node for v5 (#5079) 2023-12-11 22:27:31 +08:00
README.en-US.md perf: simplify plugin registration; add comments and unit tests (#5352) 2024-01-17 18:59:21 +08:00
README.md perf: simplify plugin registration; add comments and unit tests (#5352) 2024-01-17 18:59:21 +08:00
tsconfig.json chore: optimize project configs (#5299) 2023-12-28 11:05:09 +08:00

G6: A Graph Visualization Framework in TypeScript

The 5.0 beta version is currently undergoing rapid iteration, with the stable release expected on June 6, 2024. There may be changes to the API during this period, so please exercise caution when using it in stable online product.

travis-ci codecov typescript MIT npm package NPM downloads Percentage of issues still open

中文 README

What is G6

G6 is a graph visualization engine, which provides a set of basic mechanisms, including rendering, layout, analysis, interaction, animation, and other auxiliary tools. G6 aims to simplify the relationships, and help people to obtain the insight of relational data.

Developers are able to build graph visualization analysis applications or graph visualization modeling applications easily.

Powerful Animation and Interactions

Powerful Layouts

Features (5.0 Alpha)

  • Extensionable: All the modules (seven types) are integrated as plugins;
  • Style and animation standards, supports level of details (see the graph below);
  • Beautiful Built-in Theme and cound be customized (see the graph below);
  • Layouts with Great Performance: More than 10 layout algorithms, supports GPU and Rust parallel computing, and custom layouts;
  • Steerable Interactions: More than 10 basic interaction behaviors ;
  • Friendly User Experience: Complete documents for different levels of user requirements. TypeScript supported.
  • Multiple renderers: Canvas, SVG, WebGL;
  • 3D Graph:

The gif is not fully loaded, Click Here to See the Original Image

3D Graph

The gif is not fully loaded, Click Here to See the Original Image

Animations and Level of Details

Built-in Themes and Custom Themes

Seven Types of Plugins

  • (TODO: migrate from v4) Abundant Built-in Items: Nodes and edges with free configurations;
  • (TODO: migrate from v4) Convenient Components: Outstanding ability and performance;

G6 concentrates on the principle of 'good by default'. In addition, the custom mechanism of the item, interaction behavior, and layout satisfies the customazation requirements.

Abundant Built-in Items

Installation (5.0 Alpha)

$ npm install @antv/g6@5.0.0-beta.28

Usage (5.0 Alpha)

The configuration specification of the graph can be refered to: https://github.com/antvis/G6/blob/v5/packages/g6/src/types/spec.ts

Graph API: 2b44df189d/packages/g6/src/types/graph.ts (L23)

A simple graph demo:

Edit compassionate-lalande-5lxm7

import { Graph } from "@antv/g6";

const data = {
  nodes: [
    {
      id: "node1",
      label: "Node 1",
      data: {
        x: 150,
        y: 150,
      },
    },
    {
      id: "node2",
      label: "Node 2",
      data: {
        x: 400,
        y: 150,
      },
    },
  ],
  edges: [
    {
      id: "edge1",
      label: "Edge 1",
      source: "node1",
      target: "node2",
      data: {},
    },
  ],
};

const graph = new Graph({
  container: "container",
  width: 500,
  height: 500,
  data,
  node: (innerModel) => ({
    ...innerModel,
    type: "circle",
    data: {
      ...innerModel.data,
      labelShape: {
        text: innerModel.label,
      },
      labelBackgroundShape: {},
      iconShape: {
        img: "https://gw.alipayobjects.com/zos/basement_prod/012bcf4f-423b-4922-8c24-32a89f8c41ce.svg",
      },
    },
  }),
  edge: (innerModel) => ({
    ...innerModel,
    type: "line",
    data: {
      labelShape: {
        text: innerModel.label,
      },
      labelBackgroundShape: {},
    },
  }),
});

Development (5.0 Alpha)

# install dependencies by pnpm in the root directory
$ pnpm install

# enter packages/g6
$ cd ./packages/g6

# build g6
$ npm run build

# start the integration demos
$ npm run dev

# run test case
$ npm run test

# run test case in watch mode
npm test -- --watch ./tests/unit/node-spec
DEBUG_MODE=1 npm test -- --watch ./tests/unit/node-spec

Documents (5.0 Alpha)

The documents will be ready after the 5.0 version being stable.

How to Contribute

Please let us know what you are you going to help. Do check out issues for bug reports or suggestions first.

License

MIT license.