关于javascript:001

  initChartTree(){

this.chartTree = this.$echarts.init(document.getElementById('chart-tree'))

let option = {}   // option外面的配置间接复制echarts树状图外面的即可
this.chartTree.setOption(option)
var temp = this.charrtTree
var container = document.getElementById('chart-tree')
this.chartTree.on('click',
function(params) {
  if (params.componentType === 'series') {
    if (!params.value) {
      var elesArr = Array.from(new Set(temp._chartsVIews[0]._data._graphicEls));
      var height = 300;
      var currentHeight = 10 * (elesArr.length - 1) || 10;
      var newHeight = Math.max(currentHeight, height);
      cotainer.style.height = newHeight + 'px';
      temp.resize()
    }
  }
}
},

mounted() {

  this.initChartTree();

}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理