0
点赞
收藏
分享

微信扫一扫

react 使用 echarts

思考的鸿毛 2022-04-08 阅读 56
echartsreact

一、安装

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()}
     />
  )
}     
举报

相关推荐

0 条评论