返回排行榜

antvis/G

TypeScriptg.antv.antgroup.com

💥 A flexible rendering engine for visualization.

canvasvisualization2d-graphicsantvantviswebglwebgpu
Star 增长趋势
Star
1.2k
Forks
229
周增长
Issues
39
5001k
2017年11月2020年9月2023年8月2026年7月
制品库npmnpm install g
README

English | 简体中文

G

CI Coverage Status semantic-release: angular

TypeScript License

npm package npm downloads Percentage of issues still open PRs Welcome Ask DeepWiki

As the underlying rendering engine of AntV, G is dedicated to provide consistent and high performance 2D / 3D graphics rendering capabilities for upper layer products, adapting all underlying rendering APIs (Canvas2D / SVG / WebGL / WebGPU / CanvasKit / Node.js) on the web side. In particular, it provides GPGPU support for algorithms suitable for parallel computing in graph scenarios.

D3 force directed graph D3 barchart D3 sketchy barchart Yoga plugin Box2D physics engine plugin Rough.js plugin Canvaskit plugin Yoga plugin Canvaskit plugin 3D force directed graph

✨ Features

Easy-to-use API。The graphics and event system is compatible with DOM Element & Event API, and the animation system is compatible with Web Animations API, which can be adapted to the existing ecosystem of Web side such as D3, Hammer.js gesture library, etc. at a very low cost.

Support multiple rendering environments。Support Canvas2D / SVG / WebGL / WebGPU / CanvasKit and runtime switching, and also server-side rendering.

High performance rendering and computing。WebGPU-based GPGPU support for parallelizable algorithms. webgpu-graph is a library of graph analysis algorithms using GPU acceleration.

Extensible plug-in mechanism and rich set of plug-ins:

📦 Install

# Install Core
$ npm install @antv/g --save
# Canvas Renderer
$ npm install @antv/g-canvas --save
# SVG Renderer
$ npm install @antv/g-svg --save
# WebGL Renderer
$ npm install @antv/g-webgl --save

🔨 Usage

<div id="container"></div>
import { Circle, Canvas, CanvasEvent } from '@antv/g';
import { Renderer as CanvasRenderer } from '@antv/g-canvas';
// or
// import { Renderer as WebGLRenderer } from '@antv/g-webgl';
// import { Renderer as SVGRenderer } from '@antv/g-svg';

// create a canvas
const canvas = new Canvas({
    container: 'container',
    width: 500,
    height: 500,
    renderer: new CanvasRenderer(), // select a renderer
});

// create a circle
const circle = new Circle({
    style: {
        cx: 100,
        cy: 100,
        r: 50,
        fill: 'red',
        stroke: 'blue',
        lineWidth: 5,
    },
});

canvas.addEventListener(CanvasEvent.READY, function () {
    // append to canvas
    canvas.appendChild(circle);

    // add listener for `click` event
    circle.addEventListener('click', function () {
        this.style.fill = 'green';
    });
});

⌨️ Development

Start previewing demos:

git clone git@github.com:antvis/g.git
cd g
pnpm install
pnpm build
pnpm dev

API Spec

Start a dev-server on root dir, eg. http-server:

http-server -p 9090

Open api.html on localhost:9090/spec/api.html.

Run test cases

Build and run test cases:

pnpm build
pnpm test

Run demos

Preview our dev demos:

pnpm build
pnpm dev

Inspired by

Contributors


dengfuping


xiaoiver


dxq613


dependabot-preview[bot]


zhanba


afc163


limichange


entronad


hustcc


tangying1027


zengyue


simaQ


lessmost


visiky


lxfu1


ICMI


Deturium


Yanyan-Wang


yiiiiiiqianyao


moayuisuda


elaine1234


mxz96102


DrugsZ


baizn


terence55


tyr1dev


budlion


luoxupan


ikxin


Leannechn


dev-itsheng

This project follows the git-contributor spec, auto updated at Wed Jun 21 2023 13:21:24 GMT+0800.

相关仓库
excalidraw/excalidraw

Virtual whiteboard for sketching hand-drawn like diagrams

TypeScriptnpmMIT Licenseproductivitycollaboration
excalidraw.com
128.1k14.5k
mrdoob/three.js

JavaScript 3D Library.

JavaScriptnpmMIT Licensejavascript3d
threejs.org
113.9k36.4k
juliangarnier/anime

JavaScript animation engine

JavaScriptnpmMIT Licenseanimationanime
animejs.com
71.3k4.8k
chartjs/Chart.js

Simple HTML5 Charts using the <canvas> tag

JavaScriptnpmMIT Licensejavascriptchart
chartjs.org
67.6k11.9k
apache/echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser

TypeScriptnpmApache License 2.0echartsdata-visualization
echarts.apache.org
66.9k19.8k
tldraw/tldraw

Build infinite canvas apps in React with the tldraw SDK. World's best, top-most agent recommended #1 five star SDK.

TypeScriptnpmOtherdrawingsketch
tldraw.dev
49.1k3.4k
pixijs/pixijs

The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.

TypeScriptnpmMIT Licensecanvas2dpixijs
pixijs.com
47.8k5k
phaserjs/phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.

JavaScriptnpmMIT Licensephaserphaserjs
phaser.io
40k7.1k
rough-stuff/rough

Create graphics with a hand-drawn, sketchy, appearance

HTMLMIT Licensedrawcanvas
roughjs.com
21.1k664
liabru/matter-js

a 2D rigid body physics engine for the web ▲● ■

JavaScriptnpmMIT Licensephysicsjavascript
18.3k2k
dream-num/Luckysheet

Luckysheet upgraded to Univer

JavaScriptnpmMIT Licensespreadsheetjavascript
github.com/dream-num/univer/
16.7k2.6k
tradingview/lightweight-charts

Performant financial charts built with HTML5 canvas

TypeScriptnpmApache License 2.0financial-charting-librarycharting-library
tradingview.com/lightweight-charts/
16.6k2.5k