装饰图调整

qianming 3 years ago
parent 795200efd9
commit 8cd49a8083

@ -9,7 +9,7 @@
export const widgetDecoratePie = { export const widgetDecoratePie = {
code: 'widgetDecoratePieChart', code: 'widgetDecoratePieChart',
type: 'chart', type: 'chart',
label: '静态装饰饼图', label: '装饰饼图',
icon: 'iconicon_tubiao_bingtu', icon: 'iconicon_tubiao_bingtu',
options: { options: {
// 配置 // 配置
@ -20,7 +20,7 @@ export const widgetDecoratePie = {
name: 'layerName', name: 'layerName',
required: false, required: false,
placeholder: '', placeholder: '',
value: '装饰饼图', value: '静态装饰饼图',
}, },
{ {
type: 'vue-color', type: 'vue-color',
@ -140,7 +140,7 @@ export const widgetDecoratePie = {
name: 'outRingColor', name: 'outRingColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#28E8FA' value: '#0dc2fe'
}, },
{ {
type: 'el-input-number', type: 'el-input-number',
@ -188,7 +188,7 @@ export const widgetDecoratePie = {
name: 'outSplitColor', name: 'outSplitColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#28E8FA' value: '#0dc2fe'
}, },
{ {
type: 'el-switch', type: 'el-switch',
@ -228,7 +228,7 @@ export const widgetDecoratePie = {
name: 'outTickColor', name: 'outTickColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#28E8FA' value: '#0dc2fe'
}, },
] ]
}, },
@ -249,7 +249,7 @@ export const widgetDecoratePie = {
name: 'inRingColor', name: 'inRingColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#28E8FA' value: '#0dc2fe'
}, },
{ {
type: 'el-input-number', type: 'el-input-number',
@ -297,7 +297,7 @@ export const widgetDecoratePie = {
name: 'inSplitColor', name: 'inSplitColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#28E8FA' value: '#0dc2fe'
}, },
{ {
type: 'el-switch', type: 'el-switch',
@ -337,7 +337,70 @@ export const widgetDecoratePie = {
name: 'inTickColor', name: 'inTickColor',
required: false, required: false,
placeholder: '', placeholder: '',
value: '#28E8FA' value: '#0dc2fe'
},
]
},
{
name: '环外环设置',
list: [
{
type: 'el-switch',
label: '显示',
name: 'isRingOnRingShow',
required: false,
placeholder: '',
value: true
},
{
type: 'vue-color',
label: '颜色',
name: 'ringOnRingColor',
required: false,
placeholder: '',
value: '#4FADFD'
},
]
},
{
name: '中饼图设置',
list: [
{
type: 'el-input-number',
label: '半径',
name: 'pieWidth',
required: false,
placeholder: '',
value: 40
},
{
type: 'vue-color',
label: '颜色',
name: 'pieColor',
required: false,
placeholder: '',
value: '#0dc2fe'
},
{
type: 'vue-color',
label: '边框颜色',
name: 'pieBorderColor',
required: false,
placeholder: '',
value: '#3D4268'
},
{
type: 'el-select',
label: '分块',
name: 'pieBlocks',
required: false,
placeholder: '',
selectOptions: [
{code: 'four', name: '十字星'},
{code: 'five', name: '五角星'},
{code: 'six', name: '六芒星'},
],
value: 'six'
}, },
] ]
}, },

