diff --git a/packages/common/business_components/src/ui/chart/LineBarChart.tsx b/packages/common/business_components/src/ui/chart/LineBarChart.tsx index 35d757619..6db4c3b0a 100644 --- a/packages/common/business_components/src/ui/chart/LineBarChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineBarChart.tsx @@ -5,6 +5,7 @@ import { ChartContainer, type ChartConfig } from "./lib/chart"; +import type { ContentType } from "recharts/types/component/DefaultLegendContent"; // 툴팁 커스텀 css /** 차트 기본 스타일 */ @@ -25,7 +26,8 @@ type LineBarChartProps = { chartTitle: string; chartClassName?: string; graphSize?: number; - yFieldText?: string; + yFieldText?: string | undefined; + yFieldText2?: string | undefined; showLegend?: boolean; } @@ -83,6 +85,7 @@ export default function LineBarchart({ chartClassName = 'w-full h-full', graphSize = 40, yFieldText, + yFieldText2, showLegend = true }: LineBarChartProps) { if (!chartData || chartData.length === 0) { @@ -110,11 +113,11 @@ export default function LineBarchart({ {/* 왼쪽 Y축: lineVal */} - + {yFieldText && } {/* 오른쪽 Y축: barVal */} - + {yFieldText2 && } } /> - {showLegend && } + {showLegend && } {/* 바 차트 (오른쪽 Y축 사용) */} - + } /> {showLegend && } {Object.keys(chartData).map((key) => { diff --git a/packages/common/business_components/src/ui/chart/index.tsx b/packages/common/business_components/src/ui/chart/index.tsx index 87cabc18a..b30eef3c3 100644 --- a/packages/common/business_components/src/ui/chart/index.tsx +++ b/packages/common/business_components/src/ui/chart/index.tsx @@ -18,6 +18,20 @@ const CHART_FORM = { LINEBAR : 'linebar' }; +/** + * 차트 컴포넌트 + * @param chartForm 차트 형태 + * @param chartConfig 차트 설정 + * @param chartData 차트 데이터 + * @param chartTitle 차트 제목 + * @param chartClassName 차트 클래스명 + * @param graphSize 차트 크기 + * @param yFieldText 차트 Y축 텍스트 + * @param yFieldText2 차트 Y축 텍스트2(라인바 차트때 사용) + * @param showLegend 차트 범례 표시 여부 + * @returns + */ + type MainChartProps = { chartForm: string; chartConfig: any; @@ -25,7 +39,8 @@ type MainChartProps = { chartTitle: string; chartClassName?: string; graphSize?: number; - yFieldText? : string; + yFieldText? : string | undefined; + yFieldText2? : string | undefined; showLegend? : boolean; } @@ -47,7 +62,7 @@ function MainChart(props: MainChartProps) { ); } else if (props.chartForm == CHART_FORM.LINEBAR){ return ( - + ); }