From 3d7dbbaa1acd5fd9ac4a1c960fd0dd5f244913b4 Mon Sep 17 00:00:00 2001 From: wisonic Date: Mon, 9 Sep 2024 21:59:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E5=9B=BE=E8=A1=A8):=20=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E9=87=8D=E5=A4=8D=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/components/ChartComponentG2Plot.vue | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue index 960bc6cae8..1fc3a988c5 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentG2Plot.vue @@ -233,24 +233,28 @@ const renderChart = async (view, callback?) => { } } let myChart = null +let g2Timer: number const renderG2Plot = async (chart, chartView: G2PlotChartView) => { - try { - myChart?.destroy() - myChart = await chartView.drawChart({ - chartObj: myChart, - container: containerId, - chart: chart, - scale: 1, - action, - quadrantDefaultBaseline - }) - myChart?.render() - if (linkageActiveHistory.value) { - linkageActive() + g2Timer && clearTimeout(g2Timer) + g2Timer = setTimeout(async () => { + try { + myChart?.destroy() + myChart = await chartView.drawChart({ + chartObj: myChart, + container: containerId, + chart: chart, + scale: 1, + action, + quadrantDefaultBaseline + }) + myChart?.render() + if (linkageActiveHistory.value) { + linkageActive() + } + } catch (e) { + console.error('renderG2Plot error', e) } - } catch (e) { - console.error('renderG2Plot error', e) - } + }, 300) } const dynamicAreaId = ref('')