Visual Map.

COMMUNITY

값에 따른 색상·크기와 선택 범위를 제어합니다.

Live preview기능별 예제 3개

LIVE EXAMPLE

연속 색상 범위

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

슬라이더로 대상 Heatmap의 값 범위를 선택합니다. 모든 값은 예시 데이터입니다.

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

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

  // Pro: 앱 시작 시 발급받은 인증서로 registerLicense를 완료하세요.
  // 홈페이지 미리보기의 인증서는 고객 앱에서 사용하지 않습니다.
  const specs = [
    {
      "tag": "sy-heatmap",
      "id": "chart-target",
      "props": {
        "data": [
          {
            "x": 0,
            "y": 0,
            "value": 10
          },
          {
            "x": 1,
            "y": 0,
            "value": 27
          },
          {
            "x": 2,
            "y": 0,
            "value": 44
          },
          {
            "x": 3,
            "y": 0,
            "value": 61
          },
          {
            "x": 4,
            "y": 0,
            "value": 78
          },
          {
            "x": 5,
            "y": 0,
            "value": 95
          },
          {
            "x": 0,
            "y": 1,
            "value": 22
          },
          {
            "x": 1,
            "y": 1,
            "value": 39
          },
          {
            "x": 2,
            "y": 1,
            "value": 56
          },
          {
            "x": 3,
            "y": 1,
            "value": 73
          },
          {
            "x": 4,
            "y": 1,
            "value": 90
          },
          {
            "x": 5,
            "y": 1,
            "value": 17
          },
          {
            "x": 0,
            "y": 2,
            "value": 34
          },
          {
            "x": 1,
            "y": 2,
            "value": 51
          },
          {
            "x": 2,
            "y": 2,
            "value": 68
          },
          {
            "x": 3,
            "y": 2,
            "value": 85
          },
          {
            "x": 4,
            "y": 2,
            "value": 12
          },
          {
            "x": 5,
            "y": 2,
            "value": 29
          },
          {
            "x": 0,
            "y": 3,
            "value": 46
          },
          {
            "x": 1,
            "y": 3,
            "value": 63
          },
          {
            "x": 2,
            "y": 3,
            "value": 80
          },
          {
            "x": 3,
            "y": 3,
            "value": 97
          },
          {
            "x": 4,
            "y": 3,
            "value": 24
          },
          {
            "x": 5,
            "y": 3,
            "value": 41
          },
          {
            "x": 0,
            "y": 4,
            "value": 58
          },
          {
            "x": 1,
            "y": 4,
            "value": 75
          },
          {
            "x": 2,
            "y": 4,
            "value": 92
          },
          {
            "x": 3,
            "y": 4,
            "value": 19
          },
          {
            "x": 4,
            "y": 4,
            "value": 36
          },
          {
            "x": 5,
            "y": 4,
            "value": 53
          }
        ],
        "height": 280,
        "width": 640
      }
    },
    {
      "id": "example-chart",
      "tag": "sy-visual-map",
      "props": {
        "for": "chart-target",
        "type": "continuous",
        "dimension": "value",
        "min": 0,
        "max": 100,
        "calculable": true,
        "color": ["#eee6ff", "#8263d9", "#34265d"],
        "width": 640,
        "height": 64
      }
    }
  ];
  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', 'visual-map 예제 차트');
    return element;
  });
  container.replaceChildren(...elements);
  const chart = elements.at(-1);
  const onEvent = event => {
    console.log('rangeChange', event.detail);
  };
  chart.addEventListener('rangeChange', 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('rangeChange', onEvent);
    container.replaceChildren();
  }
</script>

사용과 데이터

#

연속 색상 범례 또는 구간별 필터를 차트와 연결하세요.

대상이 지원하는 dimension을 선택하세요. 이 예제는 Heatmap의 value와 연결합니다.

데이터 계약

프로퍼티입력 형식
for대상 차트의 id입니다.
dimension값을 읽을 데이터 차원입니다.
typecontinuous 또는 piecewise입니다.
minmax와 함께 값 범위를 지정합니다.

데이터를 갱신할 때

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

기능별 예제

#

3개의 기능 예제를 직접 조작하고 코드를 확인하세요. ‘미리보기에서 편집’을 누르면 위 설정 패널에서 옵션을 더 조합할 수 있습니다.

색상 범위 API

값 범위를 25–75로 좁히고 필터 결과를 확인합니다.

차트를 조작하면 결과 값이 여기에 표시됩니다.
코드 보기

Series colour

Series colour의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.

차트를 조작하면 결과 값이 여기에 표시됩니다.
코드 보기

Continuous

Continuous의 7가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.

차트를 조작하면 결과 값이 여기에 표시됩니다.
코드 보기

API 레퍼런스

