š The concise and progressive visualization grammar.
See the code English | ē®ä½äøę
G2 is named after Leland Wilkinsonās book The Grammar of Graphics and was profoundly inspired by it in the very beginning. Here are some resources you can begin with:
G2 is usually installed via a package manager such as npm or Yarn.
$ npm install @antv/g2
$ yarn add @antv/g2
The Chart object then can be imported from G2.
<div id="container"></div>
import { Chart } from '@antv/g2';
// A tabular data to be visualized.
const data = [
{ genre: 'Sports', sold: 275 },
{ genre: 'Strategy', sold: 115 },
{ genre: 'Action', sold: 120 },
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
];
// Instantiate a new chart.
const chart = new Chart({
container: 'container',
});
// Specify visualization.
chart.options({
// Create an interval mark and add it to the chart.
type: 'interval',
// Bind data for this mark.
data: data,
encode: {
// Assign genre column to x position channel.
x: 'genre',
// Assign sold column to y position channel.
y: 'sold',
// Assign genre column to color channel.
color: 'genre',
},
});
// Render visualization.
chart.render();
If all goes well, you can get the following lovely bar chart!
This project exists thanks to all the people who contribute.
And thank you to all our backers! š
Bairui Su, Zhiwei Wang, Zhifeng Lin, Xiaojuan Liao, Zihan Zhou, Minfeng Zhu, Wei Chen. G2: A customizable web-based framework for authoring interactive visualizations. Visual Informatics, 2026.
@article{su2026g2,
Ā author={BairuiĀ Su, ZhiweiĀ Wang, ZhifengĀ Lin, XiaojuanĀ Liao, ZihanĀ Zhou, MinfengĀ Zhu, WeiĀ Chen},
Ā title={G2: A customizable web-based framework for authoring interactive visualizations},
Ā journal={Visual Informatics},
Ā year={2026},
Ā url={https://doi.org/10.1016/j.visinf.2026.100307}
}
MIT@AntV.
Overall
Maintained
Code review
npm
Latest release
Releases this year
(top 24 of 44)
3,105 followers Ā· starred Aug 2026
1,121 followers Ā· starred Nov 2017
1,253 followers Ā· starred May 2019
1,952 followers Ā· starred Sep 2025
š The concise and progressive visualization grammar.
See the code English | ē®ä½äøę
G2 is named after Leland Wilkinsonās book The Grammar of Graphics and was profoundly inspired by it in the very beginning. Here are some resources you can begin with:
G2 is usually installed via a package manager such as npm or Yarn.
$ npm install @antv/g2
$ yarn add @antv/g2
The Chart object then can be imported from G2.
<div id="container"></div>
import { Chart } from '@antv/g2';
// A tabular data to be visualized.
const data = [
{ genre: 'Sports', sold: 275 },
{ genre: 'Strategy', sold: 115 },
{ genre: 'Action', sold: 120 },
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
];
// Instantiate a new chart.
const chart = new Chart({
container: 'container',
});
// Specify visualization.
chart.options({
// Create an interval mark and add it to the chart.
type: 'interval',
// Bind data for this mark.
data: data,
encode: {
// Assign genre column to x position channel.
x: 'genre',
// Assign sold column to y position channel.
y: 'sold',
// Assign genre column to color channel.
color: 'genre',
},
});
// Render visualization.
chart.render();
If all goes well, you can get the following lovely bar chart!
This project exists thanks to all the people who contribute.
And thank you to all our backers! š
Bairui Su, Zhiwei Wang, Zhifeng Lin, Xiaojuan Liao, Zihan Zhou, Minfeng Zhu, Wei Chen. G2: A customizable web-based framework for authoring interactive visualizations. Visual Informatics, 2026.
@article{su2026g2,
Ā author={BairuiĀ Su, ZhiweiĀ Wang, ZhifengĀ Lin, XiaojuanĀ Liao, ZihanĀ Zhou, MinfengĀ Zhu, WeiĀ Chen},
Ā title={G2: A customizable web-based framework for authoring interactive visualizations},
Ā journal={Visual Informatics},
Ā year={2026},
Ā url={https://doi.org/10.1016/j.visinf.2026.100307}
}
MIT@AntV.
Overall
Maintained
Code review
npm
Latest release
Releases this year
(top 24 of 44)
3,105 followers Ā· starred Aug 2026
1,121 followers Ā· starred Nov 2017
1,253 followers Ā· starred May 2019
1,952 followers Ā· starred Sep 2025