xmdong commented on issue #16912:
URL: https://github.com/apache/echarts/issues/16912#issuecomment-1111672755

   目前我的解决方法如下(使用react hooks)
   `const [legendHeight, setLegendHeight] = useState<number>(0);`
   
   `const onChartFinished = useCallback((a: any, instance: EChartsInstance) => {
         const legendModel = instance.getModel().getComponent("legend");
         const legendView = instance.getViewOfComponentModel(legendModel);
         const { height } = legendView.group.getBoundingRect();
         setLegendHeight(height);
       }, []);`
   
   `return (
         <ReactECharts
           style={{ height: `${legendHeight + 220}px`, width: "100%" }}
           option={option}
           onEvents={{
             finished: onChartFinished,
           }}
         />
       );`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to