Waterfall.

PRO

증감이 누적되어 최종값이 되는 과정을 보여줍니다.

Live preview기능별 예제 20개

LIVE EXAMPLE

매출 증감

페이지 테마에 맞춰 표시
차트를 조작하면 선택·범위 변경 결과가 여기에 표시됩니다.
옵션변경 사항이 미리보기와 코드에 반영됩니다.
표현과 스타일9
축과 격자14
범례와 상호작용13
제목과 크기3

기초값에 증감을 더해 최종 합계를 표시합니다. 모든 값은 예시 데이터입니다.

코드 보기
현재 미리보기
<div id="chart-container" style="width: 100%; min-width: 0;"></div>

<script type="module">
  import { defineCustomElement as define0 } from '@syidax/advanced-pro/components/sy-waterfall-chart.js';
  define0();

  // Pro: 앱 시작 시 발급받은 인증서로 registerLicense를 완료하세요.
  // 홈페이지 미리보기의 인증서는 고객 앱에서 사용하지 않습니다.
  const specs = [
    {
      "id": "example-chart",
      "tag": "sy-waterfall-chart",
      "props": {
        "data": [
          {
            "category": "기초",
            "value": 100
          },
          {
            "category": "신규",
            "value": 45
          },
          {
            "category": "해지",
            "value": -20
          },
          {
            "category": "추가",
            "value": 15
          },
          {
            "category": "합계",
            "kind": "total"
          }
        ],
        "width": 640,
        "height": 360,
        "brandPosition": "bottom-right",
        "brandLogo": ""
      }
    }
  ];
  const container = document.querySelector('#chart-container');
  const elements = specs.map(({ tag, id, props }) => {
    const element = document.createElement(tag);
    element.id = id;
    Object.assign(element, props);
    element.setAttribute('aria-label', 'waterfall 예제 차트');
    return element;
  });
  container.replaceChildren(...elements);
  const chart = elements.at(-1);
  const onEvent = event => {
    console.log('pointClick', event.detail);
  };
  chart.addEventListener('pointClick', onEvent);
  const observer = new ResizeObserver(([entry]) => {
    const width = Math.max(160, Math.floor(entry.contentRect.width));
    elements.forEach(element => { element.width = width; });
  });
  observer.observe(container);

  // SPA에서는 화면이 해제될 때 이 함수를 호출하세요.
  function disposeChart() {
    observer.disconnect();
    chart.removeEventListener('pointClick', onEvent);
    container.replaceChildren();
  }
</script>

사용과 데이터

#

매출·비용·재고의 시작값, 변화, 합계를 설명하세요.

total·subtotal은 일반 증감과 의미가 다릅니다. 합계를 delta로 한 번 더 더하지 마세요.

데이터 계약

프로퍼티입력 형식
data{ category, value?, kind? } 배열입니다. kind는 delta·subtotal·total입니다.

데이터를 갱신할 때

배열 안의 값을 직접 바꾸기보다 새 배열·객체를 프로퍼티에 할당하세요. 차트의 이벤트는 event.detail로 선택 결과를 전달합니다. 화면을 해제할 때 ResizeObserver와 앱에서 등록한 이벤트 리스너를 정리하세요.

화면에 적용하기

#

미리보기 아래 코드 탭에서 현재 예제의 전체 데이터, 옵션, 이벤트 연결과 반응형 크기 처리를 확인하고 복사할 수 있습니다. 설치된 패키지를 해석할 수 있는 Vite 등의 앱 프로젝트에서 사용하세요.

공통 sy-chart API와 직접 태그의 차이

API 레퍼런스

#

sy-waterfall-chart의 전체 공개 API입니다. 객체와 배열은 JavaScript 프로퍼티로 전달하세요. 이름을 선택하면 적용 코드와 타입 계약을 확인할 수 있습니다.

주요 속성

