|
@@ -98,7 +98,6 @@ export default {
|
|
|
this.setOptionsTop();
|
|
|
this.setOptionsTooltip();
|
|
|
this.setOptionsMargin();
|
|
|
- this.setOptionsLegend();
|
|
|
this.setOptionsColor();
|
|
|
this.setOptionsData();
|
|
|
},
|
|
@@ -236,7 +235,7 @@ export default {
|
|
|
show: true,
|
|
|
textStyle: {
|
|
|
color: optionsSetup.lineColor,
|
|
|
- fontSize: optionsSetup.tipFontSize
|
|
|
+ fontSize: optionsSetup.tipsFontSize
|
|
|
}
|
|
|
};
|
|
|
this.options.tooltip = tooltip;
|
|
@@ -253,42 +252,6 @@ export default {
|
|
|
};
|
|
|
this.options.grid = grid;
|
|
|
},
|
|
|
- // 图例操作 legend
|
|
|
- setOptionsLegend() {
|
|
|
- const optionsSetup = this.optionsSetup;
|
|
|
- const legend = this.options.legend;
|
|
|
- legend.show = optionsSetup.isShowLegend;
|
|
|
- legend.left = optionsSetup.lateralPosition;
|
|
|
- legend.right = optionsSetup.lateralPosition;
|
|
|
- legend.top = optionsSetup.longitudinalPosition;
|
|
|
- legend.bottom =
|
|
|
- optionsSetup.longitudinalPosition;
|
|
|
- legend.orient = optionsSetup.layoutFront;
|
|
|
- legend.textStyle = {
|
|
|
- color: optionsSetup.lengedColor,
|
|
|
- fontSize: optionsSetup.fontSize
|
|
|
- };
|
|
|
- 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() {
|
|
|
const optionsSetup = this.optionsSetup;
|
|
@@ -350,10 +313,6 @@ export default {
|
|
|
if (series[0].type == "bar") {
|
|
|
series[0].data = data;
|
|
|
}
|
|
|
- const legendName = [];
|
|
|
- legendName.push('销售量')
|
|
|
- this.options.legend['data'] = legendName;
|
|
|
- this.setOptionsLegendName(legendName);
|
|
|
},
|
|
|
// 动态数据
|
|
|
dynamicDataFn(val, refreshTime, optionsSetup) {
|
|
@@ -388,16 +347,12 @@ export default {
|
|
|
}
|
|
|
// series
|
|
|
const series = this.options.series;
|
|
|
- const legendName = [];
|
|
|
for (const i in series) {
|
|
|
if (series[i].type == "bar") {
|
|
|
series[i].name = val.series[i].name;
|
|
|
series[i].data = val.series[i].data;
|
|
|
}
|
|
|
- legendName.push(val.series[i].name);
|
|
|
}
|
|
|
- this.options.legend['data'] = legendName;
|
|
|
- this.setOptionsLegendName(legendName);
|
|
|
}
|
|
|
}
|
|
|
};
|