Density Map.
PRO관측점이 모이는 영역을 부드러운 밀도로 보여줍니다.
LIVE EXAMPLE
밀집도
표현과 스타일7
축과 격자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-density-map.js';
define0();
// Pro: 앱 시작 시 발급받은 인증서로 registerLicense를 완료하세요.
// 홈페이지 미리보기의 인증서는 고객 앱에서 사용하지 않습니다.
const specs = [
{
"id": "example-chart",
"tag": "sy-density-map",
"props": {
"data": [
{
"x": 0,
"y": 7,
"weight": 1
},
{
"x": 16,
"y": 4,
"weight": 2
},
{
"x": 29,
"y": -3,
"weight": 3
},
{
"x": 37,
"y": -7,
"weight": 1
},
{
"x": 44,
"y": -5,
"weight": 2
},
{
"x": 55,
"y": 2,
"weight": 3
},
{
"x": -1,
"y": 17,
"weight": 1
},
{
"x": 15,
"y": 15,
"weight": 2
},
{
"x": 29,
"y": 9,
"weight": 3
},
{
"x": 38,
"y": 4,
"weight": 1
},
{
"x": 45,
"y": 4,
"weight": 2
},
{
"x": 55,
"y": 10,
"weight": 3
},
{
"x": -3,
"y": 26,
"weight": 1
},
{
"x": 14,
"y": 26,
"weight": 2
},
{
"x": 29,
"y": 21,
"weight": 3
},
{
"x": 39,
"y": 15,
"weight": 1
},
{
"x": 47,
"y": 13,
"weight": 2
},
{
"x": 55,
"y": 18,
"weight": 3
},
{
"x": -4,
"y": 35,
"weight": 1
},
{
"x": 13,
"y": 37,
"weight": 2
},
{
"x": 29,
"y": 33,
"weight": 3
},
{
"x": 40,
"y": 26,
"weight": 1
},
{
"x": 48,
"y": 23,
"weight": 2
},
{
"x": 56,
"y": 26,
"weight": 3
},
{
"x": -5,
"y": 43,
"weight": 1
},
{
"x": 11,
"y": 47,
"weight": 2
},
{
"x": 28,
"y": 45,
"weight": 3
},
{
"x": 41,
"y": 38,
"weight": 1
},
{
"x": 49,
"y": 33,
"weight": 2
},
{
"x": 57,
"y": 35,
"weight": 3
},
{
"x": -5,
"y": 51,
"weight": 1
},
{
"x": 10,
"y": 56,
"weight": 2
},
{
"x": 27,
"y": 56,
"weight": 3
},
{
"x": 41,
"y": 50,
"weight": 1
},
{
"x": 51,
"y": 44,
"weight": 2
},
{
"x": 58,
"y": 44,
"weight": 3
}
],
"kernel": "gaussian",
"bandwidth": 9,
"columns": 60,
"rows": 40,
"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', 'density-map 예제 차트');
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>사용과 데이터
#많은 점의 군집과 공간적 집중을 탐색하세요.
밀도는 원시 관측값이 아닌 추정입니다. bandwidth와 좌표 단위에 따라 결과가 달라집니다.
데이터 계약
| 프로퍼티 | 입력 형식 |
|---|---|
data | { x, y, weight? } 배열입니다. |
bandwidth | 커널을 적용하는 범위입니다. |
kernel | 밀도 추정에 사용할 커널입니다. |
데이터를 갱신할 때
배열 안의 값을 직접 바꾸기보다 새 배열·객체를 프로퍼티에 할당하세요. 차트의 이벤트는 event.detail로 선택 결과를 전달합니다. 화면을 해제할 때 ResizeObserver와 앱에서 등록한 이벤트 리스너를 정리하세요.
기능별 예제
#24개의 기능 예제를 직접 조작하고 코드를 확인하세요. ‘미리보기에서 편집’을 누르면 위 설정 패널에서 옵션을 더 조합할 수 있습니다.
넓은 밀도 반경PRO
주변 점을 넓게 집계해 전반적인 밀도를 봅니다.
코드 보기
Epanechnikov 커널PRO
집계 커널을 바꿔 밀도 분포의 형태를 비교합니다.
코드 보기
포인터와 값 확인PRO
데이터를 가리키면 해당 지점의 값을 확인할 수 있습니다.
코드 보기
십자선 추적PRO
포인터를 움직여 가로·세로 좌표와 값을 함께 읽습니다.
코드 보기
드래그 확대와 이동PRO
드래그로 확대하고 Shift를 누른 채 이동합니다. Ctrl + 휠로 확대하거나 축소할 수 있습니다.
코드 보기
애니메이션 재생PRO
같은 예제를 다시 그려 초기 표시 애니메이션을 확인합니다.
코드 보기
애니메이션PRO
애니메이션의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
AxisPRO
Axis의 6가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
BandwidthPRO
Bandwidth의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
ComputePRO
Compute의 3가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
십자선PRO
십자선의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
데이터 입력PRO
데이터 입력의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
KernelPRO
Kernel의 6가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
대용량 데이터PRO
대용량 데이터의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
RenderPRO
Render의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
크기PRO
크기의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
툴팁PRO
툴팁의 13가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
Visual mapPRO
Visual map의 3가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
확대와 이동PRO
확대와 이동의 6가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
컨텍스트 메뉴PRO
컨텍스트 메뉴의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
데이터 컨텍스트 메뉴PRO
데이터 컨텍스트 메뉴의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
좌표와 데이터 조회PRO
좌표와 데이터 조회의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
OverviewPRO
Overview의 4가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
Streaming · 실시간 데이터 추가와 갱신PRO
실시간 데이터 추가와 갱신의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
화면에 적용하기
#미리보기 아래 코드 탭에서 현재 예제의 전체 데이터, 옵션, 이벤트 연결과 반응형 크기 처리를 확인하고 복사할 수 있습니다. 설치된 패키지를 해석할 수 있는 Vite 등의 앱 프로젝트에서 사용하세요.
API 레퍼런스
#sy-density-map의 전체 공개 API입니다. 객체와 배열은 JavaScript 프로퍼티로 전달하세요. 이름을 선택하면 적용 코드와 타입 계약을 확인할 수 있습니다.
주요 속성
| 속성 / 프로퍼티 | 타입 / 기본값 | 설명 |
|---|---|---|
DensityMapInput기본값 undefined | { x, y, weight? } 배열입니다. | |
number기본값 640 | 차트의 너비(px). 컨테이너가 바뀌면 ResizeObserver로 갱신합니다. | |
number기본값 400 | 차트의 높이(px). | |
| brandLogo | string기본값 undefined | 기본값은 Syidax 로고입니다. Pro의 chart.branding 권한으로 none 또는 PNG·JPEG·WebP data URL을 사용할 수 있습니다. |
| brandPosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'기본값 'bottom-right' | 로고를 고정할 코너입니다. Community·Pro, 화면과 이미지 내보내기에 동일하게 적용됩니다. |
| cellSize | number기본값 3 | CSS px per estimate cell (the grid follows the plot size); `columns` / `rows` override it. |
DensityMapBandwidthInput기본값 'auto' | 커널을 적용하는 범위입니다. | |
| bandwidthUnit | DensityMapBandwidthUnit기본값 'data' | `data` (default) — the bandwidth is in data units; `px` — in CSS px of the plot. |
DensityMapKernel기본값 'gaussian' | 밀도 추정에 사용할 커널입니다. | |
number기본값 0.02 | Cells under this fraction of the peak density are empty (the background shows through). | |
number기본값 0.06 | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. | |
| densityUnit | DensityMapUnitInput기본값 'mass' | 허용값: mass, per-area. 기본값: 'mass'. |
| xAxis | XAxisInput기본값 undefined | One x axis, or `[bottom, top, …]` slots (the multi x-axis; a slot may carry its own `min` / `max`, `kind: 'log' | 'time'` or `linkedTo` per the shared contract). |
| yAxis | YAxisInput기본값 undefined | One y axis, or `[left, right, …]` — a later slot may carry its own `min` / `max` (a second unit for the same y), a `kind` or `linkedTo`. |
| gridLines | CartesianGridLinesInput기본값 undefined | Grid lines default OFF (the plane tiles the plot). |
CartesianCrosshairInput기본값 undefined | Crosshair that follows the cursor across the plot. | |
CartesianZoomInput기본값 undefined | 확대·축소와 표시 범위의 동작 설정입니다. | |
| chartTitle | string기본값 undefined | 차트 내부 제목입니다. 데이터의 단위와 의미를 함께 설명하세요. |
| chartSubtitle | string기본값 undefined | 차트 내부 부제목입니다. |
CartesianTooltipInput기본값 undefined | 포인터에 따라 표시할 값, 위치, 내용의 툴팁 설정입니다. | |
| tooltipEnabled | boolean기본값 true | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean. |
| animated | boolean기본값 false | 초기 표시와 데이터 변경의 애니메이션 사용 여부입니다. |
| animationDuration | number기본값 600 | 애니메이션 지속 시간(ms). |
| animationEasing | DensityMapEasing기본값 'ease-out' | 허용값: linear, ease-out, ease-in, ease-in-out. 기본값: 'ease-out'. |
| animationType | DensityMapAnimationType기본값 undefined | 허용값: initial, update. 기본값: undefined. |
나머지 속성 21
| 속성 / 프로퍼티 | 타입 / 기본값 | 설명 |
|---|---|---|
| xMin | number기본값 undefined | Explicit domain ends (an omitted end follows the point extent padded by `padding`; `x-axis` / `y-axis` `min` / `max` also set them). |
| xMax | number기본값 undefined | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| yMin | number기본값 undefined | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| yMax | number기본값 undefined | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
number기본값 0.05 | The fraction of the span padded on each automatic domain end. | |
number기본값 undefined | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. | |
number기본값 undefined | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. | |
| computePath | DensityMapComputePathInput기본값 'auto' | 허용값: auto, cpu, gpu. 기본값: 'auto'. |
string | ReadonlyArray<string> | ReadonlyArray<readonly [number, string]>기본값 undefined | The colour ramp over the density domain (a scheme name, a colour list / comma list, or `[t, colour]` stops). | |
| valueMin | number기본값 undefined | Density domain ends; an omitted end follows 0 … the peak. |
| valueMax | number기본값 undefined | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| emptyColor | string기본값 'transparent' | The colour of an empty (under-threshold) cell — transparent by default. |
DensityMapLodMode기본값 'smooth' | The plane's level of detail: `smooth` (bilinear between cell centres — the default here), `auto`, `point`, `area`. | |
| enableMouseTracking | boolean기본값 true | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean. |
| tooltipFormat | (detail: DensityMapPointEventDetail) => string기본값 undefined | JavaScript 프로퍼티로 전달합니다. 타입: (detail: DensityMapPointEventDetail) => string. |
| streamSource | DensityMapStreamSource기본값 undefined | 실시간 데이터를 전달하는 스트림 소스입니다. 해당 타입의 계약을 확인하세요. |
| streamMax | number기본값 undefined | 보관할 스트리밍 데이터의 최대 수입니다. |
| streamWindow | number기본값 undefined | 화면에 유지할 스트리밍 데이터 구간입니다. |
| visualMap | VisualMapBinding | null기본값 undefined | A visual-map binding (a `sy-visual-map` snapshot + dimension); it overrides `colors` / `value-min` / `value-max` while bound. |
DensityMapEngineMode기본값 'auto' | auto·standard·pro 렌더러 선택입니다. 엔진 선택은 차트 종류의 Pro 사용 권한과 별개입니다. | |
DensityMapUnavailableBehaviour기본값 'fallback' | `fallback` shows the on-chart notice when the renderer cannot run; `error` throws. |
이벤트 14
| 이벤트 | detail 타입 | 설명 |
|---|---|---|
DensityMapRenderResult & { tier: DensityMapEngineTier; engine?: ChartEngineStatus } | 차트 그리기가 완료되면 렌더링 결과를 detail로 전달합니다. | |
DensityMapPointEventDetail | 점 선택 이벤트입니다. CustomEvent.detail에서 선택한 데이터와 인덱스를 읽습니다. | |
DensityMapPointEventDetail | null | CustomEvent.detail 타입: DensityMapPointEventDetail | null. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianCrosshairEventDetail | null | CustomEvent.detail 타입: CartesianCrosshairEventDetail | null. 이벤트 이름은 대소문자를 구분합니다. | |
ChartPointContextMenuEventDetail<DensityMapPointEventDetail> | CustomEvent.detail 타입: ChartPointContextMenuEventDetail<DensityMapPointEventDetail>. 이벤트 이름은 대소문자를 구분합니다. | |
{ count: number } | CustomEvent.detail 타입: { count: number }. 이벤트 이름은 대소문자를 구분합니다. | |
{ dropped: number } | CustomEvent.detail 타입: { dropped: number }. 이벤트 이름은 대소문자를 구분합니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianTooltipEventDetail | 내장 툴팁 표시 여부입니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianTooltipActionEventDetail | CustomEvent.detail 타입: CartesianTooltipActionEventDetail. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianZoomChangeEventDetail | Fired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state. |
메서드 39
Stencil 메서드는 Promise를 반환합니다. async 함수에서 await로 결과를 받으세요.
| 메서드 / 인수 | 반환 타입 | 설명 |
|---|---|---|
Promise<ChartDataTable> | Current normalized table, including the retained stream; independent of GPU availability. | |
Promise<DensityMapRenderResult> | Draws a frame now; rejects with the SyidaxLicenseError while the type is not entitled or the chart is frozen. | |
Promise<DensityMapEngineTier> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<string | undefined> | The reason the renderer cannot run (`undefined` while it runs). | |
| data: DensityMapInput | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
| point: DensityMapPoint | DensityMapTuple | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
| points: ReadonlyArray<DensityMapPoint | DensityMapTuple> | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
| count: number | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
| points: ReadonlyArray<DensityMapPoint | DensityMapTuple> | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
Promise<DensityMapStreamSource | undefined> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| options: { duration?: number; easing?: DensityMapEasing; enabled?: boolean; type?: DensityMapAnimationType } | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| cssX: number, cssY: number | Promise<DensityMapPointEventDetail | null> | The estimate cell under host-relative CSS coordinates, or null (the density waits for a pending readback). |
| col: number, row: number | Promise<number | null> | The density of a cell in the public unit (`null` under the threshold or outside the grid). |
| x: number, y: number | Promise<number | null> | The density at a data-space point in the public unit (`null` outside the domain or under the threshold). |
Promise<DensityMapValueExtent | null> | The density extent of the estimate in the public unit (min 0, max = the peak, finite = cells over the threshold). | |
| col: number, row: number | Promise<CartesianTooltipEventDetail | null> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
| index: number | Promise<CartesianTooltipEventDetail | null> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| col: number, row: number | Promise<DensityMapPointEventDetail | null> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
Promise<{ columns: number; rows: number; cells: number }> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<DensityMapDomain> | The data domain the grid spans. | |
Promise<DensityMapBandwidth> | The resolved bandwidth (data units, CSS px, cells; `auto` when Silverman chose it). | |
Promise<{ kernel: DensityMapKernel; x: number[]; y: number[]; radius: { x: number; y: number } }> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<DensityMapComputeStats> | The statistics of the last estimate (points, grid, kernel, bandwidth, radius, compute time, peak, mass). | |
Promise<Float32Array> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<{ values: Float32Array; densityMax: number; mass: number; binned: number; finite: number; computeMs: number; radius: { x: number; y: number } }> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| binding: VisualMapBinding | null | Promise<VisualMapBinding | null> | Bind (or clear with null) a visual-map snapshot; it wins over the `visualMap` prop until the prop changes again. |
Promise<VisualMapBinding | null> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| request?: VisualMapExtentRequest | Promise<VisualMapExtent | null> | The extent of a dimension: `value` = the density (0 … peak), `x` / `y` = the domain, `index` = the cell indexes. |
| request: CartesianZoomRequest | Promise<CartesianZoomChangeEventDetail | null> | Zoom to explicit windows in data units: `x` / `y` as `{ min, max }` or `[min, max]` (`null` clears that orientation); `xAxis` / `yAxis` name the axis by id or slot index (default: the primary axis). |
| factor: number, anchorFraction?: number | Promise<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? }`); 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?: CartesianZoomExtentRequest | Promise<CartesianZoomExtentDetail | null> | The full extent (and key) of the primary — or the named — master axes (the field's x / y domain). |
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. |
일치하는 API가 없습니다.