diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 98d759f09..96dfab634 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -12,11 +12,11 @@ import { } from "./lib/chart"; import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"; -export default function Chart(props: { chartStyle: CSSProperties | undefined; chartConfig: ChartConfig; chartData: any[] | undefined; }) { +export default function Chart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; }) { return ( - + { +export default (props: { chartConfig: ChartConfig; chartData: never[] | undefined; }) =>{ return ( { + if (active && payload && payload.length) { + return ( +
+

{label}

+ {payload.map((item, index) => ( +
+ {/* 색상 박스 추가 (범례 색상과 동일) */} +
+ {`${item.name}: ${item.value}`} +
+ ))} +
+ ); + } + return null; +}; + +// 커스텀 범례 (글씨 크기 키우기 + 스타일 추가) +const CustomLegend = (props: any) => { + const { payload } = props; + return ( +
+ {payload.map((entry, index) => ( +
+
+ {entry.value} +
+ ))} +
+ ); +}; + +export default function LineBarchart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; }) { + return ( + + + + + + + {/* 왼쪽 Y축: lineVal (정상) */} + + {/* 오른쪽 Y축: barVal (위에서 아래로 반전) */} + + } /> + + {/* 바 차트 (오른쪽 Y축 사용, 위에서 아래로) */} + + {/* 라인 차트 (왼쪽 Y축 사용) */} + + + + + + ) +} \ No newline at end of file diff --git a/packages/common/business_components/src/ui/chart/LineChart.tsx b/packages/common/business_components/src/ui/chart/LineChart.tsx index 7cddf66d1..547a29c83 100644 --- a/packages/common/business_components/src/ui/chart/LineChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineChart.tsx @@ -12,11 +12,11 @@ import { } from "./lib/chart"; import { CartesianGrid, Line, LineChart, XAxis } from "recharts"; -export default function Linechart(props: { chartStyle: CSSProperties | undefined; chartConfig: ChartConfig; chartData: any[] | undefined; }) { +export default function Linechart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; }) { return ( - + - + ); } else if( props.chartForm == CHART_FORM.DN ){ return (
- +
); + } else if (props.chartForm == CHART_FORM.LINEBAR){ + return ( +
+ + +
+ ); } } -export {MainChart}; +export { MainChart }; // eslint-disable-next-line react-refresh/only-export-components -export {CHART_FORM}; -export type {ChartConfig}; \ No newline at end of file + export { CHART_FORM }; + export type { ChartConfig };