260330_02_ENH: 연도별 사례수 row에서 Column으로 이동

This commit is contained in:
2026-03-30 16:59:51 +09:00
parent 7f9465e96f
commit a0ee062899
8 changed files with 66 additions and 32 deletions

View File

@@ -83,23 +83,29 @@ const LGPenetrationPage = () => {
const penetrationRows =
data?.statisticsDataMap?.penetration
.filter((r) => r.rowLabel == `보유` || r.rowLabel == `사례수`)
.filter((r) => r.rowLabel == `보유`)
.map((row) => {
const rowLabel = row.rowLabel == `사례수`? `${formatRowLabel(row.year)} ${row.rowLabel}` : row.year;
const rowSample = data?.statisticsDataMap?.penetration
.find(r => r.rowLabel == '사례수' && r.year == row.year)?.total ?? 0;
return {
...row,
rowLabel: rowLabel,
rowLabel: row.year,
sample: `(${rowSample})`,
}
}) ?? [];
const penetrationLGRows =
data?.statisticsDataMap?.penetration_lg
.filter((r) => r.rowLabel == `보유` || r.rowLabel == `사례수`)
.filter((r) => r.rowLabel == `보유`)
.map((row) => {
const rowLabel = row.rowLabel == `사례수`? `${formatRowLabel(row.year)} ${row.rowLabel}` : row.year;
const rowSample = data?.statisticsDataMap?.penetration_lg
.find(r => r.rowLabel == '사례수' && r.year == row.year)?.total ?? 0;
return {
...row,
rowLabel: rowLabel,
rowLabel: row.year,
sample: `(${rowSample})`,
}
}) ?? [];
@@ -124,7 +130,7 @@ const LGPenetrationPage = () => {
}, [penetrationLGRows]);
const penetrationLGRowsWithGap = useMemo(() => {
const withGap = withGapRow(penetrationLGRows, calcGapProductRow, -1, -3);
const withGap = withGapRow(penetrationLGRows, calcGapProductRow, -1, -2);
return withTotalBaseRow("보급률",penetrationRows, wrapSampleRow(withGap, false), calcTotalBaseRow);
}, [penetrationRows, penetrationLGRows]);
@@ -132,6 +138,7 @@ const LGPenetrationPage = () => {
const productTableRows = useMemo<TopChartTableRow[]>(() => {
return penetrationLGRowsWithGap.map((row) => ({
label: formatRowLabel(row.rowLabel),
sample: row.sample,
total: row.total,
values: includeProductKeys.map((k) => (row as any)[k] ?? null),
}));
@@ -204,7 +211,7 @@ const LGPenetrationPage = () => {
useEffect(() => {
registerExcelExporter(async () => {
const excelHeader = buildHeader_ProductKeyMap(productKeyMap);
const excelHeader = buildHeader_ProductKeyMap(productKeyMap, "sample");
const lifeStageHeader = buildHeader_LifeStageColumns(LIFE_STAGE_COLUMNS);
type AnyRow = Record<string, any>;