속성 / 프로퍼티타입 / 기본값설명
WaterfallData기본값 undefined{ category, value?, kind? } 배열입니다. kind는 delta·subtotal·total입니다.
number기본값 900차트의 너비(px). 컨테이너가 바뀌면 ResizeObserver로 갱신합니다.
number기본값 360차트의 높이(px).
brandLogostring기본값 undefined기본값은 Syidax 로고입니다. Pro의 chart.branding 권한으로 none 또는 PNG·JPEG·WebP data URL을 사용할 수 있습니다.
brandPosition'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'기본값 'bottom-right'로고를 고정할 코너입니다. Community·Pro, 화면과 이미지 내보내기에 동일하게 적용됩니다.
xAxisXAxisInput기본값 undefinedThe category axis (its `label` / `show` / `format`; the slots are one per bar), or `[bottom, top, …]` slots (the multi x-axis: every slot a category axis over the bars — `position`, `linkedTo`, `format` per the shared contract).
yAxisYAxisInput기본값 undefinedThe value axis: one input, or `[left, right, …]` slots (the dual / multi y-axis; `kind: 'log' | 'time'` and `linkedTo` per the shared contract).
gridLinesCartesianGridLinesInput기본값 undefinedGrid lines: the value axis's on by default, the category axis's off.
CartesianCrosshairInput기본값 undefinedCrosshair that follows the cursor across the plot.
CartesianZoomInput기본값 undefined확대·축소와 표시 범위의 동작 설정입니다.
upColorstring기본값 DEFAULT_UP_COLORThe bar colours: a rising delta, a falling delta, a total / subtotal; the connectors; the hovered / focused bar.
downColorstring기본값 DEFAULT_DOWN_COLORHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: string.
totalColorstring기본값 DEFAULT_TOTAL_COLORHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: string.
connectorWidthnumber기본값 1The connector's thickness in CSS px, and its switch.
showConnectorsboolean기본값 trueHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean.
showTotalboolean기본값 falseHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean.
totalLabelstring기본값 WATERFALL_DEFAULT_TOTAL_LABELHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: string.
showLabelsboolean기본값 falseThe value labels (off by default): `label-mode` value (a delta's signed change, a total's running total) / running / both; `labelFormat(bar)` replaces the text.
labelModeWaterfallLabelMode기본값 'value'허용값: value, running, both. 기본값: 'value'.
chartTitlestring기본값 undefined차트 내부 제목입니다. 데이터의 단위와 의미를 함께 설명하세요.
chartSubtitlestring기본값 undefined차트 내부 부제목입니다.
CartesianTooltipInput기본값 undefined포인터에 따라 표시할 값, 위치, 내용의 툴팁 설정입니다.
tooltipEnabledboolean기본값 trueHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean.
animatedboolean기본값 false초기 표시와 데이터 변경의 애니메이션 사용 여부입니다.
animationDurationnumber기본값 600애니메이션 지속 시간(ms).
animationEasingWaterfallEasing기본값 'ease-out'허용값: linear, ease-out, ease-in, ease-in-out. 기본값: 'ease-out'.
animationTypeWaterfallAnimationType기본값 undefined허용값: initial, update. 기본값: undefined.
나머지 속성 18
속성 / 프로퍼티타입 / 기본값설명
yMinnumber기본값 undefinedHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number.
yMaxnumber기본값 undefinedHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number.
number기본값 0.05The automatic domain pads the value span by this share (default 5 %); zero is always inside.
connectorColorstring기본값 DEFAULT_CONNECTOR_COLORHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: string.
activeColorstring기본값 DEFAULT_ACTIVE_COLORHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: string.
barWidthnumber기본값 WATERFALL_DEFAULT_WIDTH_RATIOThe bar's share of the slot pitch (0.6), clamped between `bar-min-px` and `bar-max-px`.
barMinPxnumber기본값 WATERFALL_DEFAULT_MIN_PXHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number.
barMaxPxnumber기본값 WATERFALL_DEFAULT_MAX_PXHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number.
detectResultboolean기본값 trueRecognise a last step given as a plain value equal to the running total as the RESULT bar (a total from zero; `detected: true`); off → it stays a delta.
lastResultboolean기본값 undefinedTrue: the last merged step is a result spanning zero and the preceding running total, ignoring its value/colour. False: disable detection, preserving explicit datum kinds. Omitted: use detect-result.
labelFormat(bar: WaterfallBar) => string기본값 undefinedJavaScript 프로퍼티로 전달합니다. 타입: (bar: WaterfallBar) => string.
enableMouseTrackingboolean기본값 trueHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean.
tooltipFormat(detail: WaterfallPointEventDetail) => string기본값 undefinedJavaScript 프로퍼티로 전달합니다. 타입: (detail: WaterfallPointEventDetail) => string.
streamSourceWaterfallStreamSource기본값 undefined실시간 데이터를 전달하는 스트림 소스입니다. 해당 타입의 계약을 확인하세요.
streamMaxnumber기본값 undefined보관할 스트리밍 데이터의 최대 수입니다.
streamWindownumber기본값 undefined화면에 유지할 스트리밍 데이터 구간입니다.
WaterfallEngineMode기본값 'auto'auto·standard·pro 렌더러 선택입니다. 엔진 선택은 차트 종류의 Pro 사용 권한과 별개입니다.
WaterfallUnavailableBehaviour기본값 'fallback'허용값: fallback, error. 기본값: 'fallback'.
이벤트 14
이벤트detail 타입설명
WaterfallRenderResult & { tier: WaterfallEngineTier; engine?: ChartEngineStatus }차트 그리기가 완료되면 렌더링 결과를 detail로 전달합니다.
WaterfallPointEventDetail점 선택 이벤트입니다. CustomEvent.detail에서 선택한 데이터와 인덱스를 읽습니다.
WaterfallPointEventDetail | nullCustomEvent.detail 타입: WaterfallPointEventDetail | null. 이벤트 이름은 대소문자를 구분합니다.
CartesianCrosshairEventDetail | nullCustomEvent.detail 타입: CartesianCrosshairEventDetail | null. 이벤트 이름은 대소문자를 구분합니다.
ChartPointContextMenuEventDetail<WaterfallPointEventDetail>CustomEvent.detail 타입: ChartPointContextMenuEventDetail<WaterfallPointEventDetail>. 이벤트 이름은 대소문자를 구분합니다.
{ count: number; replaced: number }CustomEvent.detail 타입: { count: number; replaced: number }. 이벤트 이름은 대소문자를 구분합니다.
{ dropped: number }CustomEvent.detail 타입: { dropped: number }. 이벤트 이름은 대소문자를 구분합니다.
CartesianTooltipEventDetail내장 툴팁 표시 여부입니다.
voidCustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다.
CartesianTooltipActionEventDetailCustomEvent.detail 타입: CartesianTooltipActionEventDetail. 이벤트 이름은 대소문자를 구분합니다.
voidCustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다.
voidCustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다.
voidCustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다.
CartesianZoomChangeEventDetailFired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state.
메서드 33

