Skip to content
📊 A highly interactive data-driven visualization grammar for statistical charts.
TypeScript Other
Branch: master
Clone or download

Latest commit

zqlu fix: 图例应于å??标轴对é½? (#2488)
* fix: legend align with axis

* fix: prevent ts error
Latest commit f8262a2 May 22, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: add prettier check in CI (#2483) May 22, 2020
bin chore: 更新 API 生�命令,完全自动化 Apr 16, 2020
docs/manual Update scale.zh.md (#2473) May 20, 2020
examples chore: remove unnecessary file Apr 21, 2020
site chore: 网站首页通知更新 Feb 28, 2020
src fix: 图例应于å??标轴对é½? (#2488) May 22, 2020
tests fix: 图例应于å??标轴对é½? (#2488) May 22, 2020
.commitlintrc.js feat(changelog): add commit-msg and changelog generator Nov 27, 2019
.editorconfig feat(*): add ci Sep 3, 2019
.eslintrc feat(slider): add slider controller and component Feb 13, 2020
.gitignore chore: webpack 打包 Jan 13, 2020
.prettierrc feat(*): add ci Sep 3, 2019
CHANGELOG.md chore: release v4.0.8 (#2465) May 18, 2020
CONTRIBUTING.md docs: 更新 CONTRIBUTING 文档 Feb 25, 2020
CONTRIBUTING.zh-CN.md docs: 更新 CONTRIBUTING 文档 Feb 25, 2020
LICENSE feat(*): add ci Sep 3, 2019
README.md chore: æ›´æ–° README Feb 28, 2020
README.zh-CN.md chore: æ›´æ–° README Feb 28, 2020
gatsby-browser.js chore: æ›´æ–° lodash 全局挂载å?˜é‡?å?? Dec 27, 2019
gatsby-config.js chore: 更新文档和 demo Mar 18, 2020
package.json chore: add prettier check in CI (#2483) May 22, 2020
tsconfig.json chore: add sourcesContent to sourcemap Apr 22, 2020
tslint.json chore: 支� for 写法 Apr 9, 2020
typings.d.ts fix: typing missing Dec 24, 2019
webpack.config.js chore: webpack 打包 Jan 13, 2020

README.md

English | 简体中文

G2

A highly interactive data-driven visualization grammar for statistical charts.

CI Coverage Status NPM Package NPM Downloads Dependencies Percentage of issues still open PRs Welcome

Website • Tutorial • API Docs • Blog

G2 is a visualization grammar, a data-driven visual language with a high level of usability and scalability. It provides a set of grammars, takes users beyond a limited set of charts to an almost unlimited world of graphical forms. With G2, you can describe the visual appearance and interactive behavior of a visualization just by one statement, and generate web-based views using Canvas or SVG.

📺 Live Demos

✨ Features

  • 💯Stable grammar of graphics: enable to draw all kinds of charts by mapping data to graphics.
  • 🤩New grammar of interaction: interaction behaviors combined with Trigger and Action mechanisms are used to exploring data.
  • ðŸ¦?Advanced View module: with the ability to develop customized multi-dimension data analysis graphics.
  • 👬Dual-engine rendering: with the ability to switch Canvas and SVG freely.
  • 💄Visual components: interaction-oriented, elegant experience.
  • 🛡Fully embrace Typescript: Complete type definition files are provided.

📦 Installation

$ npm install @antv/g2

🔨 Getting Started

Before drawing we need to prepare a DOM container for G2:

<div id="c1"></div>
import { Chart } from '@antv/g2';

const data = [
  { genre: 'Sports', sold: 275 },
  { genre: 'Strategy', sold: 115 },
  { genre: 'Action', sold: 120 },
  { genre: 'Shooter', sold: 350 },
  { genre: 'Other', sold: 150 },
];

// Step 1: Create a Chart instance.
const chart = new Chart({
  container: 'c1', // Specify chart container ID
  width: 600, // Specify chart width
  height: 300, // Specify chart height
});

// Step 2: Load the data.
chart.data(data);

// Step 3: Declare the grammar of graphics, draw column chart.
chart.interval().position('genre*sold');

// Step 4: Render chart.
chart.render();

⌨� Development

# Install dependencies
$ npm install

# Run test cases
$ npm run test

# Open electron to run test cases and listen to file changes
$ npm run test-live

# Run CI
$ npm run ci

# Run website
$ npm start

�� Releases

� How to Contribute

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.

You can’t perform that action at this time.