fix(style): bar chart legend gap

This commit is contained in:
jialin
2026-06-08 11:42:20 +08:00
committed by jialin
parent 993f6edcc4
commit e420c22a45
3 changed files with 17 additions and 2 deletions
+11 -2
View File
@@ -21,6 +21,13 @@ export interface BarChartProps {
labelFormatter?: (val: any, index?: number) => string; labelFormatter?: (val: any, index?: number) => string;
tooltipValueFormatter?: (val: any) => string; tooltipValueFormatter?: (val: any) => string;
title?: string; title?: string;
grid?: {
left?: number | string;
right?: number | string;
top?: number | string;
bottom?: number | string;
containLabel?: boolean;
};
legendIsolate?: boolean; legendIsolate?: boolean;
} }
@@ -34,6 +41,7 @@ const BarChart: React.FC<BarChartProps> = (props) => {
labelFormatter, labelFormatter,
tooltipValueFormatter, tooltipValueFormatter,
title, title,
grid,
legendIsolate legendIsolate
} = props; } = props;
const { token } = theme.useToken(); const { token } = theme.useToken();
@@ -126,8 +134,9 @@ const BarChart: React.FC<BarChartProps> = (props) => {
left: 0, left: 0,
right: 0, right: 0,
top: title ? 30 : 10, top: title ? 30 : 10,
bottom: 0, bottom: 8,
containLabel: true containLabel: true,
...grid
}, },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@@ -314,6 +314,9 @@ const DailyUsage: React.FC<DailyUsageProps> = (props) => {
seriesData={seriesData} seriesData={seriesData}
xAxisData={xAxisData} xAxisData={xAxisData}
height={280} height={280}
grid={{
bottom: 28
}}
legendData={legendData} legendData={legendData}
labelFormatter={labelFormatter} labelFormatter={labelFormatter}
legendIsolate={metric === CACHED_METRIC} legendIsolate={metric === CACHED_METRIC}
@@ -187,6 +187,9 @@ const DomainSection: React.FC<{
]} ]}
xAxisData={trendXAxis} xAxisData={trendXAxis}
height={180} height={180}
grid={{
bottom: 0
}}
title={trendTitle} title={trendTitle}
labelFormatter={trendLabel(trendGran)} labelFormatter={trendLabel(trendGran)}
tooltipValueFormatter={(v) => tooltipValueFormatter={(v) =>