Add File
This commit is contained in:
29
frontend/src/views/chat/component/BaseG2Chart.ts
Normal file
29
frontend/src/views/chat/component/BaseG2Chart.ts
Normal file
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user