ECharts 的 React 组件封装
https://git.hust.cc/echarts-for-react
安装
$ npm install echarts-for-react
使用
import React from 'react';
import ReactECharts from 'echarts-for-react';
const Page: React.FC = () => {
const options = {
grid: { top: 8, right: 8, bottom: 24, left: 36 },
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
},
yAxis: {
type: 'value',
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
smooth: true,
},
],
tooltip: {
trigger: 'axis',
},
};
return <ReactECharts option={options} />;
};
export default Page;
可在线编辑修改测试
需要配置合适的react版本





