소계·총계
행/열 소계·총계의 표시 여부, 위치(start/end), fixed 옵션을 설명합니다.
소계는 행·열 중간 차원 그룹의 합계이고, 총계는 축 전체의 합계입니다.
페이지(tables) 옵션으로 표시 여부·위치·라벨·고정 속성을 설정합니다.
필드 배치는 필드 구성을, 값 기준 정렬의 target: 'total'은 정렬을 참고하세요.
설정
Book의 tables 옵션 하위에 다음 4가지 속성을 설정합니다.
| 속성 | 옵션 타입 | 설명 |
|---|---|---|
rowTotal | PivotSubtotalOptions | string | 행 축 소계 |
columnTotal | PivotSubtotalOptions | string | 열 축 소계 |
rowGrandTotal | PivotGrandTotalOptions | string | 행 축 총계 |
columnGrandTotal | PivotGrandTotalOptions | string | 열 축 총계 |
객체 대신 문자열을 직접 할당할 경우 라벨 이름으로 지정됩니다. (예: rowTotal: '합계')
const config = {
tables: {
name: 'sales',
cube: 'sales',
fields: {
rows: ['차종', '브랜드명'],
columns: ['판매분기'],
values: ['판매수량'],
},
rowTotal: { visible: true, position: 'end', collapseSingle: true },
columnTotal: { visible: true, position: 'end' },
rowGrandTotal: {
visible: true,
position: 'end',
fixed: true,
label: '합계',
},
columnGrandTotal: {
visible: true,
position: 'end',
fixed: true,
label: '합계',
},
},
};공통 옵션
소계·총계 모두 PivotTotalOptions를 상속합니다.
| 속성 | 설명 |
|---|---|
visible | 표시 여부 (기본 true) |
position | 'start' — 그룹(또는 축) 앞. 'end' — 뒤. 기본 'start' |
label | 헤더에 표시할 이름 |
style | 헤더·아이템 스타일 |
기본 라벨은 소계 '요약', 총계 '전체 요약'입니다.
소계 전용
| 속성 | 설명 |
|---|---|
collapseSingle | true이면 그룹 자식이 1개일 때 소계를 숨깁니다 (기본 false) |
행 헤더 layout 속성이 'tree'인 경우, 행 소계 위치는 자동으로 'start'로 고정되며 collapseSingle 옵션은 적용되지 않습니다.
총계 전용
| 속성 | 설명 |
|---|---|
fixed | true이면 해당 축 총계를 스크롤해도 고정 표시합니다 (기본 false) |
visible이 false이면 고정도 적용되지 않습니다.
화면에서 바꾸기
테이블 설정
행 바 메뉴의 '테이블 설정'에서 행·열 소계 및 총계의 표시 여부, 라벨, 위치, 고정 옵션을 변경할 수 있습니다.
적용 시 book.updateTableOptions로 반영됩니다.
collapseSingle 옵션은 테이블 설정 대화상자에서 제공되지 않으며, 설정 또는 API로만 지정할 수 있습니다.
헤더 메뉴
- 소계 헤더 — 앞쪽/뒤쪽 표시, 요약 감추기
- 총계 헤더 — 앞쪽/뒤쪽 표시, 감추기, 위치 고정
- 숨긴 소계와 총계는 테이블 설정에서
visible속성을 변경하여 표시할 수 있습니다.
API로 바꾸기
런타임 객체는 table.rowTotal · columnTotal · rowGrandTotal · columnGrandTotal입니다.
Undo가 필요하면 Book API를 사용하세요.
const book = control.book;
const table = control.table;
book.updateItem(table.rowGrandTotal, {
visible: true,
position: 'end',
fixed: true,
label: '합계',
});
book.updateItem(table.columnTotal, {
visible: false,
collapseSingle: true,
});
book.updateTableOptions(table, {
rowTotal: { visible: true, position: 'end', label: '소계' },
columnGrandTotal: { visible: true, position: 'end', fixed: true },
});
book.updateProp(table.rowTotal, 'collapseSingle', true);옵션만 바꿀 때는 table.rowTotal.updateOption('position', 'end')로 변경할 수 있습니다.
값 필드 스타일
값 셀의 소계·총계 모양은 값 필드 옵션으로 지정합니다.
| 속성 | 적용 대상 |
|---|---|
style / className | 일반 값 셀 (className은 미지정 시 소계·총계에도 사용) |
totalStyle / totalClass | 소계 셀 |
grandStyle / grandTotalClass | 총계 셀 |
values: [
{
name: '판매수량',
totalStyle: { color: 'darkblue' },
grandStyle: { color: 'darkblue', backgroundColor: '#f0f8ff' },
},
]오버레이(dataBar, heatmap 등)에서 셀 범위를 나눌 때는 cellScope의 'subtotal' · 'total'(총계)을 사용합니다. 자세한 내용은 셀 오버레이 · 테마·스타일을 참고하세요.