fix: 修改 stat resize时 有时图形会不正确的问题

This commit is contained in:
zhangyu
2021-12-29 15:57:06 +08:00
parent fd1fb95510
commit e75f324604
2 changed files with 23 additions and 9 deletions

View File

@@ -41,7 +41,8 @@ export default {
show: false
},
svgDom: null,
spaceBetweenHexa: 3
spaceBetweenHexa: 3,
hexagonTimer: null
}
},
methods: {
@@ -376,9 +377,15 @@ export default {
})
},
resize () {
this.getLayout().then(layout => {
this.initHexagon(layout)
})
if (this.hexagonTimer) {
clearTimeout(this.hexagonTimer)
this.hexagonTimer = null
}
this.hexagonTimer = setTimeout(() => {
this.getLayout().then(layout => {
this.initHexagon(layout)
})
}, 50)
}
},
created () {

View File

@@ -32,7 +32,7 @@ import chartFormat from '@/components/chart/chartFormat'
import { getMetricTypeValue } from '@/components/common/js/tools'
import chartDataFormat from '@/components/charts/chartDataFormat'
import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
import {initColor} from "@/components/chart/chart/tools";
import { initColor } from '@/components/chart/chart/tools'
export default {
name: 'chart-stat',
@@ -42,7 +42,8 @@ export default {
statData: [],
boxWidth: 0,
boxHeight: 0,
boxPadding: 5
boxPadding: 5,
statTimer: null
}
},
methods: {
@@ -140,9 +141,15 @@ export default {
this.isInit = false
},
resize () {
this.getLayout().then(layout => {
this.renderStat(layout)
})
if (this.statTimer) {
clearTimeout(this.statTimer)
this.statTimer = null
}
this.statTimer = setTimeout(() => {
this.getLayout().then(layout => {
this.renderStat(layout)
})
}, 50)
}
},
mounted () {