ReactEchart组件获取y轴坐标轴的最大值
首先得知道 echartInstance .getModel().getComponent(‘yAxis’).axis.scale._extent (可获取最小值和最大值)
实现 ref.current.updateEChartsOption().getModel().getComponent(‘yAxis’).axis.scale._extent[1]
- 明确目标 在组件中找到 echartsInstance
- 组件若要使用组件中的方法 必须要用到 ref 则绑定ref
-
其次看看 哪个方法可以返回 echartInstance
- 点入ReactEcharts组件中 找到里面的方法