The problem of obtaining data in vue that is not displayed by echart

the data of echarts is obtained through the background interface. I called the interface in created and initialized the chart in mounted. The result of the fan chart came out, but the legend legend on the right did not come out. The data I printed in mounted
I do not know whether the data cannot be rendered

because the data has not been successfully initialized yet.
Mar.11,2021

put ajax and initialization icons in mounted

mounted(){
      this.$axios.get(url).then(res => {
        this.initEcharts();
      });
    }

render


when the data comes back.

in theory, you should wait for the data to come back before rendering the chart. But if you look at your screenshot, now that the ring chart has come out, it means that the data has come back when rendering. I don't know how your legend is configured. If you want legend to be displayed, you need to set the data attribute. You need to obtain the value of this attribute from the returned data.

legend: {
    data: ["1", "2", ...] // 
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e93271-68ba5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e93271-68ba5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?