How to set data values dynamically by echarts in Mini Program

this is the echarts code in my Mini Program. The page has obtained the data and written it to data through setData
clipboard.png

.

now I"d like to ask, how do I write the value in this teamname to the data in echarts?

function initChart(canvas, width, height) {
  const chart = echarts.init(canvas, null, {
    width: width,
    height: height
  });
  canvas.setChart(chart);

  var option = {
    radar: {
      indicator: [{
        text: "",
        max: 100
      },
      {
        text: "",
        max: 100
      },
      {
        text: "",
        max: 100
      },
      {
        text: "",
        max: 100
      },
      {
        text: "",
        max: 100
      }
      ],
      center: ["50%", "50%"],
      radius: "50%",
      startAngle: 90,
      splitNumber: 0,
      shape: "polygon",
      name: {
        formatter: "{value}",
        textStyle: {
          color: "-sharp72ACD1"
        }
      },
      splitArea: {
        areaStyle: {
          color: ["-sharpD3D3D3"]
        }
      },
      axisLine: {
        lineStyle: {
          color: "rgba(255, 255, 255, 0.4)"
        }
      }
    },
    series: [{
      type: "radar",
      data: [],
      itemStyle: {
        normal: {
          areaStyle: {
            type: "default",
            color: "-sharpEA6A69",
            opacity: 0.5
          }
        }
      },
    }]
  }
  chart.setOption(option);
  return chart;
}
Apr.01,2021

onLoad: function (options) {

this.barComponent = this.selectComponent('-sharpmychart-dom-bar');
this.init_bar(token);

}
init_bar: function (token) {

this.barComponent.init((canvas, width, height) => {
  const barChart = echarts.init(canvas, null, {
    width: width,
    height: height
  });
  wx.request({
    url: config.maintenance + 'GetRemainMoneyStatistics?token=' + token,
    method: "POST",
    dataType: "JSON",
    success: (res) => {
      var moneys = JSON.parse(res.data);
      var option = {
        backgroundColor: "-sharpffffff",
        color: ["-sharp37d6b7", "-sharpffc655"],
        legend: {
          x: 'right',
          y: 'center',
          orient: 'vertical',
          data: [{
            name: '',
            textStyle: {
              color: '-sharp666666'
            }
          },
          {
            name: '',
            textStyle: {
              color: '-sharp666666'
            }
          }]
        },
        graphic: {
          type: 'text',
          left: '30%',
          top: 'center',
          style: {
            text: '\n  10%',
            fill: '-sharp000',
          }
        },
        series: [{
          type: 'pie',
          center: ['36%', '50%'],
          radius: ['40%', '60%'],
          label: {
            normal: {
              show: true,
              formatter: "{b}\n({d}%)"
            },
          },
          labelLine: {
            normal: {
              show: true,
              length: 8,
              length2: 4,
            }
          },
          data: [{
            value: moneys.Current,
            name: '',
          }, {
              value: moneys.ValueAdded,
            name: ''
          }
          ],
        }]
      };
      barChart.setOption(option);
    }
  });   
  return barChart;
});

},


how did the landlord solve it? I also encountered


how to solve the problem


http://bestvayne.github.io/20.

finally, I refer to the official documents of Echart and Mini Program, and insert the obtained data into UI with chartOption method

.

can you give me a demo?

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