hustcc / echarts-for-react

⛳️ Apache ECharts components for React wrapper. 一个简单的 Apache echarts 的 React 封装。
https://git.hust.cc/echarts-for-react
MIT License
4.51k stars 629 forks source link

react 5.1 增加了resize动画的功能,echarts-for-react v3.0.2 应该如何调用? #551

Open xwbxxx opened 1 year ago

xwbxxx commented 1 year ago

如图所示,react 5.1新增了resize动画的功能image

这是我的代码,我应该如何在echarts-for-react v3.0.2中调用这个新功能?

import React from 'react';
import '../element/App.css';
import ReactEcharts from "echarts-for-react";

export default function EchartPanel() {
    const bar = () => {
        const option = {
            // echart option
        };
        return option;
    }
    return (<div className={'EchartPanel'}>
         <ReactEcharts option={bar()}/>
    </div>);
}
fengluhome commented 11 months ago

const chartInst: any = chartRef?.current?.getEchartsInstance(); chartInst.resize({ width : 300 });