forked from github/dataease
refactor(图表): 减少重复渲染
This commit is contained in:
parent
9e735af86a
commit
3d7dbbaa1a
@ -233,24 +233,28 @@ const renderChart = async (view, callback?) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let myChart = null
|
let myChart = null
|
||||||
|
let g2Timer: number
|
||||||
const renderG2Plot = async (chart, chartView: G2PlotChartView<any, any>) => {
|
const renderG2Plot = async (chart, chartView: G2PlotChartView<any, any>) => {
|
||||||
try {
|
g2Timer && clearTimeout(g2Timer)
|
||||||
myChart?.destroy()
|
g2Timer = setTimeout(async () => {
|
||||||
myChart = await chartView.drawChart({
|
try {
|
||||||
chartObj: myChart,
|
myChart?.destroy()
|
||||||
container: containerId,
|
myChart = await chartView.drawChart({
|
||||||
chart: chart,
|
chartObj: myChart,
|
||||||
scale: 1,
|
container: containerId,
|
||||||
action,
|
chart: chart,
|
||||||
quadrantDefaultBaseline
|
scale: 1,
|
||||||
})
|
action,
|
||||||
myChart?.render()
|
quadrantDefaultBaseline
|
||||||
if (linkageActiveHistory.value) {
|
})
|
||||||
linkageActive()
|
myChart?.render()
|
||||||
|
if (linkageActiveHistory.value) {
|
||||||
|
linkageActive()
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('renderG2Plot error', e)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
}, 300)
|
||||||
console.error('renderG2Plot error', e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const dynamicAreaId = ref('')
|
const dynamicAreaId = ref('')
|
||||||
|
Loading…
Reference in New Issue
Block a user