antvis/G2

矩形树图多层下钻点击报错(RangeError: Maximum call stack size exceeded) #3159

flym1013 posted onGitHub

实现矩形树图下钻功能,每次数据更新调用chart.changeData(val),但点击层级多了就报错,RangeError: Maximum call stack size exceeded(超过最大调用堆栈大小) 主要代码实现片段

watch: {
    data(val) {
      if (val.length) {
        this.$nextTick(() => {
          if(this.chart) {
            this.chart.changeData(val)
          } else {
            this.init()
          }
        })
      }
    },
    deep: true
  },
 methods: {
  init(val) {
   this.chart = new Chart({
          container: 'rectangleChartPlus',
          autoFit: true,
          padding: 'auto',
          height: 500,
        })
  this.chart.data(val)
  }
}

image


Fund this Issue

$0.00
Funded

Pull requests