import * as echarts from '../../ec-canvas/echarts';
var dataList = [];
var ymList=[],rateList=[];
Page({
data: {
ec: {
lazyLoad: true
},
},
onLoad: function (options) {
this.echartsComponnet = this.selectComponent('#mychart');
this.getData();
},
getData: function () {
wx.request({
url:'https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?tel=13366666666',
method: 'POST',
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => {
ymList[0] = '2019';
rateList[0] = 100;
ymList[1] = '2020';
rateList[1] = 130;
this.init_echarts();
}
});
},
init_echarts: function () {
this.echartsComponnet.init((canvas, width, height) => {
const Chart = echarts.init(canvas, null, {
width: width,
height: height
});
Chart.setOption(this.getOption());
return Chart;
});
},
getOption: function () {
var option = {
xAxis: {
type: 'category',
data: ymList
},
yAxis: {
type: 'value'
},
series: [{
data: rateList,
type: 'line'
}]
}
return option;
},
})
https://tcc.taobao.com
这个域名有加入到服务器域名吗?真机打开调试看下是否还是没有数据。