@ -104,6 +104,7 @@ export default {
radius: ['80%', '78%'], radius: ['80%', '78%'],
color: ["#fc8d89", "#46d3f3", "rgba(203,203,203,.2)"], color: ["#fc8d89", "#46d3f3", "rgba(203,203,203,.2)"],
startAngle: 50, startAngle: 50,
avoidLabelOverlap: true,
hoverAnimation: false, hoverAnimation: false,
label: { label: {
normal: { normal: {
@ -159,7 +160,6 @@ export default {
silent: true, silent: true,
radius: ['60%', '59%'], radius: ['60%', '59%'],
hoverAnimation: false, hoverAnimation: false,
data: [1],
label: { label: {
normal: { normal: {
show: false show: false
@ -170,17 +170,11 @@ export default {
show: false show: false
} }
}, },
itemStyle: {
normal: {
color: '#28E8FA',
show: false,
},
},
}, },
{ {
name: '中间环形图', name: '中间环形图',
type: 'pie', type: 'pie',
radius: ['35%', '55%'], radius: ['40%', '55%'],
avoidLabelOverlap: false, avoidLabelOverlap: false,
hoverAnimation: false, hoverAnimation: false,
itemStyle: { itemStyle: {
@ -258,6 +252,16 @@ export default {
this.setOptionsThreeRing(); this.setOptionsThreeRing();
this.setOptionsOutRing(); this.setOptionsOutRing();
this.setOptionsInRing(); this.setOptionsInRing();
this.setOptionsRingOnRing();
this.setOptionsPie();
},
//
setColor(color) {
const nullColor = 'rgba(0,0,0,0)'
if (color == "") {
color = nullColor
}
return color
}, },
// 1 // 1
setOptionsLastRing() { setOptionsLastRing() {
@ -268,24 +272,16 @@ export default {
} else { } else {
series.data = '' series.data = ''
} }
let lastRing0Color = optionsSetup.lastRing0Color;
let lastRing100Color = optionsSetup.lastRing100Color;
if (lastRing0Color == "") {
lastRing0Color = 'rgba(0,0,0,0)'
}
if (lastRing100Color == "") {
lastRing100Color = 'rgba(0,0,0,0)'
}
const normal = { const normal = {
color: { color: {
colorStops: [ colorStops: [
{ {
offset: 0, offset: 0,
color: lastRing0Color, color: this.setColor(optionsSetup.lastRing0Color),
}, },
{ {
offset: 1, offset: 1,
color: lastRing100Color, color: this.setColor(optionsSetup.lastRing100Color),
}, },
], ],
}, },
@ -294,10 +290,6 @@ export default {
}, },
setRingPie2() { setRingPie2() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
let eightColor = optionsSetup.eightColor;
if (eightColor == "") {
eightColor = 'rgba(0,0,0,0)';
}
let dataArr = []; let dataArr = [];
for (let i = 0; i < 8; i++) { for (let i = 0; i < 8; i++) {
if (i % 2 === 0) { if (i % 2 === 0) {
@ -306,7 +298,7 @@ export default {
value: 25, value: 25,
itemStyle: { itemStyle: {
normal: { normal: {
color: eightColor, color: this.setColor(optionsSetup.eightColor),
borderWidth: 0, borderWidth: 0,
borderColor: 'rgba(0,0,0,0)' borderColor: 'rgba(0,0,0,0)'
} }
@ -334,10 +326,6 @@ export default {
}, },
setRingPie3() { setRingPie3() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
let dottedColor = optionsSetup.dottedColor;
if (dottedColor == "") {
dottedColor = 'rgba(0,0,0,0)';
}
let dataArr = []; let dataArr = [];
for (let i = 0; i < (optionsSetup.dottedNum * 2); i++) { for (let i = 0; i < (optionsSetup.dottedNum * 2); i++) {
if (i % 2 === 0) { if (i % 2 === 0) {
@ -346,7 +334,7 @@ export default {
value: 25, value: 25,
itemStyle: { itemStyle: {
normal: { normal: {
color: dottedColor, color: this.setColor(optionsSetup.dottedColor),
borderWidth: 0, borderWidth: 0,
borderColor: 'rgba(0,0,0,0)' borderColor: 'rgba(0,0,0,0)'
} }
@ -359,8 +347,6 @@ export default {
itemStyle: { itemStyle: {
normal: { normal: {
color: 'rgba(0,0,0,0)', color: 'rgba(0,0,0,0)',
borderWidth: 0,
borderColor: "rgba(0,0,0,0)"
} }
} }
}) })
@ -376,62 +362,38 @@ export default {
// //
setOptionsThreeRing() { setOptionsThreeRing() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series[4];
let three1Color = optionsSetup.three1Color; series.color = [this.setColor(optionsSetup.three1Color), this.setColor(optionsSetup.three2Color), this.setColor(optionsSetup.three3Color)]
let three2Color = optionsSetup.three2Color;
let three3Color = optionsSetup.three3Color;
if (three1Color == "") {
three1Color = 'rgba(0,0,0,0)'
}
if (three2Color == "") {
three2Color = 'rgba(0,0,0,0)'
}
if (three3Color == "") {
three3Color = 'rgba(0,0,0,0)'
}
series[4].color = [three1Color, three2Color, three3Color]
}, },
// //
setOptionsOutRing() { setOptionsOutRing() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series;
let outRingColor = optionsSetup.outRingColor
if (outRingColor == "") {
outRingColor = 'rgba(0,0,0,0)';
}
const axisLine = { const axisLine = {
show: optionsSetup.isOutRingShow, show: optionsSetup.isOutRingShow,
lineStyle: { lineStyle: {
width: optionsSetup.outRingWidth, width: optionsSetup.outRingWidth,
shadowBlur: 0, shadowBlur: 0,
color: [ color: [
[1, outRingColor] [1, this.setColor(optionsSetup.outRingColor)]
] ]
} }
}; };
let outTickColor = optionsSetup.outTickColor
if (outTickColor == "") {
outTickColor = 'rgba(0,0,0,0)';
}
const axisTick = { const axisTick = {
show: optionsSetup.isOutTickShow, show: optionsSetup.isOutTickShow,
lineStyle: { lineStyle: {
color: outTickColor, color: this.setColor(optionsSetup.outTickColor),
width: optionsSetup.outTickWidth width: optionsSetup.outTickWidth
}, },
length: optionsSetup.outTickLength, length: optionsSetup.outTickLength,
splitNumber: optionsSetup.outTickWidth splitNumber: optionsSetup.outTickWidth
}; };
series[5].splitNumber = optionsSetup.outSplitNum series[5].splitNumber = optionsSetup.outSplitNum
let outSplitColor = optionsSetup.outSplitColor
if (outSplitColor == "") {
outSplitColor = 'rgba(0,0,0,0)'
}
const splitLine = { const splitLine = {
show: optionsSetup.isOutSplitShow, show: optionsSetup.isOutSplitShow,
length: optionsSetup.outSplitLength, length: optionsSetup.outSplitLength,
lineStyle: { lineStyle: {
color: outSplitColor, color: this.setColor(optionsSetup.outSplitColor),
width: optionsSetup.outSplitWidth, width: optionsSetup.outSplitWidth,
} }
}; };
@ -443,43 +405,31 @@ export default {
setOptionsInRing() { setOptionsInRing() {
const optionsSetup = this.optionsSetup; const optionsSetup = this.optionsSetup;
const series = this.options.series; const series = this.options.series;
let inRingColor = optionsSetup.inRingColor
if (inRingColor == "") {
inRingColor = 'rgba(0,0,0,0)'
}
const axisLine = { const axisLine = {
show: optionsSetup.isInRingShow, show: optionsSetup.isInRingShow,
lineStyle: { lineStyle: {
width: optionsSetup.inRingWidth, width: optionsSetup.inRingWidth,
shadowBlur: 0, shadowBlur: 0,
color: [ color: [
[1, inRingColor], [1, this.setColor(optionsSetup.inRingColor)],
], ],
}, },
}; };
let inTickColor = optionsSetup.inTickColor
if (inTickColor == "") {
inTickColor = 'rgba(0,0,0,0)'
}
const axisTick = { const axisTick = {
show: optionsSetup.isInTickShow, show: optionsSetup.isInTickShow,
lineStyle: { lineStyle: {
color: inTickColor, color: this.setColor(optionsSetup.inTickColor),
width: optionsSetup.inTickWidth, width: optionsSetup.inTickWidth,
}, },
length: optionsSetup.inTickLength, length: optionsSetup.inTickLength,
splitNumber: optionsSetup.inTickNum, splitNumber: optionsSetup.inTickNum,
}; };
series[6].splitNumber = optionsSetup.inSplitNum series[6].splitNumber = optionsSetup.inSplitNum
let inSplitColor = optionsSetup.inSplitColor
if (inSplitColor == "") {
inSplitColor = 'rgba(0,0,0,0)'
}
const splitLine = { const splitLine = {
show: optionsSetup.isInSplitShow, show: optionsSetup.isInSplitShow,
length: optionsSetup.inSplitLength, length: optionsSetup.inSplitLength,
lineStyle: { lineStyle: {
color: inSplitColor, color: this.setColor(optionsSetup.inSplitColor),
width: optionsSetup.inSplitWidth width: optionsSetup.inSplitWidth
} }
}; };
@ -487,6 +437,46 @@ export default {
series[6].axisTick = axisTick series[6].axisTick = axisTick
series[6].splitLine = splitLine series[6].splitLine = splitLine
}, },
//
setOptionsRingOnRing() {
const optionsSetup = this.optionsSetup;
const series = this.options.series[7];
if (optionsSetup.isRingOnRingShow) {
series.data = [0]
} else {
series.data = ''
}
const itemStyle = {
normal: {
color: this.setColor(optionsSetup.ringOnRingColor),
}
}
series.itemStyle = itemStyle
},
//
setOptionsPie() {
const optionsSetup = this.optionsSetup;
const series = this.options.series[8];
let width = optionsSetup.pieWidth
const pieWidth = width + "%"
series.radius = [pieWidth, '55%']
let pieBlocks = optionsSetup.pieBlocks
if (pieBlocks == "six") {
series.data = [25, 25, 25, 25, 25, 25]
} else if (pieBlocks == "five") {
series.data = [30, 30, 30, 30, 30]
} else {
series.data = [40, 40, 40, 40]
}
const itemStyle = {
normal: {
color: this.setColor(optionsSetup.pieColor),
borderColor: this.setColor(optionsSetup.pieBorderColor),
}
}
series.itemStyle = itemStyle
}
} }
} }
</script> </script>

Loading…
Cancel
Save