#

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

주요 속성

속성 / 프로퍼티타입 / 기본값설명
VisualMapType기본값 'continuous'continuous 또는 piecewise입니다.
number기본값 undefinedmax와 함께 값 범위를 지정합니다.
string기본값 undefined대상 차트의 id입니다.
VisualMapDimension기본값 undefined값을 읽을 데이터 차원입니다.
splitNumbernumber기본값 5Piecewise: equal intervals over `[min, max]` when no pieces / categories are given (default 5).
selectedModeVisualMapSelectedMode기본값 'multiple'Piecewise: 'multiple' toggles pieces independently, 'single' keeps one piece selected.
itemWidthnumber기본값 20Piecewise: the swatch size of a piece (ECharts itemWidth / itemHeight).
itemHeightnumber기본값 14HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number.
DataZoomOrientation기본값 'horizontal''horizontal' runs min → max left to right, 'vertical' bottom to top.
number기본값 320차트의 너비(px). 컨테이너가 바뀌면 ResizeObserver로 갱신합니다.
number기본값 28차트의 높이(px).
boolean기본값 falseShow the two range handles: the selected range can be dragged, keyed and set from script.
number기본값 undefinedFixed decimals for the labels (unset = up to two, trimmed).
showLabelsboolean기본값 trueShow the end labels, and the handle labels while a range is selected.
boolean기본값 trueReport the frames of a drag (`live: true`); off = only the release reports.
boolean기본값 falseHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean.
나머지 속성 15
속성 / 프로퍼티타입 / 기본값설명
number기본값 undefinedHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number.
VisualMapTargetElement | null기본값 undefinedJavaScript 프로퍼티로 전달합니다. 타입: VisualMapTargetElement | null.
sizeRangereadonly [number, number] | string기본값 undefinedJavaScript 프로퍼티로 전달합니다. 타입: readonly [number, number] | string.
sizeDimensionVisualMapDimension기본값 undefined허용값: x, y, value, z, index. 기본값: undefined.
outOfRangeSizenumber기본값 undefinedHTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number.
ReadonlyArray<VisualMapPieceInput> | string기본값 undefinedPiecewise: explicit pieces (`[{ min, max, label, color }]` or `[{ value }]`; a JSON string as an attribute). Wins over `categories` / `splitNumber`.
ReadonlyArray<string | number> | string기본값 undefinedPiecewise: discrete values, one piece each (a comma list as an attribute).
ReadonlyArray<boolean> | null기본값 undefinedPiecewise: the initial / controlled selection (`null` = every piece); changing it reports `selectionChanged` with source 'api'.
VisualMapColorInput기본값 undefinedThe ramp: a scheme name (`viridis`, `blues`, `rdbu`, …), a comma list (`#eff6ff,#1d4ed8`), a colour array, or `[t, colour]` stops.
outOfRangeColorstring기본값 '#d1d5db'The colour of values outside the selected range (and of non-finite values).
VisualMapRange | readonly [number, number] | null기본값 undefinedThe selected range (`null` / unset = the whole domain); changing it reports `rangeChange` with source 'api'.
(value: number) => string기본값 undefinedLabel formatter (a property — functions cannot be attributes).
string기본값 undefinedEnd captions instead of the numbers: `"High,Low"` (max end first — ECharts `text`).
stepFractionnumber기본값 0.1Fraction of the selected range one arrow key moves (default 0.1).
minRangePxnumber기본값 8The narrowest selectable range, in track pixels (default 8).
이벤트 2
이벤트detail 타입설명
VisualMapRangeChangeEventDetailEvery range the control shows: a handle drag / key ('control', with `live` frames), `setRange` or the `range` prop ('api').
VisualMapSelectionChangeEventDetailCustomEvent.detail 타입: VisualMapSelectionChangeEventDetail. 이벤트 이름은 대소문자를 구분합니다.
메서드 8

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

메서드 / 인수반환 타입설명
Promise<void>Re-read the bound chart's extent (while `min` / `max` are unset) and push the binding; the control also does this on the chart's `rendered`.
range: VisualMapRange | readonly [number, number] | nullPromise<VisualMapRange | null>Select a range from script (`null` = the whole domain); reports `rangeChange` with source 'api' when it changed.
Promise<VisualMapRange | null>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
selected: ReadonlyArray<boolean> | nullPromise<boolean[] | null>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<boolean[] | null>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
index: numberPromise<boolean[] | null>비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요.
Promise<VisualMapSnapshot>The resolved spec plus the selection: continuous → domain, stops, space, out-of-range colour, calculable, precision + `range`; piecewise → the pieces + `selected`.
value: number | stringPromise<string>The colour of a value on this map: the ramp / piece colour inside the selection, `outOfRangeColor` outside it.