NEZ-2591 fix:dashboard 漏斗图显示样式错误

This commit is contained in:
zyh
2023-02-24 14:23:02 +08:00
parent 2c0c06829c
commit f4af8ac0e1
2 changed files with 15 additions and 6 deletions

View File

@@ -107,16 +107,29 @@ export default {
this.$emit('chartIsNoData', this.isNoData)
},
drawChart (customAnimate) {
let funnelData = lodash.cloneDeep(this.funnelData)
const everyZeor = funnelData.every(item => item.value == 0)
// 判断值是否全部为0
if (everyZeor) {
funnelData = funnelData.map(item => {
return {
...item,
value: 100
}
})
} else {
funnelData = funnelData.filter(item => item.value !== 0)
}
this.$nextTick(() => {
const options = {
chart: {
width: '85%',
height: '85%',
bottomPinch: this.funnelData.length > 1 ? 1 : 0,
bottomPinch: funnelData.length > 1 ? 1 : 0,
customAnimate: customAnimate === true || this.isInit
},
block: {
dynamicHeight: true,
dynamicHeight: false,
highlight: true
},
label: {
@@ -136,7 +149,6 @@ export default {
}
const myChart = new D3Funnel(document.getElementById(`chart-canvas-${this.chartId}`))
const funnelData = lodash.cloneDeep(this.funnelData)
myChart.draw(funnelData, options)
setChart(this.chartId, myChart)
this.isInit = false

View File

@@ -127,9 +127,6 @@ export default {
return findItem ? findItem.value : 2
},
getData () {
if (!this.hasButton('panel_view')) {
return
}
let num = 0
this.showPanel.charts.forEach(item => {
item.id = ++num