MyGit

antvis/g2-react

Fork: 75 Star: 363 (更新于 2024-11-04 19:15:47)

license: 暂无

Language: JavaScript .

This repo is being deprecated, check Ant Design Charts https://github.com/ant-design/ant-design-charts

最后发布版本: 1.0.0 ( 2016-08-04 12:14:43)

GitHub网址

g2-react

Factory wrapper for using G2 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

NPM version npm download

Example

Install

$ npm install g2 --save
$ npm install g2-react --save

g2-react works with a peerDependencies of g2, you can specify the version of g2 in your package.json

Usage

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

Props

See detail api of g2

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

$ git clone git@github.com:antvis/g2-react.git
$ npm install
$ npm run doc

License

g2-react is released under the MIT license.

最近版本更新:(数据更新于 2024-09-18 07:56:50)

2016-08-04 12:14:43 1.0.0

主题(topics):

antv, antvis, chart, g2, react

antvis/g2-react同语言 JavaScript最近更新仓库

2024-11-22 16:46:00 meshery/meshery

2024-11-21 23:03:24 bia-pain-bache/BPB-Worker-Panel

2024-11-21 22:46:48 MHSanaei/3x-ui

2024-11-21 07:00:59 nodejs/node

2024-11-21 00:49:46 FortAwesome/Font-Awesome

2024-11-18 14:26:02 projectdiscovery/nuclei-templates