diff --git a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx
index 3dd14e5b7..6f113bee3 100644
--- a/packages/common/business_components/src/ui/chart/DoughnutChart.tsx
+++ b/packages/common/business_components/src/ui/chart/DoughnutChart.tsx
@@ -53,12 +53,37 @@ const customStyles = {
minHeight: "32px", // 범례 영역 높이 통일
} as CSSProperties,
};
+const renderCustomizedLabel = ({
+ cx,
+ cy,
+ midAngle,
+ outerRadius,
+ payload,
+}: any) => {
+ const RADIAN = Math.PI / 180;
+ const radius = outerRadius + 25;
+ const x = cx + radius * Math.cos(-midAngle * RADIAN);
+ const y = cy + radius * Math.sin(-midAngle * RADIAN);
+
+ return (
+ cx ? "start" : "end"}
+ dominantBaseline="central"
+ >
+ {`${payload.label}: ${payload.val.toLocaleString()}`}
+
+ );
+};
// 커스텀 툴팁
-const CustomTooltip = ({ active, payload, label }: {
- active?: boolean;
- payload?: TooltipPayloadItem[];
- label?: string
+const CustomTooltip = ({ active, payload, label }: {
+ active?: boolean;
+ payload?: TooltipPayloadItem[];
+ label?: string
}) => {
if (active && payload && payload.length) {
return (
@@ -79,7 +104,6 @@ const CustomTooltip = ({ active, payload, label }: {
const CustomLegend = (props: LegendProps) => {
const { payload } = props;
if (!payload) return null;
-
return (
{payload.map((entry: LegendEntry, index: number) => (
@@ -111,9 +135,9 @@ const CustomLegend = (props: LegendProps) => {
);
};
-export default function DoughnutChart(props: {
- chartConfig: ChartConfig;
- chartData: ChartDataItem[] | undefined;
+export default function DoughnutChart(props: {
+ chartConfig: ChartConfig;
+ chartData: ChartDataItem[] | undefined;
chartTitle: string
}) {
const legendData = props.chartData?.map(item => ({
@@ -125,19 +149,20 @@ export default function DoughnutChart(props: {
fill: props.chartConfig?.[item.label]?.color || 'blue'
}
})) ?? [];
-
+
return (
{props.chartTitle && props.chartTitle !== "" && props.chartTitle !== "undefined" ? (
-
+
{props.chartTitle}
) : null}
+ label={(props) => {
+ return renderCustomizedLabel(props);
+ }}
+ >
+
-
+