G2Plot: a chart library built on G2 4.x, and what to check before adopting it
:dango: An interactive and responsive charting library based on G2.
At a glance
- What is it?
- G2Plot wraps G2 4.x in a set of opinionated chart classes. The README states plainly that no G2 v5 based G2Plot v3 is planned, so the main question for a new project is whether to start here or move to Ant Design Charts.
- Who is it for?
- Adopt G2Plot if you are on G2 4.x, want chart classes such as Bar and Line with a small option object, and can accept that the README points future work away from a G2 v5 based G2Plot v3. Do not adopt it for a greenfield project that expects to follow G2 v5, since the README directs that audience to Ant Design Charts instead.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 9 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 24, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What G2Plot solves, and who the README is written for
G2 is a grammar of graphics implementation: you describe marks, scales and coordinate systems, and the library draws them. That is flexible, and it is also a lot of configuration before a bar chart appears. G2Plot is a second wrapper over G2 4.x that ships named chart classes. The README describes the goal as letting users who are not visualization specialists produce clean charts, and as keeping those charts usable in real business scenarios. The intended reader is a front end developer who has a data array and a container element and wants a standard chart without learning the grammar underneath.
The trade is explicit. You give up the freedom of composing scales and marks by hand, and in return you get a chart type with defaults the project considers good. The README says the visual language and design rules were distilled from enterprise products, and that each chart type carries its own best configuration. That claim is not something this article can verify by running the library, but it is the design premise the whole API rests on. If your chart is unusual, the premise works against you: you will spend more time escaping the defaults than you would have spent writing G2 directly.
How the chart classes sit on top of G2 4.x
The architecture is a thin, opinionated layer. The README describes G2Plot as a second encapsulation based on G2 4.x, and package.json lists @antv/g2plot as the published name with main pointing at lib/index.js, module at esm/index.js and types at lib/index.d.ts. A chart is an object you construct with a container id and an options object, then call render() on. The options object is where the chart type's own conventions live: xField and yField name the columns to plot, seriesField names the column that splits the data into series.
Two features are worth separating from the marketing around them. The first is responsiveness. The README describes borrowing from forgiving design: when information density is too high, the chart thins out auxiliary information so the primary data stays readable. That is auto-hiding of labels and similar elements, not a layout engine. The second is layering. The README states that a layer concept allows multiple charts to be combined, overlaid and linked so they tell one data story. Both are real mechanisms, but neither is a substitute for choosing a chart type that fits the data.
Installing @antv/g2plot and drawing a first bar chart
The README gives the package name directly. Install it from npm:
npm install @antv/g2plotYou need a container element in the page. The README uses a div with the id container:
<div id="container"></div>Then import a chart class and construct it. The README's example is a Bar chart with a sales and year dataset, xField set to sales, yField set to year and seriesField set to year:
import { Bar } from '@antv/g2plot';
const data = [
{ year: '1951 年', sales: 38 },
{ year: '1952 年', sales: 52 },
{ year: '1956 年', sales: 61 },
{ year: '1957 年', sales: 145 },
{ year: '1958 年', sales: 48 },
];
const bar = new Bar('container', {
data,
xField: 'sales',
yField: 'year',
seriesField: 'year',
});
bar.render();After bar.render() runs, the chart is drawn into the container. The README's getting-started page is the place it points to for the next step, and the package files entry lists lib, esm, dist and src, so a bundler can pick the ESM build or the minified dist/g2plot.min.js referenced by the unpkg field.
The G2 v5 question the README answers itself
The most important line in the README is a notice, not a feature. It states that G2 v5 has been released, that no G2Plot v3 based on G2 v5 will be built in future, and that Ant Design Charts can be used instead. That is the project telling you where it stops. G2Plot 2.4.34 was published on 2025-09-15, and the last push to the repository was on 2026-09-21, so the code is not frozen in place, but the stated direction of the library is a boundary you should read before writing your first chart class.
The practical consequence is a version ceiling. If your application already standardises on G2 4.x, G2Plot matches it and the wrapper costs you nothing conceptually. If you are starting fresh and expect to follow G2 v5, the README itself points elsewhere, and adopting G2Plot means planning a migration you already know is coming. This is not a criticism of the code; it is the maintainers being clear about scope, which is more useful than silence.
Where G2Plot is the wrong tool
G2Plot is the wrong choice when the chart is the product rather than a report of the data. Anything that needs custom marks, unusual coordinate systems or a bespoke interaction model will fight the chart classes, because the classes exist precisely to remove that layer from your hands. The README frames the library around statistical charts in business scenarios, and that framing is the limit.
It is also the wrong choice when you need a component that fits a specific framework's rendering model. The README and the repository layout describe a framework agnostic library: you pass a container id and the library draws into it. There is no React component, no Angular directive and no Vue wrapper documented in the README. The related searches for g2plot react and g2plot angular reflect that gap, and the honest answer is that any framework integration is something you write yourself around the imperative constructor and render() call. If you want components that participate in a framework's lifecycle, that is a different package, not this one.
Ant Design Charts, G2 and the difference in approach
The README names Ant Design Charts as the replacement for the G2 v5 era. The difference is not cosmetic. Ant Design Charts is a React oriented chart library, so charts are components that live inside a React tree rather than objects you instantiate against a DOM id. If your application is React, that changes how data flows into the chart, how updates happen and how the chart unmounts. G2Plot's model is imperative: you hold a chart instance and call render().
The other alternative is G2 itself, at version 4.x or 5.x. Choosing G2 means choosing the grammar of graphics directly, with scales and marks you assemble yourself. That is more work for a standard bar chart and less work for a chart that does not fit any named type. The line between the two is straightforward: if a class in G2Plot matches your chart, the wrapper saves you configuration; if it does not, you are writing G2 anyway, with an extra layer in between.
Licence, maintenance and the cost of staying on 2.4.x
The repository is MIT licensed, which permits commercial use, modification and redistribution provided the copyright notice and permission notice are preserved. That is the standard permissive position, and it does not change because the wrapper sits on G2, which is a separate package with its own terms. This is a description of the licence text, not legal advice; if your organisation has rules about transitive dependencies, check the licences of the packages listed in dependencies rather than assuming they match.
The upgrade picture is the part to weigh. The release history moves in uneven steps: 2.4.31 on 2023-05-10, 2.4.32 on 2024-07-30, then 2.4.34 on 2025-09-15, while package.json in the repository carries version 2.4.35. The last push was on 2026-09-21. So the branch receives changes, but the intervals between published releases are long, and the README has already declared that the next major line will not exist. Budget for the version you install rather than for a stream of fixes, and treat any migration to Ant Design Charts or G2 v5 as a project of its own.
Editorial conclusion
Adopt G2Plot if you are on G2 4.x, want chart classes such as Bar and Line with a small option object, and can accept that the README points future work away from a G2 v5 based G2Plot v3. Do not adopt it for a greenfield project that expects to follow G2 v5, since the README directs that audience to Ant Design Charts instead. Before committing, read the getting-started page linked from the README, check the exported chart classes in the installed package for the chart you need, and confirm how your bundler resolves the main, module and unpkg entry points.
Frequently asked questions
What is G2Plot used for?
It is a statistical charting library for drawing standard business charts such as bars and lines from a data array, built as a second encapsulation over G2 4.x. The README describes the goal as letting people who are not visualization specialists produce clean charts with minimal configuration.
How do I install G2Plot?
The README gives the command npm install @antv/g2plot. The published package is named @antv/g2plot and its package.json points main at lib/index.js, module at esm/index.js and unpkg at dist/g2plot.min.js.
Does G2Plot work with React or Angular?
The README does not document a React component, an Angular directive or any other framework wrapper. The documented usage is framework agnostic: you supply a container element id, construct a chart class such as Bar, and call render().
Will there be a G2Plot v3 based on G2 v5?
No. The README states that G2 v5 has been released, that no G2Plot v3 will be built on top of it in future, and that Ant Design Charts can be used instead.
What licence does G2Plot use?
The repository is MIT licensed. That permits commercial use, modification and redistribution as long as the copyright notice and permission notice are kept, but the licence of each dependency in package.json is a separate question.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/antvis-g2plot)