From 2f4cfa0d78a63366dd1883931df25322a3827d6b Mon Sep 17 00:00:00 2001 From: jsyang Date: Tue, 26 Aug 2025 13:30:24 +0900 Subject: [PATCH 1/5] =?UTF-8?q?=EB=B0=94=EC=B0=A8=ED=8A=B8=20=ED=88=B4?= =?UTF-8?q?=ED=8C=81=20=EC=88=AB=EC=9E=90=EC=9D=98=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=B2=9C=EC=9E=90=EB=A6=AC=20=EC=89=BC=ED=8F=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business_components/src/ui/chart/BarChart.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/chart/BarChart.tsx b/packages/common/business_components/src/ui/chart/BarChart.tsx index 79aa61c98..ec0647dff 100644 --- a/packages/common/business_components/src/ui/chart/BarChart.tsx +++ b/packages/common/business_components/src/ui/chart/BarChart.tsx @@ -19,6 +19,14 @@ const customStyles = { } as CSSProperties, }; +const fncNumberFormet = (value : string | number) => { + return String(value).includes('.')? + String(parseFloat(value.toString().replace(/,/g, ''))).split('.').map((part, index) => + index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part + ).join('.') + : String(value).replace(/\B(?=(\d{3})+(?!\d))/g, ","); +} + type BarChartProps = { chartConfig: ChartConfig | undefined; chartData: any[] | undefined; @@ -51,7 +59,7 @@ const CustomTooltip = ({
{/* 색상 박스 추가 (범례 색상과 동일) */}
- {` ${item.name} : ${item.value}`} + {` ${item.name} : ${fncNumberFormet(item.value)}`}
))} From aeaf507c47713787e7a476560c08a409c601bf8f Mon Sep 17 00:00:00 2001 From: jsyang Date: Tue, 26 Aug 2025 17:39:07 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=EC=B0=A8=ED=8A=B8property=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(setXAxisYearTick=20-=20=EB=82=A0=EC=A7=9C=20x?= =?UTF-8?q?=EC=B6=95=EC=9D=BC=EA=B2=BD=EC=9A=B0=20(=EB=85=84=EB=8F=84-?= =?UTF-8?q?=EC=9B=94)=EB=B3=84=EB=A1=9C=20=EB=A7=8C=EB=93=A4=EC=96=B4?= =?UTF-8?q?=EC=A3=BC=EB=8A=94=20=EC=86=8D=EC=84=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/LineChart.tsx | 58 ++++++++++++++----- .../src/ui/chart/index.tsx | 3 +- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/LineChart.tsx b/packages/common/business_components/src/ui/chart/LineChart.tsx index 23570912d..63851cbea 100644 --- a/packages/common/business_components/src/ui/chart/LineChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineChart.tsx @@ -6,6 +6,7 @@ import { ChartContainer, type ChartConfig } from "./lib/chart"; +import { get } from "http"; type LineChartProps = { chartConfig: ChartConfig | undefined; @@ -15,6 +16,7 @@ type LineChartProps = { graphSize?: number; yFieldText?: string; showLegend?: boolean; + setXAxisYearTick?: boolean; } /** 차트 기본 스타일 */ @@ -141,7 +143,8 @@ export default function Linechart({ chartClassName = 'w-full h-full', graphSize = 40, yFieldText, - showLegend = true + showLegend = true, + setXAxisYearTick = false, }: LineChartProps) { if (!chartData || Object.keys(chartData).length === 0) { return
데이터가 없습니다.
; @@ -164,18 +167,24 @@ export default function Linechart({ return acc; }, []); - // 데이터의 최대값 계산 - const getMaxValue = (data: ChartDataType): number => { - return Math.max(...Object.values(data).flatMap(dataset => - dataset.map(entry => { - const val = parseFloat(entry.val); - return isNaN(val) ? 0 : val; - }) - )); - }; - - const lineMaxValue = getMaxValue(chartData); - + const getTicks = (data : any []) => { + const monthSet = new Set(); + const rtnData : string[] = []; + for(const item of data){ + const month = String(item.label).slice(0,7); + if(!monthSet.has(month)){ + monthSet.add(month); + rtnData.push(item.label); + } + } + return rtnData; + } + + let monthTicks : string[] = []; + if(setXAxisYearTick){ + monthTicks = getTicks(mergedData); + } + return (
{chartTitle && chartTitle !== "" && chartTitle !== "undefined" ? ( @@ -192,8 +201,27 @@ export default function Linechart({ margin={{ top: 5, right: 30, left: 20, bottom: 5 }} > - - value.toLocaleString()} tickCount={6} orientation="left" label={{ value: yFieldText, className:"text-[12px] font-bold", angle: -90, position: 'insideLeft' }} /> + + {setXAxisYearTick ? + value.slice(0,7)} + /> : + + } + + } /> {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 ee308e378..a6e1ff245 100644 --- a/packages/common/business_components/src/ui/chart/index.tsx +++ b/packages/common/business_components/src/ui/chart/index.tsx @@ -56,6 +56,7 @@ type MainChartProps = { yFieldText? : string | undefined; yFieldText2? : string | undefined; showLegend? : boolean; + setXAxisYearTick ?: boolean; } function MainChart(props: MainChartProps) { @@ -65,7 +66,7 @@ function MainChart(props: MainChartProps) { ); } else if( props.chartForm == CHART_FORM.LINE ){ return ( - + ); } else if( props.chartForm == CHART_FORM.DN ){ return ( From 392ccefb16ca568e128772abf175b3670964e193 Mon Sep 17 00:00:00 2001 From: jsyang Date: Tue, 26 Aug 2025 17:47:51 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=EB=9D=BC=EC=9D=B8=EB=B0=94=20=EC=B0=A8?= =?UTF-8?q?=ED=8A=B8property=20=EC=B6=94=EA=B0=80=20(setXAxisYearTick=20-?= =?UTF-8?q?=20=EB=82=A0=EC=A7=9C=20x=EC=B6=95=EC=9D=BC=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=20(=EB=85=84=EB=8F=84-=EC=9B=94)=EB=B3=84=EB=A1=9C=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EC=96=B4=EC=A3=BC=EB=8A=94=20=EC=86=8D=EC=84=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ui/chart/LineBarChart.tsx | 28 +++++++++++++++++-- .../src/ui/chart/index.tsx | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/common/business_components/src/ui/chart/LineBarChart.tsx b/packages/common/business_components/src/ui/chart/LineBarChart.tsx index d81d6e2c8..9f9a4feec 100644 --- a/packages/common/business_components/src/ui/chart/LineBarChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineBarChart.tsx @@ -6,6 +6,7 @@ import { type ChartConfig } from "./lib/chart"; import type { ContentType } from "recharts/types/component/DefaultLegendContent"; +import type { set } from "date-fns"; // 툴크 커스텀 css /** 차트 기본 스타일 */ @@ -29,6 +30,7 @@ type LineBarChartProps = { yFieldText?: string | undefined; yFieldText2?: string | undefined; showLegend?: boolean; + setXAxisYearTick?: boolean; } type LegendEntry = { @@ -86,7 +88,8 @@ export default function LineBarchart({ graphSize = 40, yFieldText, yFieldText2, - showLegend = true + showLegend = true, + setXAxisYearTick = false }: LineBarChartProps) { if (!chartData || chartData.length === 0) { return
데이터가 없습니다.
; @@ -105,6 +108,24 @@ export default function LineBarchart({ const lineMaxValue = getMaxValue(chartData, 'lineVal'); const barMaxValue = getMaxValue(chartData, 'barVal'); + const getTicks = (data : any []) => { + const monthSet = new Set(); + const rtnData : string[] = []; + for(const item of data){ + const month = String(item.label).slice(0,7); + if(!monthSet.has(month)){ + monthSet.add(month); + rtnData.push(item.label); + } + } + return rtnData; + } + + let monthTicks : string[] = []; + if(setXAxisYearTick){ + monthTicks = getTicks(chartData); + } + return (
{chartTitle && chartTitle !== "" && chartTitle !== "undefined" ? ( @@ -121,7 +142,10 @@ export default function LineBarchart({ margin={{ top: 5, right: 30, left: 20, bottom: 5 }} > - + {setXAxisYearTick? + value.slice(0,7)} fontSize="8px" fontWeight="bold"/> : + + } {/* 왼쪽 Y축: lineVal */} {yFieldText && + ); } else if (props.chartForm == CHART_FORM.LINEBAR2){ return ( From c7772a0a23e57f18c7ec46a52dbc17aac5f6cfdc Mon Sep 17 00:00:00 2001 From: jsyang Date: Tue, 26 Aug 2025 17:50:50 +0900 Subject: [PATCH 4/5] =?UTF-8?q?=EB=B9=8C=EB=93=9C=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/chart/LineChart.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/common/business_components/src/ui/chart/LineChart.tsx b/packages/common/business_components/src/ui/chart/LineChart.tsx index 63851cbea..a76807bae 100644 --- a/packages/common/business_components/src/ui/chart/LineChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineChart.tsx @@ -6,7 +6,6 @@ import { ChartContainer, type ChartConfig } from "./lib/chart"; -import { get } from "http"; type LineChartProps = { chartConfig: ChartConfig | undefined; From b9f5eb50e5041fc3d1e6f6783275e28c7fea922b Mon Sep 17 00:00:00 2001 From: swcho Date: Tue, 26 Aug 2025 18:42:36 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20UiTable=20=EB=82=B4=EB=B6=80=20?= =?UTF-8?q?=EC=85=80=20=EC=A4=84=EB=B0=94=EA=BF=88=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?pre-line=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/table/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index dcf7f4aa4..9ffea89bf 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -137,7 +137,7 @@ export function UiTable({ : cellClick ? "cursor-pointer" : "" - } sticky top-20 z-40 bg-secondary !font-bold`} + } sticky top-20 z-40 bg-secondary !font-bold whitespace-pre-line`} style={{ top: `${headerHeight + index * 32 - 4}px` }} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} @@ -168,7 +168,7 @@ export function UiTable({ : cellClick ? "cursor-pointer" : "" - } mt-[${boldArray.length * 40}px]`} + } mt-[${boldArray.length * 40}px] whitespace-pre-line`} onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} >