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; iPP) {
dataModel ("XXXid",i)
}
since there are several similar diagrams, I came up with a method independently, but how do you spell this variable? None of the attempts I wrote above are correct