data{

return{

successData1: [],

failData1: [],

dataTime1: {},

successData2: [],

failData2: [],

dataTime2: {},

successData3: [],

failData3: [],

dataTime3: {},

successData4: [],

failData4: [],

dataTime4: {}

}

}

let dataModel = (id, i) => {

let j=i+1

echarts.init(document.getElementById(id + i)).setOption({

tooltip: {

trigger: 'axis',

axisPointer: {

type: 'shadow'

}

},

legend: {

data: ['成功数', '失败数']

},

grid: {

left: '3%',

right: '4%',

bottom: '3%',

containLabel: true

},

yAxis: {

type: 'value'

},

xAxis: {

type: 'category',

data: this.dataTime+j[i]

},

series: [

{

name: '成功数',

type: 'bar',

stack: '总量',

label: {

normal: {

show: true,

position: 'insideRight'

}

},

data:this.'successData'+j[i]

},

{

name: '失败数',

type: 'bar',

stack: '总量',

label: {

normal: {

show: true,

position: 'insideRight'

}

},

data: `this.failData${j}[${i}]`

}

]

});

}

for (let i = 0; i < this.channelInfoSave.length; i++) {

dataModel ('XXXid',i)

}

由于有好几个类似的图,我就独立出来个方法,但是这个变量怎么拼呢?我上边写的尝试都不正确

Logo

前往低代码交流专区

更多推荐