From e420c22a45791897c44963c45ce30695958c9a92 Mon Sep 17 00:00:00 2001 From: jialin Date: Mon, 8 Jun 2026 11:40:53 +0800 Subject: [PATCH] fix(style): bar chart legend gap --- src/pages/_components/bar-chart/index.tsx | 13 +++++++++++-- src/pages/usage/components/daily-usage.tsx | 3 +++ src/pages/usage/components/summary-tab.tsx | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/pages/_components/bar-chart/index.tsx b/src/pages/_components/bar-chart/index.tsx index 5e08c73d..80473fd3 100644 --- a/src/pages/_components/bar-chart/index.tsx +++ b/src/pages/_components/bar-chart/index.tsx @@ -21,6 +21,13 @@ export interface BarChartProps { labelFormatter?: (val: any, index?: number) => string; tooltipValueFormatter?: (val: any) => string; title?: string; + grid?: { + left?: number | string; + right?: number | string; + top?: number | string; + bottom?: number | string; + containLabel?: boolean; + }; legendIsolate?: boolean; } @@ -34,6 +41,7 @@ const BarChart: React.FC = (props) => { labelFormatter, tooltipValueFormatter, title, + grid, legendIsolate } = props; const { token } = theme.useToken(); @@ -126,8 +134,9 @@ const BarChart: React.FC = (props) => { left: 0, right: 0, top: title ? 30 : 10, - bottom: 0, - containLabel: true + bottom: 8, + containLabel: true, + ...grid }, tooltip: { trigger: 'axis', diff --git a/src/pages/usage/components/daily-usage.tsx b/src/pages/usage/components/daily-usage.tsx index dc0e3280..387711a5 100644 --- a/src/pages/usage/components/daily-usage.tsx +++ b/src/pages/usage/components/daily-usage.tsx @@ -314,6 +314,9 @@ const DailyUsage: React.FC = (props) => { seriesData={seriesData} xAxisData={xAxisData} height={280} + grid={{ + bottom: 28 + }} legendData={legendData} labelFormatter={labelFormatter} legendIsolate={metric === CACHED_METRIC} diff --git a/src/pages/usage/components/summary-tab.tsx b/src/pages/usage/components/summary-tab.tsx index a85213fe..7fbe695e 100644 --- a/src/pages/usage/components/summary-tab.tsx +++ b/src/pages/usage/components/summary-tab.tsx @@ -187,6 +187,9 @@ const DomainSection: React.FC<{ ]} xAxisData={trendXAxis} height={180} + grid={{ + bottom: 0 + }} title={trendTitle} labelFormatter={trendLabel(trendGran)} tooltipValueFormatter={(v) =>