一、安装
npm install --save echarts-for-react
npm install --save echarts
`二、引用
import * as charts from 'echarts';
import ReactEcharts from 'echarts-for-react';
type EChartsOption = charts.EChartsOption;
三、使用
export default function Echart_1() {
const getOption = () => {
const option: EChartsOption = {
//........
//(echarts的 option中的代码)
//........
};
return option;
};
return(
<ReactEcharts
style={{ height: '280px', width: '360px' }}
option={getOption()}
/>
)
}