|
|
@ -167,6 +167,7 @@ export default {
|
|
|
|
this.setOptionsX();
|
|
|
|
this.setOptionsX();
|
|
|
|
this.setOptionsY();
|
|
|
|
this.setOptionsY();
|
|
|
|
this.setOptionsTop();
|
|
|
|
this.setOptionsTop();
|
|
|
|
|
|
|
|
this.setOptionsLegend();
|
|
|
|
this.setOptionsMargin();
|
|
|
|
this.setOptionsMargin();
|
|
|
|
this.setOptionsColor();
|
|
|
|
this.setOptionsColor();
|
|
|
|
this.setOptionsData();
|
|
|
|
this.setOptionsData();
|
|
|
@ -323,11 +324,11 @@ export default {
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const legend = this.options.legend;
|
|
|
|
const legend = this.options.legend;
|
|
|
|
legend.show = optionsSetup.isShowLegend;
|
|
|
|
legend.show = optionsSetup.isShowLegend;
|
|
|
|
legend.left = optionsSetup.lateralPosition == "left" ? 0 : "auto";
|
|
|
|
legend.left = optionsSetup.lateralPosition;
|
|
|
|
legend.right = optionsSetup.lateralPosition == "right" ? 0 : "auto";
|
|
|
|
legend.right = optionsSetup.lateralPosition;
|
|
|
|
legend.top = optionsSetup.longitudinalPosition == "top" ? 0 : "auto";
|
|
|
|
legend.top = optionsSetup.longitudinalPosition;
|
|
|
|
legend.bottom =
|
|
|
|
legend.bottom =
|
|
|
|
optionsSetup.longitudinalPosition == "bottom" ? 0 : "auto";
|
|
|
|
optionsSetup.longitudinalPosition;
|
|
|
|
legend.orient = optionsSetup.layoutFront;
|
|
|
|
legend.orient = optionsSetup.layoutFront;
|
|
|
|
legend.textStyle = {
|
|
|
|
legend.textStyle = {
|
|
|
|
color: optionsSetup.lengedColor,
|
|
|
|
color: optionsSetup.lengedColor,
|
|
|
@ -335,6 +336,25 @@ export default {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
legend.itemWidth = optionsSetup.lengedWidth;
|
|
|
|
legend.itemWidth = optionsSetup.lengedWidth;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// 图例名称设置
|
|
|
|
|
|
|
|
setOptionsLegendName(name){
|
|
|
|
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
|
|
|
|
const series = this.options.series;
|
|
|
|
|
|
|
|
const legendName = optionsSetup.legendName;
|
|
|
|
|
|
|
|
// 图例没有手动写则显示原值,写了则显示新值
|
|
|
|
|
|
|
|
if (null == legendName || legendName == '') {
|
|
|
|
|
|
|
|
for (let i = 0; i < name.length; i++) {
|
|
|
|
|
|
|
|
series[i].name = name[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.options.legend['data'] = name;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
const arr = legendName.split('|');
|
|
|
|
|
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
|
|
|
|
|
series[i].name = arr[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.options.legend['data'] = arr
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
// 渐变色
|
|
|
|
// 渐变色
|
|
|
|
setOptionsColor() {
|
|
|
|
setOptionsColor() {
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
@ -416,6 +436,10 @@ export default {
|
|
|
|
if (series[0].type == "bar") {
|
|
|
|
if (series[0].type == "bar") {
|
|
|
|
series[0].data = data;
|
|
|
|
series[0].data = data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const legendName = [];
|
|
|
|
|
|
|
|
legendName.push('销售量')
|
|
|
|
|
|
|
|
this.options.legend['data'] = legendName;
|
|
|
|
|
|
|
|
this.setOptionsLegendName(legendName);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 动态数据
|
|
|
|
// 动态数据
|
|
|
|
dynamicDataFn(val, refreshTime, optionsSetup) {
|
|
|
|
dynamicDataFn(val, refreshTime, optionsSetup) {
|
|
|
@ -451,11 +475,16 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
// series
|
|
|
|
// series
|
|
|
|
const series = this.options.series;
|
|
|
|
const series = this.options.series;
|
|
|
|
|
|
|
|
const legendName = [];
|
|
|
|
for (const i in series) {
|
|
|
|
for (const i in series) {
|
|
|
|
if (series[i].type == "bar") {
|
|
|
|
if (series[i].type == "bar") {
|
|
|
|
|
|
|
|
series[i].name = val.series[i].name;
|
|
|
|
series[i].data = val.series[i].data;
|
|
|
|
series[i].data = val.series[i].data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
legendName.push(val.series[i].name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.options.legend['data'] = legendName;
|
|
|
|
|
|
|
|
this.setOptionsLegendName(legendName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|