diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 5d4f902e8..1b75beb8b 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -3,13 +3,11 @@ import { Bar, BarChart, CartesianGrid, Legend, XAxis, YAxis } from "recharts"; import { ChartContainer, ChartTooltip, - ChartTooltipContent, type ChartConfig } from "./lib/chart"; -import { styles } from "@common/assets"; import type { CSSProperties } from "react"; -const styles = { +const customStyles = { legendContainer: { display: "flex", justifyContent: "center", @@ -20,8 +18,6 @@ const styles = { } as CSSProperties, }; -const tooltipClass = "!p-4 text-[12px] w-[9vw] h-[5vw]"; - type BarChartProps = { chartConfig: ChartConfig | undefined; chartData: any[] | undefined; @@ -46,7 +42,7 @@ const CustomTooltip = ({ }>; label?: string; }) => { - if (active && payload && payload.length) { + if (active && payload && payload.length) {ㅇ return (

{label}

@@ -67,7 +63,7 @@ const CustomTooltip = ({ const CustomLegend = (props: any) => { const { payload } = props; return ( -
+
{payload.map((entry, index: number) => (
diff --git a/packages/common/business_components/src/ui/chart/LineBarChart.tsx b/packages/common/business_components/src/ui/chart/LineBarChart.tsx index 5f2ae4715..98f804abf 100644 --- a/packages/common/business_components/src/ui/chart/LineBarChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineBarChart.tsx @@ -9,29 +9,10 @@ import { ChartContainer, type ChartConfig } from "./lib/chart"; -import React from "react"; // 툴팁 커스텀 css /** 차트 기본 스타일 */ -const styles = { - tooltipDiv: { - borderRadius: "5px", - backgroundColor: "white", - padding: "10px", - boxShadow: "0px 2px 10px rgba(0,0,0,0.2)", - width: "180px", // 적절한 크기로 설정 - } as React.CSSProperties, - tooltipLabel: { - fontWeight: "bold", - fontSize: "12px", - marginBottom: "5px", - borderBottom: "1px solid #ddd", - paddingBottom: "3px", - } as React.CSSProperties, - tooltipText: { - fontSize: "11px", - fontWeight:"bold", - } as React.CSSProperties, +const customStyles = { legendContainer: { display: "flex", justifyContent: "center", @@ -43,16 +24,28 @@ const styles = { }; // 커스텀 툴팁 -const CustomTooltip = ({ active, payload, label }) => { +const CustomTooltip = ({ + active, + payload, + label +}: { + active?: boolean; + payload?: Array<{ + name: string; + value: number; + color: string; + }>; + label?: string; +}) => { if (active && payload && payload.length) { return ( -
-

{label}

+
+

{label}

{payload.map((item, index) => (
{/* 색상 박스 추가 (범례 색상과 동일) */}
- {`${item.name}: ${item.value}`} + {` ${item.name} : ${item.value}`}
))}
@@ -65,11 +58,11 @@ const CustomTooltip = ({ active, payload, label }) => { const CustomLegend = (props: any) => { const { payload } = props; return ( -
- {payload.map((entry, index) => ( -
-
- {entry.value} +
+ {payload.map((entry: any, index: number) => ( +
+
+ {entry.value}
))}