漏斗图重构

qianming 3 years ago
parent 4a24e621da
commit 444aeffafd

@ -56,7 +56,7 @@ export const widgetFunnel = {
name: 'fontSize', name: 'fontSize',
require: false, require: false,
placeholder: '', placeholder: '',
value: 12, value: 14,
}, },
{ {
type: 'vue-color', type: 'vue-color',
@ -80,14 +80,6 @@ export const widgetFunnel = {
], ],
value: 'normal' value: 'normal'
}, },
{
type: 'el-switch',
label: '反转',
name: 'reversal',
require: false,
placeholder: '',
value: 0
},
], ],
}, },
{ {
@ -198,7 +190,7 @@ export const widgetFunnel = {
{ {
type: 'el-input-number', type: 'el-input-number',
label: '字体大小', label: '字体大小',
name: 'fontSize', name: 'tipFontSize',
required: false, required: false,
placeholder: '', placeholder: '',
value: '' value: ''

@ -1,6 +1,6 @@
<template> <template>
<div :style="styleObj"> <div :style="styleObj">
<v-chart :options="options" autoresize /> <v-chart :options="options" autoresize/>
</div> </div>
</template> </template>
@ -27,8 +27,8 @@ export default {
formatter: "{a} <br/>{b} : {c}" formatter: "{a} <br/>{b} : {c}"
}, },
legend: { legend: {
x : 'center', x: 'center',
y : '92%', y: '92%',
textStyle: { textStyle: {
color: "#fff" color: "#fff"
} }
@ -43,11 +43,12 @@ export default {
sort: "descending", sort: "descending",
label: { label: {
normal: { normal: {
show: true,
position: 'inside', position: 'inside',
formatter: '{c}', formatter: '{c}',
textStyle: { textStyle: {
color: '#fff', color: '#fff',
fontSize:14, fontSize: 14,
} }
}, },
emphasis: { emphasis: {
@ -110,6 +111,7 @@ export default {
methods: { methods: {
// options // options
editorOptions() { editorOptions() {
this.setCending();
this.setOptionsText(); this.setOptionsText();
this.setOptionsTitle(); this.setOptionsTitle();
this.setOptionsTooltip(); this.setOptionsTooltip();
@ -117,23 +119,30 @@ export default {
this.setOptionsColor(); this.setOptionsColor();
this.setOptionsData(); this.setOptionsData();
}, },
//
setCending(){
const optionsSetup = this.optionsSetup;
const series = this.options.series;
if (optionsSetup.cending) {
series[0].sort = "ascending";
} else {
series[0].sort = "descending";
}
},
// //
setOptionsText() { setOptionsText() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const series = this.options.series; const normal = {
show: optionsSetup.isShow,
for (const key in series) { position: 'inside',
if (series[key].type == "funnel") { formatter: '{c}',
series[key].label.show = optionsSetup.isShow; textStyle: {
series[key].label.fontSize = optionsSetup.fontSize; color: optionsSetup.color,
series[key].label.color = optionsSetup.color; fontSize: optionsSetup.fontSize,
series[key].label.fontWeight = optionsSetup.fontWeight; fontWeight: optionsSetup.fontWeight,
series[key].sort = optionsSetup.reversal
? "ascending"
: "descending";
} }
} }
this.options.series[0].label['normal'] = normal;
}, },
// //
setOptionsTitle() { setOptionsTitle() {
@ -164,7 +173,7 @@ export default {
show: true, show: true,
textStyle: { textStyle: {
color: optionsSetup.lineColor, color: optionsSetup.lineColor,
fontSize: optionsSetup.fontSize fontSize: optionsSetup.tipFontSize
} }
}; };
this.options.tooltip = tooltip; this.options.tooltip = tooltip;
@ -182,7 +191,7 @@ export default {
legend.orient = optionsSetup.layoutFront; legend.orient = optionsSetup.layoutFront;
legend.textStyle = { legend.textStyle = {
color: optionsSetup.lengedColor, color: optionsSetup.lengedColor,
fontSize: optionsSetup.fontSize fontSize: optionsSetup.lengedFontSize
}; };
legend.itemWidth = optionsSetup.lengedWidth; legend.itemWidth = optionsSetup.lengedWidth;
}, },

Loading…
Cancel
Save