当后台数据过多时,条状图都凑在了一起每一条变得很窄
通过查看echarts的API发现 可以给实例设置高度
直接放代码
let length = projectName.length;
let myChart = this.reactEcharts.getEchartsInstance();
myChart.resize({ height: length * 100 + 100 });
<ReactEcharts
style={{ marginTop: 0, height: "320px" }}
option={this.handleReturnOption()}
notMerge
ref={(e) => {
this.reactEcharts = e;
}}
/>
通过后台获取的数据条数给它动态设置高度
myChart.resize({ height: length * 100 + 100 });
效果: