# g2-react-saasche

> factory wrapper for g2

Latest version **1.2.1** (published 2017-06-20) · 0 weekly downloads

## Install

```sh
npm install g2-react-saasche
pnpm add g2-react-saasche
yarn add g2-react-saasche
bun add g2-react-saasche
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2017-06-20 |
| First published | 2017-06-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 364 |
| Author | jaredleechn@gmail.com |
| Maintainers | shenxiuqiang |
| Keywords | react, react-component, rc-g2, g2-react, g2 |

## Links

- npm: https://www.npmjs.com/package/g2-react-saasche
- Repository: https://github.com/antvis/g2-react
- Issues: https://github.com/antvis/g2-react/issues
- npm.io page: https://npm.io/package/g2-react-saasche

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.7

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2017-06-20

## 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(
  <Pie
    data={this.state.data}
    width={this.state.width}
    height={this.state.height}
    plotCfg={this.state.plotCfg}
    ref="myChart"
  />
);
```
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/)

<table class="table table-bordered table-striped">
  <thead>
    <tr>
        <th style="width: 100px;">name</th>
        <th style="width: 50px;">type</th>
        <th style="width: 100px;">default</th>
        <th>description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>width</td>
      <td>number.isRequired</td>
      <td></td>
      <td>width of chart</td>
    </tr>
    <tr>
      <td>height</td>
      <td>number.isRequired</td>
      <td></td>
      <td>height of chart</td>
    </tr>
    <tr>
      <td>plotCfg</td>
      <td>object</td>
      <td></td>
      <td>config of chart, margin, border, backgroud...</td>
    </tr>
    <tr>
      <td>data</td>
      <td>arrayOf(object).isRequired</td>
      <td></td>
      <td>data source</td>
    </tr>
    <tr>
      <td>forceFit</td>
      <td>bool</td>
      <td>false</td>
      <td>if the width of chart autoFit with parent</td>
    </tr>
  </tbody>
</table>


## 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.

---
_Source: https://npm.io/package/g2-react-saasche · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
