|
|
|
@ -225,6 +225,28 @@ export default {
|
|
|
|
|
const seriesField = config.setting.find(item => item.optionField === 'seriesField')?.value
|
|
|
|
|
const seriesFieldList = [...new Set(data.map(item => item[seriesField]))]
|
|
|
|
|
option.series = []
|
|
|
|
|
const offsetArr = []
|
|
|
|
|
let index = 0
|
|
|
|
|
let barWidth = 10
|
|
|
|
|
if (seriesFieldList.length % 2 === 0) {
|
|
|
|
|
const length = seriesFieldList.length / 2
|
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
|
|
|
const offsetX = (parseInt('10%') + parseInt('50%')) * (2 * i + 1)
|
|
|
|
|
offsetArr.push(offsetX)
|
|
|
|
|
offsetArr.unshift(-offsetX)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const length = Math.ceil(seriesFieldList.length / 2)
|
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
|
|
|
if (i === 0) {
|
|
|
|
|
offsetArr.push(0)
|
|
|
|
|
} else {
|
|
|
|
|
const offsetX = (parseInt('20%') + parseInt('100%')) * i
|
|
|
|
|
offsetArr.push(offsetX)
|
|
|
|
|
offsetArr.unshift(-offsetX)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (const seriesFieldItem of seriesFieldList) {
|
|
|
|
|
const seriesData = (data.filter(item => item[seriesField] === seriesFieldItem))?.map(item => item[yField])
|
|
|
|
|
const seriesItem = [
|
|
|
|
@ -233,8 +255,8 @@ export default {
|
|
|
|
|
type: 'pictorialBar',
|
|
|
|
|
tooltip: { show: false },
|
|
|
|
|
symbol: 'diamond',
|
|
|
|
|
symbolSize: [30, 10],
|
|
|
|
|
symbolOffset: ['-60%', -5],
|
|
|
|
|
symbolSize: [barWidth, barWidth / 2],
|
|
|
|
|
symbolOffset: [offsetArr[index] + '%', -barWidth / 4],
|
|
|
|
|
symbolPosition: 'end',
|
|
|
|
|
z: 15,
|
|
|
|
|
zlevel: 2,
|
|
|
|
@ -245,7 +267,7 @@ export default {
|
|
|
|
|
name: seriesFieldItem,
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barGap: '20%',
|
|
|
|
|
barWidth: 30,
|
|
|
|
|
barWidth: barWidth,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
@ -276,8 +298,8 @@ export default {
|
|
|
|
|
type: 'pictorialBar',
|
|
|
|
|
tooltip: { show: false },
|
|
|
|
|
symbol: 'diamond',
|
|
|
|
|
symbolSize: [30, 10],
|
|
|
|
|
symbolOffset: ['-60%', 5],
|
|
|
|
|
symbolSize: [barWidth, barWidth / 2],
|
|
|
|
|
symbolOffset: [offsetArr[index] + '%', barWidth / 4],
|
|
|
|
|
zlevel: 2,
|
|
|
|
|
z: 15,
|
|
|
|
|
color: 'rgb(2, 192, 255)',
|
|
|
|
@ -291,7 +313,7 @@ export default {
|
|
|
|
|
barGap: '20%',
|
|
|
|
|
data: shadowData,
|
|
|
|
|
zlevel: 1,
|
|
|
|
|
barWidth: 30,
|
|
|
|
|
barWidth: barWidth,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
normal: {
|
|
|
|
|
color: 'rgba(9, 44, 76,.8)'
|
|
|
|
@ -303,8 +325,8 @@ export default {
|
|
|
|
|
type: 'pictorialBar',
|
|
|
|
|
tooltip: { show: false },
|
|
|
|
|
symbol: 'diamond',
|
|
|
|
|
symbolSize: [30, 10],
|
|
|
|
|
symbolOffset: ['-60%', -5],
|
|
|
|
|
symbolSize: [barWidth, barWidth / 2],
|
|
|
|
|
symbolOffset: [offsetArr[index] + '%', -barWidth / 4],
|
|
|
|
|
symbolPosition: 'end',
|
|
|
|
|
z: 15,
|
|
|
|
|
color: 'rgb(15, 69, 133)',
|
|
|
|
@ -312,6 +334,7 @@ export default {
|
|
|
|
|
data: shadowData
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
index++
|
|
|
|
|
option.series.push(...seriesItem)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|