From a05dde6c5209a988a4e9e2e1a3af5a0d006ec9ce Mon Sep 17 00:00:00 2001 From: inter Date: Mon, 8 Sep 2025 16:37:47 +0800 Subject: [PATCH] Add File --- .../src/views/chat/component/BaseG2Chart.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 frontend/src/views/chat/component/BaseG2Chart.ts diff --git a/frontend/src/views/chat/component/BaseG2Chart.ts b/frontend/src/views/chat/component/BaseG2Chart.ts new file mode 100644 index 0000000..3dfc43f --- /dev/null +++ b/frontend/src/views/chat/component/BaseG2Chart.ts @@ -0,0 +1,29 @@ +import { BaseChart } from '@/views/chat/component/BaseChart.ts' +import { Chart } from '@antv/g2' + +export abstract class BaseG2Chart extends BaseChart { + chart: Chart + + constructor(id: string, name: string) { + super(id, name) + this.chart = new Chart({ + container: id, + autoFit: true, + padding: 'auto', + }) + + this.chart.theme({ + view: { + viewFill: '#FFFFFF', + }, + }) + } + + render() { + this.chart?.render() + } + + destroy() { + this.chart?.destroy() + } +}