From 2bb8fd984fb5c9cdd484cffc18411f4b644b8fb3 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 7 Jul 2022 18:02:23 +0800 Subject: [PATCH] fix(g2plot): import all plots --- .../schema-component/antd/g2plot/G2Plot.tsx | 80 ++++++++++++++++++- 1 file changed, 76 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/g2plot/G2Plot.tsx b/packages/core/client/src/schema-component/antd/g2plot/G2Plot.tsx index 93ff1fafa..d58be137a 100644 --- a/packages/core/client/src/schema-component/antd/g2plot/G2Plot.tsx +++ b/packages/core/client/src/schema-component/antd/g2plot/G2Plot.tsx @@ -1,4 +1,40 @@ -import { Area, Bar, Column, Line, Pie } from '@antv/g2plot'; +import { + Area, + Bar, + BidirectionalBar, + Box, + Bullet, + Chord, + CirclePacking, + Column, + DualAxes, + Facet, + Funnel, + Gauge, + Heatmap, + Histogram, + Line, + Liquid, + Mix, + Pie, + Progress, + Radar, + RadialBar, + RingProgress, + Rose, + Sankey, + Scatter, + Stock, + Sunburst, + TinyArea, + TinyColumn, + TinyLine, + Treemap, + Venn, + Violin, + Waterfall, + WordCloud +} from '@antv/g2plot'; import { Field } from '@formily/core'; import { observer, useField } from '@formily/react'; import { Spin } from 'antd'; @@ -14,7 +50,43 @@ export type ReactG2PlotProps = { readonly config: O; }; -const plots = { Area, Column, Line, Pie, Bar }; +const plots = { + Line, + Area, + Column, + Bar, + Pie, + Rose, + WordCloud, + Scatter, + Radar, + DualAxes, + TinyLine, + TinyColumn, + TinyArea, + Histogram, + Progress, + RingProgress, + Heatmap, + Box, + Violin, + Venn, + Stock, + Funnel, + Liquid, + Bullet, + Sunburst, + Gauge, + Waterfall, + RadialBar, + BidirectionalBar, + Treemap, + Sankey, + Chord, + CirclePacking, + Mix, + Facet, +}; export const G2PlotRenderer = forwardRef(function (props: ReactG2PlotProps, ref: any) { const { className, plot, config } = props; @@ -69,7 +141,7 @@ export const G2Plot: any = observer((props: any) => { if (typeof fn === 'function') { const result = fn.bind({ api })(); if (result?.then) { - result.then(data => { + result.then((data) => { if (Array.isArray(data)) { field.componentProps.config.data = data; } @@ -81,7 +153,7 @@ export const G2Plot: any = observer((props: any) => { } else { field.data.loading = false; } - }, []) + }, []); if (!plot || !config) { return
{t('In configuration')}...
; }