feat--柱状图数据设定增加是否显示百分比符号

qianming 12 months ago
parent 814e363043
commit 234ff615ba

@ -536,6 +536,14 @@ export const widgetBarStack = {
placeholder: '', placeholder: '',
value: false value: false
}, },
{
type: 'el-switch',
label: '百分比符号显示',
name: 'percentSign',
required: false,
placeholder: '',
value: false
},
{ {
type: 'el-input-number', type: 'el-input-number',
label: '字体字号', label: '字体字号',
@ -550,7 +558,7 @@ export const widgetBarStack = {
name: 'dataColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: ''
}, },
{ {
type: 'el-select', type: 'el-select',

@ -574,7 +574,7 @@ export const widgetBarchart = {
name: 'dataColor', name: 'dataColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#fff' value: ''
}, },
{ {
type: 'el-select', type: 'el-select',

@ -426,6 +426,14 @@ export const widgetGradientBarchart = {
placeholder: '', placeholder: '',
value: true value: true
}, },
{
type: 'el-switch',
label: '百分比符号显示',
name: 'percentSign',
required: false,
placeholder: '',
value: false
},
{ {
type: 'el-input-number', type: 'el-input-number',
label: '距离', label: '距离',
@ -538,7 +546,7 @@ export const widgetGradientBarchart = {
name: 'bar100color', name: 'bar100color',
required: false, required: false,
placeholder: '', placeholder: '',
value: 'rgba(0,77,167,1)' value: 'rgba(255, 69, 0, 1)'
}, },
{ {
type: 'vue-color', type: 'vue-color',

@ -369,6 +369,7 @@ export default {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.dataColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
formatter: !!optionsSetup.percentSign ? '{c}%' : '{c}'
}, },
// //
itemStyle: { itemStyle: {
@ -450,6 +451,7 @@ export default {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.dataColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
formatter: !!optionsSetup.percentSign ? '{c}%' : '{c}'
}, },
// //
itemStyle: { itemStyle: {

@ -392,10 +392,10 @@ export default {
}; };
} }
series[i].data = data; series[i].data = data;
this.options.legend["data"] = legendName;
this.setOptionsLegendName(legendName);
} }
} }
this.options.legend["data"] = legendName;
this.setOptionsLegendName(legendName);
}, },
// //
dynamicDataFn(refreshTime) { dynamicDataFn(refreshTime) {

@ -314,6 +314,7 @@ export default {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.dataColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
formatter: !!optionsSetup.percentSign ? '{c}%' : '{c}'
}; };
} else { } else {
series[0].label = { series[0].label = {
@ -323,6 +324,7 @@ export default {
fontSize: optionsSetup.fontSize, fontSize: optionsSetup.fontSize,
color: optionsSetup.dataColor, color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight, fontWeight: optionsSetup.fontWeight,
formatter: !!optionsSetup.percentSign ? '{c}%' : '{c}'
}; };
} }
series[0].barWidth = optionsSetup.maxWidth; series[0].barWidth = optionsSetup.maxWidth;
@ -360,7 +362,7 @@ export default {
let normal = {}; let normal = {};
if (optionsSetup.verticalShow) { if (optionsSetup.verticalShow) {
normal = { normal = {
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [ color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ {
offset: 0, offset: 0,
color: optionsSetup.bar0color, // 0% color: optionsSetup.bar0color, // 0%
@ -376,7 +378,7 @@ export default {
}; };
} else { } else {
normal = { normal = {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
{ {
offset: 0, offset: 0,
color: optionsSetup.bar0color, // 0% color: optionsSetup.bar0color, // 0%
@ -395,7 +397,6 @@ export default {
}, },
// //
setOptionsData(e, paramsConfig) { setOptionsData(e, paramsConfig) {
const optionsSetup = this.optionsSetup;
const optionsData = this.optionsData; // or const optionsData = this.optionsData; // or
// //
optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined optionsData.dynamicData = optionsData.dynamicData || {}; // dynamicData undefined

Loading…
Cancel
Save