mirror of
https://gitee.com/anji-plus/report.git
synced 2026-04-01 10:08:36 +08:00
柱状图、折线图图例功能去除
This commit is contained in:
@@ -170,88 +170,6 @@ export const widgetBarchart = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '图例操作',
|
||||
list: [
|
||||
{
|
||||
type: 'el-switch',
|
||||
label: '图例显示',
|
||||
name: 'isShowLegend',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
type: 'el-input-text',
|
||||
label: '图例名称',
|
||||
name: 'legendName',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
type: 'vue-color',
|
||||
label: '字体颜色',
|
||||
name: 'lengedColor',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: '#fff',
|
||||
},
|
||||
{
|
||||
type: 'el-input-number',
|
||||
label: '字体字号',
|
||||
name: 'lengedFontSize',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: 12,
|
||||
},
|
||||
{
|
||||
type: 'el-input-number',
|
||||
label: '图例宽度',
|
||||
name: 'lengedWidth',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: 12,
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '横向位置',
|
||||
name: 'lateralPosition',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'center', name: '居中'},
|
||||
{code: 'left', name: '左对齐'},
|
||||
{code: 'right', name: '右对齐'},
|
||||
],
|
||||
value: 'center'
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '纵向位置',
|
||||
name: 'longitudinalPosition',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'top', name: '顶部'},
|
||||
{code: 'bottom', name: '底部'},
|
||||
],
|
||||
value: 'top'
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '布局前置',
|
||||
name: 'layoutFront',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'vertical', name: '竖排'},
|
||||
{code: 'horizontal', name: '横排'},
|
||||
],
|
||||
value: 'horizontal'
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'X轴设置',
|
||||
list: [
|
||||
@@ -519,9 +437,10 @@ export const widgetBarchart = {
|
||||
{
|
||||
type: 'el-input-number',
|
||||
label: '字体字号',
|
||||
name: 'tipFontSize',
|
||||
name: 'tipsFontSize',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: 16
|
||||
},
|
||||
{
|
||||
type: 'vue-color',
|
||||
|
||||
@@ -162,88 +162,6 @@ export const widgetGradientBarchart = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '图例操作',
|
||||
list: [
|
||||
{
|
||||
type: 'el-switch',
|
||||
label: '图例显示',
|
||||
name: 'isShowLegend',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
type: 'el-input-text',
|
||||
label: '图例名称',
|
||||
name: 'legendName',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
type: 'vue-color',
|
||||
label: '字体颜色',
|
||||
name: 'lengedColor',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: '#fff',
|
||||
},
|
||||
{
|
||||
type: 'el-input-number',
|
||||
label: '字体字号',
|
||||
name: 'lengedFontSize',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: 12,
|
||||
},
|
||||
{
|
||||
type: 'el-input-number',
|
||||
label: '图例宽度',
|
||||
name: 'lengedWidth',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: 12,
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '横向位置',
|
||||
name: 'lateralPosition',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'center', name: '居中'},
|
||||
{code: 'left', name: '左对齐'},
|
||||
{code: 'right', name: '右对齐'},
|
||||
],
|
||||
value: 'center'
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '纵向位置',
|
||||
name: 'longitudinalPosition',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'top', name: '顶部'},
|
||||
{code: 'bottom', name: '底部'},
|
||||
],
|
||||
value: 'top'
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '布局前置',
|
||||
name: 'layoutFront',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'vertical', name: '竖排'},
|
||||
{code: 'horizontal', name: '横排'},
|
||||
],
|
||||
value: 'horizontal'
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'X轴设置',
|
||||
list: [
|
||||
|
||||
@@ -186,88 +186,6 @@ export const widgetLinechart = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '图例操作',
|
||||
list: [
|
||||
{
|
||||
type: 'el-switch',
|
||||
label: '图例显示',
|
||||
name: 'isShowLegend',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
type: 'el-input-text',
|
||||
label: '图例名称',
|
||||
name: 'legendName',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
type: 'vue-color',
|
||||
label: '字体颜色',
|
||||
name: 'lengedColor',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: '#fff',
|
||||
},
|
||||
{
|
||||
type: 'el-input-number',
|
||||
label: '字体字号',
|
||||
name: 'lengedFontSize',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: 12,
|
||||
},
|
||||
{
|
||||
type: 'el-input-number',
|
||||
label: '图例宽度',
|
||||
name: 'lengedWidth',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: 12,
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '横向位置',
|
||||
name: 'lateralPosition',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'center', name: '居中'},
|
||||
{code: 'left', name: '左对齐'},
|
||||
{code: 'right', name: '右对齐'},
|
||||
],
|
||||
value: 'center'
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '纵向位置',
|
||||
name: 'longitudinalPosition',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'top', name: '顶部'},
|
||||
{code: 'bottom', name: '底部'},
|
||||
],
|
||||
value: 'top'
|
||||
},
|
||||
{
|
||||
type: 'el-select',
|
||||
label: '布局前置',
|
||||
name: 'layoutFront',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
selectOptions: [
|
||||
{code: 'vertical', name: '竖排'},
|
||||
{code: 'horizontal', name: '横排'},
|
||||
],
|
||||
value: 'horizontal'
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'X轴设置',
|
||||
list: [
|
||||
@@ -525,12 +443,12 @@ export const widgetLinechart = {
|
||||
name: '提示语设置',
|
||||
list: [
|
||||
{
|
||||
type: 'el-input-text',
|
||||
type: 'el-input-number',
|
||||
label: '字体大小',
|
||||
name: 'fontSize',
|
||||
name: 'tipsFontSize',
|
||||
required: false,
|
||||
placeholder: '',
|
||||
value: ''
|
||||
value: 16
|
||||
},
|
||||
{
|
||||
type: 'vue-color',
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -167,7 +167,6 @@ export default {
|
||||
this.setOptionsX();
|
||||
this.setOptionsY();
|
||||
this.setOptionsTop();
|
||||
this.setOptionsLegend();
|
||||
this.setOptionsMargin();
|
||||
this.setOptionsColor();
|
||||
this.setOptionsData();
|
||||
@@ -302,7 +301,7 @@ export default {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: optionsSetup.lineColor,
|
||||
fontSize: optionsSetup.fontSize
|
||||
fontSize: optionsSetup.tipsFontSize
|
||||
}
|
||||
};
|
||||
this.options.tooltip = tooltip;
|
||||
@@ -319,42 +318,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;
|
||||
@@ -436,10 +399,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) {
|
||||
@@ -475,16 +434,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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -105,7 +105,6 @@ export default {
|
||||
this.setOptionsTooltip();
|
||||
this.setOptionsData();
|
||||
this.setOptionsMargin();
|
||||
this.setOptionsLegend();
|
||||
this.setOptionsColor();
|
||||
},
|
||||
// 标题修改
|
||||
@@ -244,7 +243,7 @@ export default {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: optionsSetup.lineColor,
|
||||
fontSize: optionsSetup.fontSize
|
||||
fontSize: optionsSetup.tipsFontSize
|
||||
}
|
||||
};
|
||||
this.options.tooltip = tooltip;
|
||||
@@ -261,42 +260,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;
|
||||
@@ -332,10 +295,6 @@ export default {
|
||||
series[i].data = data;
|
||||
}
|
||||
}
|
||||
const legendName = [];
|
||||
legendName.push('销售量')
|
||||
this.options.legend['data'] = legendName;
|
||||
this.setOptionsLegendName(legendName);
|
||||
},
|
||||
dynamicDataFn(val, refreshTime) {
|
||||
if (!val) return;
|
||||
@@ -359,15 +318,11 @@ export default {
|
||||
this.options.xAxis.data = val.xAxis;
|
||||
// series
|
||||
const series = this.options.series;
|
||||
const legendName = [];
|
||||
for (const i in series) {
|
||||
if (series[i].type == "line") {
|
||||
series[i].data = val.series[i].data;
|
||||
}
|
||||
legendName.push(val.series[i].name);
|
||||
}
|
||||
this.options.legend['data'] = legendName;
|
||||
this.setOptionsLegendName(legendName);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user