A React chart library, based on G2Plot
- Easy to use
- TypeScript
- Pretty & Lightweight
- Responsive
- Storytelling
$ npm install @ant-design/chartsimport React, { Component } from 'react';
import { Line } from '@ant-design/charts';
class Page extends Component {
render() {
const 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: 13 },
];
const config = {
data,
title: {
visible: true,
text: '带数据点的折线图',
},
xField: 'year',
yField: 'value',
};
return <Line {...config} />;
}
}
export default Page;import React from 'react';
import { Line } from '@ant-design/charts';
const Page: React.FC = () => {
const 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: 13 },
];
const config = {
data,
title: {
visible: true,
text: '带数据点的折线图',
},
xField: 'year',
yField: 'value',
};
return <Line {...config} />;
};
export default Page;result:
Direct G2Plot
Extra props:
| Property | Description | Type | defaultValue |
|---|---|---|---|
| chartRef | chart ref | (React.MutableRefObject<Line>)=> void | - |
| className | container class | string | - |
| style | container style | React.CSSProperties | - |
We welcome all contributions.
Charts is available under the License MIT.
- install nodejs
# 安装依赖
$ npm install
# 开发 library
$ npm run devOrdered by date of first contribution.
- 福晋
- 辟起 🍑
- 愚道
- 期贤 🙏
- 绯一