Stencil 메서드는 Promise를 반환합니다. async 함수에서 await로 결과를 받으세요.

메서드 / 인수반환 타입설명
Promise<ChartDataTable>Current normalized table, including the retained stream; independent of GPU availability.
Promise<WaterfallRenderResult>Draws a frame now; rejects with the SyidaxLicenseError while the type is not entitled or the chart is frozen.
Promise<WaterfallEngineTier>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<string | undefined>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
data: WaterfallDataPromise<void>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
datum: WaterfallDatumInputPromise<void>Upsert one step (a tracked category replaces its step; the running total re-tells).
data: ReadonlyArray<WaterfallDatumInput>Promise<void>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
count: numberPromise<void>Drop the oldest streamed steps (the `data` bars are not the stream).
data: ReadonlyArray<WaterfallDatumInput>Promise<void>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<WaterfallStreamSource | undefined>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
options: { duration?: number; easing?: WaterfallEasing; enabled?: boolean; type?: WaterfallAnimationType }Promise<void>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<void>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<void>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<void>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
cssX: number, cssY: numberPromise<WaterfallPointEventDetail | null>The bar under a host-local CSS point (the nearest slot, within half a pitch), or null.
index: numberPromise<WaterfallBar | null>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
category: stringPromise<WaterfallBar | null>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<number>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<WaterfallBar[]>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<string[]>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<WaterfallExtent>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<WaterfallDomain>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<number>The running total after the last bar (0 without bars).
index: numberPromise<CartesianTooltipEventDetail | null>Open the tooltip on a bar (the facade's `showTooltipAtPoint` routes here); null off the bars or with the tooltip off.
Promise<void>Close every tooltip.
index: numberPromise<WaterfallPointEventDetail | null>Move the keyboard focus ring to a bar (null off the bars); emits pointHover like the walk.
request: CartesianZoomRequestPromise<CartesianZoomChangeEventDetail | null>Zoom to explicit windows: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation; x is in slots — bar i sits at i); `xAxis` / `yAxis` name the axis by id or slot index (default: the primary axis).
factor: number, anchorFraction?: numberPromise<CartesianZoomChangeEventDetail | null>Scale the current windows by `factor` (< 1 zooms in) around `anchorFraction` (0..1, default centre).
delta: { x?: number; y?: number }Promise<CartesianZoomChangeEventDetail | null>Slide the zoomed windows by data units (`{ x?, y? }` — x in slots); a no-op at the full extent.
Promise<CartesianZoomChangeEventDetail | null>Back to the full extent.
Promise<CartesianZoomState | null>The current zoom state (`null` = full extent).
request?: CartesianZoomExtentRequestPromise<CartesianZoomExtentDetail | null>The full extent (and key) of the primary — or the named — master axes (x: the slot range −0.5 … n − 0.5).
Promise<ChartEngineStatus>Requested engine vs what runs, and why (CHART-ADD-08): the decision for the current inputs, read without side effects (ProChartLicense.engineStatus); a renderer that failed at run time reports engine-unsupported.