How does Mini Program use echarts-for-weixin, to obtain data dynamically? wx,request is asynchronous.

have you ever done it or not? the official demo is all dead data, and the dynamic acquisition of asynchronous data has not been able to get the value

.
Mar.16,2021

import * as echarts from'. /.. / ec-canvas/echarts';
var app = getApp ();
var demo = require ('. / jspackage/album.js');
var dataChange = new demo ();
let chart = null;
var demo2= {
/ / set background color
backgroundColor:'- sharpfff',
/ / set text style default word and line
textStyle: {

color: 'rgba(0, 0, 0, 1)'

},
/ / Color shade
visualMap: {

//  visualMap 
show: false,
//  80
min: 20,
//  600
max:365,
inRange: {
  //  0  1
  colorLightness: [0, 1]
}

},
/ / pie chart
series: [

{

  name: '',
  type: 'pie',
  //
  roseType: 'angle',
  radius: '55%',
  data: [
          { value: 30, name: '45545' },
          { value: 35, name: '' },
          { value: 40, name: '' },
          { value: 45, name: '' },
          {value: 50, name: ''}
    ],
    //emphasis hover 
    itemStyle: {
      emphasis: {
        shadowBlur: 20,
        shadowOffsetX: 0,
        // 
        shadowOffsetY: 0,
        // 
        shadowColor: 'rgba(0, 0, 0, 0.5)'
      },
      // 
      color: '-sharpc23531',
      // shadowBlur: 200,
      // shadowColor: 'rgba(0, 0, 0, 0.5)',

    },

}

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

width: width,
height: height

});
canvas.setChart (chart);

var option = demo2;
chart.setOption (option);
return chart;
}

Page ({
onShareAppMessage: function (res) {

)
return {
  title: 'ECharts ',
  path: '/pages/index/index',
  success: function () { },
  fail: function () { }
}

},

data: {

ec: {
  onInit: initChart
}

},
onLoad:function () {
},

onShow:function () {

// var messiones = app.globalData.messiones;
if (app.globalData.messiones!=null){
  var  dataArray=[];
  dataArray.splice(0);
  for (var pos in app.globalData.messiones) {
  //   console.log("hhh:"+app.globalData.messiones[pos].albumName);
  //  console.log(demo2.series[0].data[pos].name);
    var temp = {
      name: app.globalData.messiones[pos].albumName,
      value: app.globalData.messiones[pos].time
    }
    dataArray.push(temp);
  }
  demo2.series[0].data = dataArray;
  setTimeout(function () { 
    console.log(chart);
    chart.setOption(demo2);
  }, 2000);

}

}
})

Menu