G2 is a visualization grammar for dashboards, exploration, and storytelling with declarative marks, scales, and interactions.
Overview
G2 is a web visualization grammar aimed at dashboards, data exploration, and narrative charts. It takes inspiration from Wilkinson’s grammar of graphics and composes charts from marks, transforms, scales, coordinates, and compositions instead of a fixed chart typology.
You declare options programmatically with a functional API, and the library infers sensible defaults so simple charts need little code. Complex cases allow deeper control, and extension points let you customize scales, transforms, marks, and related pieces.
Static views can be augmented with data-driven animation and interaction grammars. It installs via common JavaScript package managers; you import a Chart object and bind data to produce SVG, canvas, or WebGL output depending on your setup.
AntV maintains G2 alongside documentation, examples, tutorials, and an ecosystem of related visualization tools.
Key features
- Grammar of graphics composition
- Declarative chart configuration API
- Marks, scales, transforms, coordinates
- Data-driven animation support
- Action-based chart interactions
- Extensible scales and custom marks
- npm or Yarn installation
- Tutorial and example gallery
Use cases
- Interactive analytics dashboards
- Exploratory data visualization in web apps
- Custom chart types beyond templates
- Animated and interactive reports
- Embedded charts in JavaScript products