Browse Source

优化图表配置,调整数据展示逻辑

master
parent
commit
fe443f5597
  1. 27
      src/views/Home/Index.vue

27
src/views/Home/Index.vue

@ -303,22 +303,28 @@ const barOptionsData = ref({
}, },
{ {
name: '执法记录', name: '执法记录',
type: 'bar', type: 'pictorialBar',
symbol: 'rect',
symbolPosition: 'end',
symbolSize: [20, 5],
symbolOffset: [-13, -1],
barWidth: 20, barWidth: 20,
stack: '执法记录', barGap: '-100% ',
barGap: '30%',
itemStyle: { itemStyle: {
color: 'rgba(64, 158, 255, 1)' color: 'rgba(64, 158, 255, 1)'
}, },
tooltip: { tooltip: {
show: false show: false
}, },
data: [1, 1, 1, 1, 1] data: []
}, },
{ {
name: '整改次数', name: '整改次数',
type: 'bar', type: 'pictorialBar',
stack: '整改次数', symbol: 'rect',
symbolPosition: 'end',
symbolSize: [20,5],
symbolOffset: [13, -1],
barWidth: 20, barWidth: 20,
itemStyle: { itemStyle: {
color: 'rgba(103, 194, 58, 1)' color: 'rgba(103, 194, 58, 1)'
@ -326,7 +332,7 @@ const barOptionsData = ref({
tooltip: { tooltip: {
show: false show: false
}, },
data: [1, 1, 1, 1, 1] data: []
} }
] ]
}) })
@ -354,7 +360,7 @@ const lineOptionsData = ref({
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data:[], data: [],
axisTick: { axisTick: {
show: false show: false
}, },
@ -518,12 +524,11 @@ const getS2Data = async () => {
} }
}) })
const axis = res.map((i) => i.realName) const axis = res.map((i) => i.realName)
const top = (res[0].inspectionCount % 10) / 10
barOptionsData.value.series[0].data = data1 barOptionsData.value.series[0].data = data1
barOptionsData.value.series[1].data = data2 barOptionsData.value.series[1].data = data2
barOptionsData.value.xAxis.data = axis barOptionsData.value.xAxis.data = axis
barOptionsData.value.series[2].data = new Array(axis.length).fill(top || 0.1) barOptionsData.value.series[2].data = data1
barOptionsData.value.series[3].data = new Array(axis.length).fill(top || 0.1) barOptionsData.value.series[3].data = data2
} }
// //

Loading…
Cancel
Save