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

@@ -55,22 +55,26 @@ const PurchasePage = () => {
const purchaseRows =
data?.statisticsDataMap?.purchase
.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?.purchase
.find(r => r.rowLabel == '사례수' && r.year == row.year)?.total ?? 0;
return {
...row,
rowLabel: rowLabel,
rowLabel: row.year,
sample: `(${rowSample})`,
}
}) ?? [];
const purchaseRowsWithGap = useMemo(() => {
return withGapRow(wrapSampleRow(purchaseRows, false), calcGapProductRow, -1, -3);
return withGapRow(wrapSampleRow(purchaseRows, false), calcGapProductRow, -1, -2);
}, [purchaseRows]);
const purchaseTableRows = useMemo<TopChartTableRow[]>(() => {
return purchaseRowsWithGap.map((row) => ({
label: formatRowLabel(row.rowLabel),
sample: row.sample,
total: row.total,
values: PRODUCT_KEYS.map((k) => (row as any)[k] ?? null),
}));
@@ -100,7 +104,7 @@ const PurchasePage = () => {
useEffect(() => {
registerExcelExporter(async () => {
const excelHeader = buildHeader_ProductKeyMap(PRODUCT_KEY_MAP);
const excelHeader = buildHeader_ProductKeyMap(PRODUCT_KEY_MAP, "sample");
await exportDashboardExcel({
fileName: `${SITE_TITLE}(구매율).xlsx`,