xData() { let temp = []; let tempSum = []; let bottomlist = []; let bottomData2 = []; let beforeDataList = {}; let keyList = []; let sge = 0; let ghh = 0; // this.countbar.forEach((item,index) => { // let lang = []; // item.count.forEach((items,indexs) => { // if(indexs< item.count.length-1) { // lang.push(items.feeAmt);
// let sum = lang.reduce((sum, num) => {
// return sum + num;
// }, 0);
// if(indexs === 0){
// if(items.feeAmt<0){
// tempSum.push(0);
// } else{
// tempSum.push(items.feeAmt);
// }
// sge = items.feeAmt;
// } else if(indexs ===1) {
// if(items.feeAmt<0) {
// tempSum.push(sge);
// sge = sum;
// } else {
// tempSum.push(sum);
// ghh = sum;
// sge = sum;
// }
// } else {
// if(items.feeAmt<0) {
// tempSum.push(sge);
// sge = sum;
// } else {
// tempSum.push(sum);
// ghh = sum;
// sge = sum;
// }
// }
// }else {
// lang.push(items.feeAmt);
// }
// })
// });
this.countbar.forEach((item,index) => {
let lang = [];
item.count.forEach((items,indexs) => {
if(indexs< item.count.length-1) {
lang.push(items.feeAmt);
let sum = lang.reduce((sum, num) => {
return sum + num;
}, 0);
tempSum.push(sum);
bottomlist.push(sum);
}else {
lang.push(items.feeAmt);
}
})
})
this.countbar.forEach((item,index) => {
if(index === 0) {
item.count.forEach((items,indexs) => {
keyList.push(items);
})
} else {
item.count.forEach((items,indexs) => {
if(item.count.length === 1) {
keyList.push(items);
} else {
if(indexs !== 0) {
keyList.push(items);
}
}
})
}
})
keyList.forEach((item,index) => {
let objCount = {};
let coord = [];
let label = {};
let bottomData = [];
let bottomData1 = [];
let id = 0;
if (item.title === "result") {
// if(item.feeAmt<0) {
// coord.push(index, 0);
// } else {
coord.push(index, item.feeAmt);
// }
bottomData.push(0, item.feeAmt);
} else {
coord.push(index, tempSum[index]);
bottomData.push(
bottomlist[index - 1] === undefined
? 0
: bottomlist[index - 1],
bottomlist[index]
);
}
bottomData.forEach(item => {
bottomData1.push(item);
bottomData2 = bottomData.concat(
bottomData1
);
});
if (item.title === "result") {
this.differentData.push(
{
name: item.name,
value: bottomData2,
itemStyle: {
color: "#5ECAA1",
color0: "#5ECAA1",
borderColor: "#5ECAA1",
borderColor0: "#5ECAA1"
}
}
);
} else {
this.differentData.push(
bottomData2
);
}
// label.position = "top";
// // label.color = "#44464a";
// label.color = "#37456E";
// label.fontSize = 14;
// label.fontWeight = "bold";
if (item.feeAmt < 0) {
label.position = "bottom";
// label.position = "top";
// label.color = "red";
label.color = "#37456E";
// label.color = "#E40000";
label.fontSize = 14;
label.fontWeight = "bold";
} else {
label.position = "top";
// label.color = "#44464a";
label.color = "#37456E";
label.fontSize = 14;
label.fontWeight = "bold";
}
objCount["value"] = item.feeAmt;
objCount["coord"] = coord;
objCount["label"] = label;
this.differentList.push(
objCount
);
this.xAxis.push(item.feeType);
})
},