Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/geallenboy/react-chart

基于g2plot封装react图表库
https://github.com/geallenboy/react-chart

g2 react

Last synced: 14 days ago
JSON representation

基于g2plot封装react图表库

Awesome Lists containing this project

README

        

## 安装

```bash
npm install @garron/react-chart
```

## 使用

```js
import { LineChart } from '@garron/react-chart';
```

## Examples

```tsx
import React, { useCallback } from 'react';
import { LineChart, ColumnChart, PieChart, BarChart } from '@garron/react-chart';

const config = {
height: 350,
autoFit: true,
xField: 'year',
yField: 'value',
smooth: true,
meta: {
value: {
max: 15
}
},
data: [
{ year: '1991', value: 3 },
{ year: '1992', value: 4 },
{ year: '1993', value: 3.5 },
{ year: '1994', value: 5 },
{ year: '1995', value: 4.9 },
{ year: '1996', value: 6 },
{ year: '1997', value: 7 },
{ year: '1998', value: 9 },
{ year: '1999', value: 11 }
]
};

const pieConfig = {
height: 350,
autoFit: true,
padding: 'auto',
radius: 1,
data: [
{
type: 'A',
value: 27
},
{
type: 'B',
value: 25
},
{
type: 'C',
value: 18
},
{
type: 'D',
value: 15
},
{
type: 'E',
value: 10
},
{
type: 'Others',
value: 5
}
],
angleField: 'value',
colorField: 'type',
label: {
visible: true,
type: 'inner'
},
legend: {
visible: false
}
};

export default () => {
return (







);
};
```