How to assign the data requested by axios to echarts pie chart

problem description

the environmental background of the problems and what methods you have tried

< template >
< div: class= "className": id= "id": style= "{height:height,width:width}" > < / div >
< / template >

< script >
import echarts from "echarts"
import resize from". / mixins/resize"

export default {

mixins: [resize],
props: {
  className: {
    type: String,
    default: "chart"
  },
  id: {
    type: String,
    default: "chart"
  },
  width: {
    type: String,
    default: "100%"
  },
  height: {
    type: String,
    default: "700px"
  },
  pieData: {
    type: Object,
    required: true
  }
},
data() {
  return {
    chart: null
  }
},
mounted() {
  this.initChart()
},
beforeDestroy() {
  if (!this.chart) {
    return
  }
  this.chart.dispose()
  this.chart = null
},
methods: {
  initChart() {
    this.chart = echarts.init(document.getElementById(this.id))

    this.chart.setOption({
      title: {
        text: this.pieData.title,
        textStyle: {
          fontWeight: "bold",
          fontSize: 24,
          color: "-sharp333333"
        },
        left: "center"
      },
      tooltip: {
        trigger: "item",
        formatter: "{b} : {c} ({d}%)",
        show: true,
        axisPointer: {
          lineStyle: {
            color: "-sharp57617B"
          }
        }
      },
      legend: {
        bottom: "0",
        itemWidth: 20,
        itemHeight: 10,
        itemGap: 10,
        data: this.pieData.legendData,
        left: "center",
        textStyle: {
          fontSize: 16,
          color: "-sharp333333"
        }
      },
      grid: {
        top: 20,
        left: "3%",
        right: "4%",
        bottom: "2%",
        containLabel: true
      },
      series: [{
        type: "pie",
        radius: this.pieData.radius,
        center: ["50%", "50%"],
        itemStyle: {
          // normal: {
          //   color: "rgb(137,189,27)",
          //   borderColor: "rgba(137,189,2,0.27)",
          //   borderWidth: 12
          // },
          emphasis: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: "rgba(0, 0, 0, 0.5)"
          }
        },
        data: this.pieData.seriesData
      }],
      color: this.pieData.color
    })
  }
}

}
< / script >

related codes

/ / Please paste the code text below (do not replace the code with pictures)
pieData: {

      title: "",
      radius: "70%",
      color: ["-sharpcd5c5c", "-sharpff7f50", "-sharp87cefa", "-sharpda70d6", "-sharp32cd32", "-sharp6495ed", "-sharpff69b4", "-sharpba55d3"],
      legendData: [""],
      seriesData: [{
        value: 1547,
        name: ""
      }]
    },
 axios:
 this.pieData.legendData = response.data.data.legendData
 this.pieData.seriesData = response.data.data.seriesData

what result do you expect? What is the error message actually seen?

console result value has been assigned, but the chart is immutable

Jul.01,2021

Hello, landlord! If you look at your code, there should be no dynamic listening for changes in the value of pieData . You should use watch to listen, and then re-execute this.chart.setOption (option);

.
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-1b2b635-2ba87.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-1b2b635-2ba87.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?