# g2-react **Repository Path**: mirrors_antvis/g2-react ## Basic Information - **Project Name**: g2-react - **Description**: This repo is being deprecated, check Ant Design Charts https://github.com/ant-design/ant-design-charts - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # g2-react Factory wrapper for using [G2](http://g2.alipay.com) easier in a React Component with dynamic `data` and `size` props *Note that `g2-react` is just a wrapper, if you want to make a better chart, `docs of G2` is [HERE](http://g2.alipay.com/)* [![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [npm-image]: http://img.shields.io/npm/v/g2-react.svg?style=flat-square [npm-url]: http://npmjs.org/package/g2-react [download-image]: https://img.shields.io/npm/dm/g2-react.svg?style=flat-square [download-url]: https://npmjs.org/package/g2-react ## Example - [online example](https://antvis.github.io/g2-react) - [local example](http://localhost:8989/) ## Install ```bash $ npm install g2 --save $ npm install g2-react --save ``` `g2-react` works with a [peerDependencies](https://nodejs.org/en/blog/npm/peer-dependencies/) of `g2`, you can specify the version of `g2` in your `package.json` ## Usage ```js import createG2 from 'g2-react'; import { Stat } from 'g2'; const Pie = createG2(chart => { chart.coord('theta'); chart.intervalStack().position(Stat.summary.proportion()).color('cut'); chart.render(); }); React.render( ); ``` Note that you can make a dynamic props wrap just like [higherWrapper demo](https://github.com/antvis/g2-react/blob/master/examples/higherWrapper.md) ## Props See detail api of [g2](http://g2.alipay.com/api/)
name type default description
width number.isRequired width of chart
height number.isRequired height of chart
plotCfg object config of chart, margin, border, backgroud...
data arrayOf(object).isRequired data source
forceFit bool false if the width of chart autoFit with parent
configs any as arguments of createG2((chart, configs))
## Development ```bash $ git clone git@github.com:antvis/g2-react.git $ npm install $ npm run doc ``` ## License g2-react is released under the MIT license.