[Solved] Echart Error: Typeerror: axis Getaxesonzeroof is not a function

When using echart, it is clear that all parameters are passed in, but this. Is used in echart When init() initializes, it reports an error typeerror: axis Getaxesonzeroof is not a function. Through exclusion one by one, it is found that this error will occur when the data in the xaxis attribute is [].

Of course, my problem is not your problem, please analyze the specific problem!!!

My xaxis:

xAxis: {
    type: 'category',
    axisTick: {
      alignWithLabel: true
    },
    data: data
  }

Finally, my solution is:

if (this.data.length) {
  this.dom.setOption(option);
} else {
  this.dom.setOption({});   // Auto replace the first option
}

Read More: