# G2: The Grammar of Graphics in JavaScript
[![](https://img.shields.io/travis/antvis/g2.svg)](https://travis-ci.org/antvis/g2)
![](https://img.shields.io/badge/language-javascript-red.svg)
![](https://img.shields.io/badge/license-MIT-000000.svg)
[![NPM Package](https://img.shields.io/npm/v/@antv/g2.svg)](https://www.npmjs.com/package/@antv/g2)
[![NPM Downloads](http://img.shields.io/npm/dm/@antv/g2.svg)](https://npmjs.org/package/@antv/g2)
[![Percentage of issues still open](http://isitmaintained.com/badge/open/antvis/g2.svg)](http://isitmaintained.com/project/antvis/g2 "Percentage of issues still open")
[中文 README](./README.zh-CN.md)
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, users can describe the visual appearance of a visualization just by one statement.
**Special thanks to [Leland Wilkinson](https://en.wikipedia.org/wiki/Leland_Wilkinson), the author of [*The Grammar Of Graphics*](https://www.cs.uic.edu/~wilkinson/TheGrammarOfGraphics/GOG.html), whose book served as the foundation for G2.**
![](https://user-images.githubusercontent.com/6628666/68994104-1061b700-08ba-11ea-8017-3534fc85bc2f.jpeg)
## Installation
```bash
$ npm install @antv/g2
```
### Usage
```html
```
```js
import G2 from '@antv/g2';
const data = [
{ genre: 'Sports', sold: 275 },
{ genre: 'Strategy', sold: 1150 },
{ genre: 'Action', sold: 120 },
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
];
const chart = new G2.Chart({
container: 'c1',
width: 500,
height: 500
});
chart.source(data);
chart.interval().position('genre*sold').color('genre');
chart.render();
```
[More examples](https://antv.alipay.com/zh-cn/g2/3.x/demo/index.html)
## Development
```bash
$ npm install
# run test case
$ npm run test-live
# build watching file changes and run demos
$ npm run dev
# run demos
$ npm run demos
```
## How to Contribute
Please let us know how can we help. Do check out [issues](https://github.com/antvis/g2/issues) for bug reports or suggestions first.
To become a contributor, please follow our [contributing guide](https://github.com/antvis/g2/blob/master/CONTRIBUTING.md).
## Contributors
|[![](https://avatars1.githubusercontent.com/u/1655789?v=4)
leungwensen](https://github.com/leungwensen)
|[![](https://avatars3.githubusercontent.com/u/6628666?v=4)
simaQ](https://github.com/simaQ)
|[![](https://avatars1.githubusercontent.com/u/1264678?v=4)
dxq613](https://github.com/dxq613)
|[![](https://avatars3.githubusercontent.com/u/8325822?v=4)
elaine1234](https://github.com/elaine1234)
|[![](https://avatars0.githubusercontent.com/u/7098619?v=4)
guisturdy](https://github.com/guisturdy)
|[![](https://avatars3.githubusercontent.com/u/5888974?v=4)
paleface001](https://github.com/paleface001)
|
| :---: | :---: | :---: | :---: | :---: | :---: |
|[![](https://avatars0.githubusercontent.com/u/8186664?v=4)
chenshuai2144](https://github.com/chenshuai2144)
|[![](https://avatars3.githubusercontent.com/u/6111424?v=4)
xile611](https://github.com/xile611)
|[![](https://avatars3.githubusercontent.com/u/5591805?v=4)
maplor](https://github.com/maplor)
|[![](https://avatars3.githubusercontent.com/u/6560377?v=4)
zhfanrui](https://github.com/zhfanrui)
|[![](https://avatars2.githubusercontent.com/u/6942296?v=4)
Frezc](https://github.com/Frezc)
|[![](https://avatars1.githubusercontent.com/u/6812138?v=4)
Leannechn](https://github.com/Leannechn)
|
|[![](https://avatars2.githubusercontent.com/u/1451480?v=4)
janjakubnanista](https://github.com/janjakubnanista)
|[![](https://avatars1.githubusercontent.com/u/11624840?v=4)
ParryQiu](https://github.com/ParryQiu)
|[![](https://avatars3.githubusercontent.com/u/22516098?v=4)
Sai0514](https://github.com/Sai0514)
|[![](https://avatars0.githubusercontent.com/u/9816225?v=4)
liximomo](https://github.com/liximomo)
|[![](https://avatars1.githubusercontent.com/u/9054130?v=4)
wensen-lws](https://github.com/wensen-lws)
|[![](https://avatars1.githubusercontent.com/u/1011681?v=4)
xudafeng](https://github.com/xudafeng)
|
|[![](https://avatars1.githubusercontent.com/u/2370929?v=4)
wangyu-kelly](https://github.com/wangyu-kelly)
|[![](https://avatars0.githubusercontent.com/u/9314735?v=4)
BlackGanglion](https://github.com/BlackGanglion)
|[![](https://avatars3.githubusercontent.com/u/210810?v=4)
illumen](https://github.com/illumen)
|[![](https://avatars1.githubusercontent.com/u/827205?v=4)
DanielRuf](https://github.com/DanielRuf)
|[![](https://avatars2.githubusercontent.com/u/5518?v=4)
huacnlee](https://github.com/huacnlee)
|[![](https://avatars2.githubusercontent.com/u/13056641?v=4)
0nza1101](https://github.com/0nza1101)
|
[![](https://avatars2.githubusercontent.com/u/566097?v=4)
RaoHai](https://github.com/RaoHai)
|[![](https://avatars0.githubusercontent.com/u/8731922?v=4)
tbroadley](https://github.com/tbroadley)
|[![](https://avatars2.githubusercontent.com/u/1860329?v=4)
charleyw](https://github.com/charleyw)
|[![](https://avatars0.githubusercontent.com/u/21355783?v=4)
Hazyzh](https://github.com/Hazyzh)
|[![](https://avatars0.githubusercontent.com/u/6947976?v=4)
forbreak](https://github.com/forbreak)
|[![](https://avatars0.githubusercontent.com/u/4783781?v=4)
nekocode](https://github.com/nekocode)
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Jul 27 2019 14:06:08 GMT+0800`.