在图表setOption后添加如下代码:
this.autoHeight = that.userNextCityData.length * 20; // counst.length为柱状图的条数,即数据长度。20为我给每个柱状图的高度。
myChart.getDom().style.height = this.autoHeight + "px";
myChart.getDom().childNodes[0].style.height = this.autoHeight + "px";
myChart.getDom().childNodes[0].childNodes[0].setAttribute("height",this.autoHeight);
myChart.getDom().childNodes[0].childNodes[0].style.height = this.autoHeight + "px";
myChart.resize();
作者:程序并非猿
链接:https://www.jianshu.com/p/41dbc8f9505a
网友评论