饼图调整

qianming 3 years ago
parent 89e91d2a6f
commit 92147e81c8

@ -37,18 +37,26 @@ export const widgetDecoratePie = {
{ {
type: 'el-switch', type: 'el-switch',
label: '显示', label: '显示',
name: 'isShow', name: 'isLastRingShow',
required: false, required: false,
placeholder: '', placeholder: '',
value: true value: true
}, },
{ {
type: 'vue-color', type: 'vue-color',
label: '最外环颜色', label: '0%颜色',
name: 'ring1Color', name: 'lastRing0Color',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#46d3f3' value: '#4FADFD'
},
{
type: 'vue-color',
label: '100%颜色',
name: 'lastRing100Color',
required: false,
placeholder: '',
value: 'rgba(235, 10, 10, 1)'
}, },
] ]
}, },

@ -113,7 +113,7 @@ export const widgetPiePercentage = {
name: 'lineLength', name: 'lineLength',
required: false, required: false,
placeholder: '', placeholder: '',
value: 15 value: 19
}, },
{ {
type: 'el-input-number', type: 'el-input-number',
@ -121,7 +121,7 @@ export const widgetPiePercentage = {
name: 'lineWidth', name: 'lineWidth',
required: false, required: false,
placeholder: '', placeholder: '',
value: 5 value: 2
}, },
{ {
type: 'vue-color', type: 'vue-color',
@ -248,7 +248,7 @@ export const widgetPiePercentage = {
name: 'height', name: 'height',
required: false, required: false,
placeholder: '该容器在1080px大屏中的高度', placeholder: '该容器在1080px大屏中的高度',
value: 200, value: 300,
}, },
], ],
} }

@ -18,15 +18,10 @@ export default {
title: {}, title: {},
series: [ series: [
{ {
name: '外环1', name: '外环',
type: 'pie', type: 'pie',
zlevel: 1,
silent: true, silent: true,
radius: ['98%', '97%'], radius: ['98%', '97%'],
hoverAnimation: false,
color: "#46d3f3",
//color: "rgba(88,142,197,0.5)",
// animation:false, //charts3 no
label: { label: {
normal: { normal: {
show: false show: false
@ -37,7 +32,23 @@ export default {
show: false show: false
} }
}, },
data: [1] itemStyle: {
normal: {
color: {
colorStops: [
{
offset: 0,
color: '#4FADFD', // 0%
},
{
offset: 1,
color: 'rgba(235, 10, 10, 1)', // 100%
},
],
},
},
},
data: [0]
}, },
{ {
type: 'pie', type: 'pie',
@ -303,7 +314,7 @@ export default {
methods: { methods: {
pie2() { pie2() {
let dataArr = []; let dataArr = [];
for (var i = 0; i < 8; i++) { for (let i = 0; i < 8; i++) {
if (i % 2 === 0) { if (i % 2 === 0) {
dataArr.push({ dataArr.push({
name: (i + 1).toString(), name: (i + 1).toString(),
@ -329,13 +340,12 @@ export default {
} }
}) })
} }
} }
return dataArr return dataArr
}, },
pie3() { pie3() {
let dataArr = []; let dataArr = [];
for (var i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
if (i % 2 === 0) { if (i % 2 === 0) {
dataArr.push({ dataArr.push({
name: (i + 1).toString(), name: (i + 1).toString(),
@ -361,34 +371,59 @@ export default {
} }
}) })
} }
} }
return dataArr return dataArr
}, },
editorOptions() { editorOptions() {
this.setOptionsLastRing();
//this.setOptionsTitle(); //this.setOptionsTitle();
}, },
// // 1
setOptionsTitle() { setOptionsLastRing() {
const optionsCollapse = this.optionsSetup; const optionsSetup = this.optionsSetup;
const title = {}; const series = this.options.series[0];
title.text = optionsCollapse.titleText; if (optionsSetup.isLastRingShow) {
title.show = optionsCollapse.isNoTitle; series.data = [0]
title.left = optionsCollapse.textAlign; }else {
title.textStyle = { series.data = ''
color: optionsCollapse.textColor, }
fontSize: optionsCollapse.textFontSize, const normal = {
fontWeight: optionsCollapse.textFontWeight color: {
}; colorStops: [
title.subtext = optionsCollapse.subText; {
title.subtextStyle = { offset: 0,
color: optionsCollapse.subTextColor, color: optionsSetup.lastRing0Color,
fontWeight: optionsCollapse.subTextFontWeight, },
fontSize: optionsCollapse.subTextFontSize {
offset: 1,
color: optionsSetup.lastRing100Color,
},
],
},
}; };
this.options.title = title; series.itemStyle['normal'] = normal;
}, },
} //
setOptionsTitle() {
const optionsCollapse = this.optionsSetup;
const title = {};
title.text = optionsCollapse.titleText;
title.show = optionsCollapse.isNoTitle;
title.left = optionsCollapse.textAlign;
title.textStyle = {
color: optionsCollapse.textColor,
fontSize: optionsCollapse.textFontSize,
fontWeight: optionsCollapse.textFontWeight
};
title.subtext = optionsCollapse.subText;
title.subtextStyle = {
color: optionsCollapse.subTextColor,
fontWeight: optionsCollapse.subTextFontWeight,
fontSize: optionsCollapse.subTextFontSize
};
this.options.title = title;
},
}
} }
</script> </script>

@ -361,20 +361,20 @@ export default {
this.setOptionSurplusColor(); this.setOptionSurplusColor();
}, },
setOptionsTitle() { setOptionsTitle() {
const optionsCollapse = this.optionsSetup; const optionsSetup = this.optionsSetup;
const title = this.options.title; const title = this.options.title;
title.x = "center"; title.x = "center";
title.y = "center"; title.y = "center";
const rich = { const rich = {
nums: { nums: {
fontSize: optionsCollapse.textNumFontSize, fontSize: optionsSetup.textNumFontSize,
color: optionsCollapse.textNumColor, color: optionsSetup.textNumColor,
fontWeight: optionsCollapse.textNumFontWeight fontWeight: optionsSetup.textNumFontWeight
}, },
percent: { percent: {
fontSize: optionsCollapse.textPerFontSize, fontSize: optionsSetup.textPerFontSize,
color: optionsCollapse.textPerColor, color: optionsSetup.textPerColor,
fontWeight: optionsCollapse.textPerFontWeight fontWeight: optionsSetup.textPerFontWeight
} }
}; };
title.textStyle['rich'] = rich; title.textStyle['rich'] = rich;

Loading…
Cancel
Save