多柱线图动态数据调整

qianming 3 years ago
parent b36765fae4
commit 4a92396a31

@ -383,7 +383,6 @@ export default {
const legendName = optionsSetup.legendName; const legendName = optionsSetup.legendName;
if (legendName != null) { if (legendName != null) {
const arr = legendName.split("|"); const arr = legendName.split("|");
console.log(arr)
legend.data = arr; legend.data = arr;
} }
}, },
@ -500,13 +499,15 @@ export default {
renderingFn(val) { renderingFn(val) {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
this.options.xAxis.data = val.xAxis; this.options.xAxis.data = val.xAxis;
this.options.series = val.series; const series = [];
// this.options.series = val.series;
const legendName = []; const legendName = [];
for (const i in val.series) { for (const i in val.series) {
const obj = {};
if (val.series[i].type == "bar") { if (val.series[i].type == "bar") {
val.series[i].name = val.series[i].name; obj.name = val.series[i].name;
val.series[i].type = val.series[i].type; obj.type = val.series[i].type;
val.series[i].label = { obj.label = {
show: optionsSetup.isShowBar, show: optionsSetup.isShowBar,
position: "top", position: "top",
distance: optionsSetup.distanceBar, distance: optionsSetup.distanceBar,
@ -514,33 +515,34 @@ export default {
color: optionsSetup.subTextColorBar, color: optionsSetup.subTextColorBar,
fontWeight: optionsSetup.fontWeightBar fontWeight: optionsSetup.fontWeightBar
}; };
val.series[i].barWidth = optionsSetup.maxWidth; obj.barWidth = optionsSetup.maxWidth;
val.series[i].itemStyle = { obj.itemStyle = {
normal: { normal: {
barBorderRadius: optionsSetup.radius, barBorderRadius: optionsSetup.radius,
} }
}; };
val.series[i].data = val.series[i].data; obj.data = val.series[i].data;
series.push(obj);
} else if (val.series[i].type == "line") { } else if (val.series[i].type == "line") {
val.series[i].name = val.series[i].name; obj.name = val.series[i].name;
val.series[i].type = val.series[i].type; obj.type = val.series[i].type;
val.series[i].yAxisIndex = 1; obj.yAxisIndex = 1;
val.series[i].showSymbol = optionsSetup.markPoint; obj.showSymbol = optionsSetup.markPoint;
val.series[i].symbolSize = optionsSetup.pointSize; obj.symbolSize = optionsSetup.pointSize;
val.series[i].smooth = optionsSetup.smoothCurve; obj.smooth = optionsSetup.smoothCurve;
if (optionsSetup.area) { if (optionsSetup.area) {
val.series[i].areaStyle = { obj.areaStyle = {
opacity: optionsSetup.areaThickness / 100 opacity: optionsSetup.areaThickness / 100
}; };
} else { } else {
val.series[i].areaStyle = { obj.areaStyle = {
opacity: 0 opacity: 0
}; };
} }
val.series[i].lineStyle = { obj.lineStyle = {
width: optionsSetup.lineWidth width: optionsSetup.lineWidth
}; };
val.series[i].label = { obj.label = {
show: optionsSetup.isShowLine, show: optionsSetup.isShowLine,
position: "top", position: "top",
distance: optionsSetup.distanceLine, distance: optionsSetup.distanceLine,
@ -548,11 +550,13 @@ export default {
color: optionsSetup.subTextColorLine, color: optionsSetup.subTextColorLine,
fontWeight: optionsSetup.fontWeightLine fontWeight: optionsSetup.fontWeightLine
}; };
val.series[i].data = val.series[i].data; obj.data = val.series[i].data;
}; series.push(obj);
}
legendName.push(val.series[i].name); legendName.push(val.series[i].name);
}; }
this.options.legend["data"] = legendName; this.options.legend["data"] = legendName;
this.options.series = series;
} }
} }
}; };

Loading…
Cancel
Save