Bubble.
COMMUNITY점의 위치와 크기로 세 지표를 함께 읽습니다.
LIVE EXAMPLE
시장 비교
표현과 스타일9
축과 격자14
범례와 상호작용13
제목과 크기3
X·Y 위치에 더해 z를 버블 크기로 표시합니다. 모든 값은 예시 데이터입니다.
코드 보기
<div id="chart-container" style="width: 100%; min-width: 0;"></div>
<script type="module">
import { defineCustomElement as define0 } from '@syidax/advanced/components/sy-bubble-chart.js';
define0();
const specs = [
{
"id": "example-chart",
"tag": "sy-bubble-chart",
"props": {
"data": [
{
"x": 20,
"y": 70,
"z": 30,
"name": "A"
},
{
"x": 45,
"y": 55,
"z": 60,
"name": "B"
},
{
"x": 75,
"y": 80,
"z": 45,
"name": "C"
},
{
"x": 60,
"y": 30,
"z": 20,
"name": "D"
}
],
"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', 'bubble 예제 차트');
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>사용과 데이터
#두 좌표와 규모를 가진 시장·제품·프로젝트를 비교하세요.
버블이 겹치면 작은 항목을 놓칠 수 있습니다. z의 의미와 단위를 명시하세요.
데이터 계약
| 프로퍼티 | 입력 형식 |
|---|---|
data | { x, y, z, name? } 배열입니다. x·y는 위치, z는 크기입니다. |
데이터를 갱신할 때
배열 안의 값을 직접 바꾸기보다 새 배열·객체를 프로퍼티에 할당하세요. 차트의 이벤트는 event.detail로 선택 결과를 전달합니다. 화면을 해제할 때 ResizeObserver와 앱에서 등록한 이벤트 리스너를 정리하세요.
기능별 예제
#22개의 기능 예제를 직접 조작하고 코드를 확인하세요. ‘미리보기에서 편집’을 누르면 위 설정 패널에서 옵션을 더 조합할 수 있습니다.
패킹 레이아웃
버블을 겹치지 않게 배치해 규모를 비교합니다.
코드 보기
버블 크기 범위
가장 작은 버블과 가장 큰 버블의 반지름을 정합니다.
코드 보기
포인터와 값 확인
데이터를 가리키면 해당 지점의 값을 확인할 수 있습니다.
코드 보기
십자선 추적
포인터를 움직여 가로·세로 좌표와 값을 함께 읽습니다.
코드 보기
드래그 확대와 이동
드래그로 확대하고 Shift를 누른 채 이동합니다. Ctrl + 휠로 확대하거나 축소할 수 있습니다.
코드 보기
애니메이션 재생
같은 예제를 다시 그려 초기 표시 애니메이션을 확인합니다.
코드 보기
애니메이션
애니메이션의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
Axis
Axis의 7가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
Color
Color의 4가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
십자선
십자선의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
데이터 입력
데이터 입력의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
대용량 데이터
대용량 데이터의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
크기
크기의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
툴팁
툴팁의 13가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
확대와 이동
확대와 이동의 6가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
컨텍스트 메뉴
컨텍스트 메뉴의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
데이터 컨텍스트 메뉴
데이터 컨텍스트 메뉴의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
좌표와 데이터 조회
좌표와 데이터 조회의 1가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
Overview
Overview의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
Streaming · 실시간 갱신PRO
시작을 누르면 한 점씩 데이터가 추가됩니다. 최근 40개를 표시하며, 갱신 속도·일시정지·초기화를 직접 조작할 수 있습니다.
코드 보기
Streaming · 배치 추가PRO
시작을 누르면 4개씩 데이터가 추가됩니다. 최근 40개를 표시하며, 갱신 속도·일시정지·초기화를 직접 조작할 수 있습니다.
코드 보기
Streaming · 실시간 데이터 추가와 갱신PRO
실시간 데이터 추가와 갱신의 5가지 예제를 비교합니다. 예제 안의 버튼과 아래 옵션을 조작하면 실행 결과와 적용 코드가 함께 바뀝니다.
코드 보기
화면에 적용하기
#미리보기 아래 코드 탭에서 현재 예제의 전체 데이터, 옵션, 이벤트 연결과 반응형 크기 처리를 확인하고 복사할 수 있습니다. 설치된 패키지를 해석할 수 있는 Vite 등의 앱 프로젝트에서 사용하세요.
API 레퍼런스
#sy-bubble-chart의 전체 공개 API입니다. 객체와 배열은 JavaScript 프로퍼티로 전달하세요. 이름을 선택하면 적용 코드와 타입 계약을 확인할 수 있습니다.
주요 속성
| 속성 / 프로퍼티 | 타입 / 기본값 | 설명 |
|---|---|---|
BubbleData기본값 undefined | { x, y, z, name? } 배열입니다. x·y는 위치, z는 크기입니다. | |
number기본값 900 | 차트의 너비(px). 컨테이너가 바뀌면 ResizeObserver로 갱신합니다. | |
number기본값 360 | 차트의 높이(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, 화면과 이미지 내보내기에 동일하게 적용됩니다. |
| xAxis | XAxisInput기본값 undefined | The x axis (its `label` / `min` / `max` / `format` / `show` / `kind`), or `[bottom, top, …]` slots (the multi x-axis: `position`, `linkedTo`, `kind: 'time' | 'log'` per the shared contract). |
| yAxis | YAxisInput기본값 undefined | The y axis: one input, or `[left, right, …]` slots (the dual / multi y-axis). |
| gridLines | CartesianGridLinesInput기본값 undefined | Grid lines: both axes on by default. |
CartesianCrosshairInput기본값 undefined | Crosshair that follows the cursor across the plot. | |
CartesianZoomInput기본값 undefined | 확대·축소와 표시 범위의 동작 설정입니다. | |
| fillAlpha | number기본값 DEFAULT_FILL_ALPHA | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| borderWidth | number기본값 1 | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| minRadius | number기본값 BUBBLE_DEFAULT_MIN_RADIUS | The radius range in CSS px the z range maps onto. |
| maxRadius | number기본값 BUBBLE_DEFAULT_MAX_RADIUS | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| sizeScale | BubbleSizeScale | string기본값 'area' | `area` (the disc area proportional to z; the default) or `radius`. |
BubbleLayoutMode | string기본값 'xy' | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: BubbleLayoutMode | string. | |
| packPadding | number기본값 2 | Pack mode: the gap between tangent bubbles in CSS px; `contain` only shrinks the cluster to fit, `fill` scales it to touch the shorter side. |
BubbleShading | string기본값 'flat' | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: BubbleShading | string. | |
| shadeStrength | number기본값 1 | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| chartTitle | string기본값 undefined | 차트 내부 제목입니다. 데이터의 단위와 의미를 함께 설명하세요. |
| chartSubtitle | string기본값 undefined | 차트 내부 부제목입니다. |
CartesianTooltipInput기본값 undefined | 포인터에 따라 표시할 값, 위치, 내용의 툴팁 설정입니다. | |
| tooltipEnabled | boolean기본값 true | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean. |
| animated | boolean기본값 false | 초기 표시와 데이터 변경의 애니메이션 사용 여부입니다. |
| animationDuration | number기본값 600 | 애니메이션 지속 시간(ms). |
| animationEasing | BubbleEasing기본값 'ease-out' | 허용값: linear, ease-out, ease-in, ease-in-out. 기본값: 'ease-out'. |
| animationType | BubbleAnimationType기본값 undefined | 허용값: initial, update. 기본값: undefined. |
나머지 속성 16
| 속성 / 프로퍼티 | 타입 / 기본값 | 설명 |
|---|---|---|
number기본값 BUBBLE_DEFAULT_PADDING | The automatic domain pads each span by this share (default 5 %). | |
string기본값 DEFAULT_COLOR | The bubble colour: the border, and the fill at `fill-alpha`. | |
| borderColor | string기본값 'auto' | The border colour (`auto` = the bubble colour) and its thickness in CSS px (0 = none). |
| activeColor | string기본값 DEFAULT_ACTIVE_COLOR | The accent fill of the hovered / focused bubble. |
| zMin | number기본값 undefined | The z range (the data's when unset): z at or below `z-min` takes the min radius, at or above `z-max` the max. |
| zMax | number기본값 undefined | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: number. |
| packFit | BubblePackFit | string기본값 'contain' | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: BubblePackFit | string. |
| visualMap | VisualMapBinding | null기본값 undefined | JavaScript 프로퍼티로 전달합니다. 타입: VisualMapBinding | null. |
| enableMouseTracking | boolean기본값 true | HTML attribute 또는 JavaScript 프로퍼티로 설정합니다. 타입: boolean. |
| tooltipFormat | (detail: BubblePointEventDetail) => string기본값 undefined | JavaScript 프로퍼티로 전달합니다. 타입: (detail: BubblePointEventDetail) => string. |
| streamSource | BubbleStreamSource기본값 undefined | 실시간 데이터를 전달하는 스트림 소스입니다. 해당 타입의 계약을 확인하세요. |
| streamMax | number기본값 undefined | 보관할 스트리밍 데이터의 최대 수입니다. |
| streamWindow | number기본값 undefined | 화면에 유지할 스트리밍 데이터 구간입니다. |
BubbleEngineMode기본값 'auto' | auto·standard·pro 렌더러 선택입니다. 엔진 선택은 차트 종류의 Pro 사용 권한과 별개입니다. | |
| proThreshold | number기본값 BUBBLE_DEFAULT_PRO_THRESHOLD | `auto` switches to the WebGPU renderer at this many bubbles (a missing or non-positive value uses 50,000). |
BubbleUnavailableBehaviour기본값 'fallback' | `fallback` (the Standard renderer and the notice) or `error` (an explicit `engine="pro"` that cannot run throws). |
이벤트 14
| 이벤트 | detail 타입 | 설명 |
|---|---|---|
BubbleRenderResult & { tier: BubbleEngineTier } | 차트 그리기가 완료되면 렌더링 결과를 detail로 전달합니다. | |
BubblePointEventDetail | 점 선택 이벤트입니다. CustomEvent.detail에서 선택한 데이터와 인덱스를 읽습니다. | |
BubblePointEventDetail | null | CustomEvent.detail 타입: BubblePointEventDetail | null. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianCrosshairEventDetail | null | CustomEvent.detail 타입: CartesianCrosshairEventDetail | null. 이벤트 이름은 대소문자를 구분합니다. | |
ChartPointContextMenuEventDetail<BubblePointEventDetail> | CustomEvent.detail 타입: ChartPointContextMenuEventDetail<BubblePointEventDetail>. 이벤트 이름은 대소문자를 구분합니다. | |
{ count: number } | CustomEvent.detail 타입: { count: number }. 이벤트 이름은 대소문자를 구분합니다. | |
{ dropped: number } | CustomEvent.detail 타입: { dropped: number }. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianTooltipEventDetail | 내장 툴팁 표시 여부입니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianTooltipActionEventDetail | CustomEvent.detail 타입: CartesianTooltipActionEventDetail. 이벤트 이름은 대소문자를 구분합니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
void | CustomEvent.detail 타입: void. 이벤트 이름은 대소문자를 구분합니다. | |
CartesianZoomChangeEventDetail | Fired after every zoom change (drag / pan / wheel / pinch / keyboard / api / reset) with the new state. |
메서드 35
Stencil 메서드는 Promise를 반환합니다. async 함수에서 await로 결과를 받으세요.
| 메서드 / 인수 | 반환 타입 | 설명 |
|---|---|---|
Promise<ChartDataTable> | Current normalized table, including the retained stream; independent of GPU availability. | |
Promise<BubbleRenderResult> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<BubbleEngineTier> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<string | undefined> | Why the WebGPU renderer could not run (the fallback notice's reason); undefined when nothing fell back. | |
| data: BubbleData | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
| datum: BubbleDatumInput | Promise<void> | Append one bubble to the stream. |
| data: ReadonlyArray<BubbleDatumInput> | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
| count: number | Promise<void> | Drop the oldest streamed bubbles (the `data` bubbles are not the stream); with nothing streamed it does nothing and asks nothing. |
| data: ReadonlyArray<BubbleDatumInput> | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
Promise<BubbleStreamSource | undefined> | The stream session's source (Chart Pro): like the stream methods it waits for a license still being confirmed. | |
| options: { duration?: number; easing?: BubbleEasing; enabled?: boolean; type?: BubbleAnimationType } | Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<void> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| cssX: number, cssY: number | Promise<BubblePointEventDetail | null> | The bubble under a host-local CSS point (the smallest disc containing it), or null. |
| index: number | Promise<BubblePoint | null> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. |
Promise<number> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<BubblePoint[]> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<BubbleExtent> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<BubbleDomain> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
Promise<BubbleRadiusScale> | The z → radius mapping the chart resolved (the z range, the radius range in CSS px, the scale). | |
Promise<BubblePackLayout | null> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| binding: VisualMapBinding | null | Promise<VisualMapBinding | null> | Bind (or clear) a visual map: every bubble is filled through it on the next frame (a datum's own colour still wins). |
Promise<VisualMapBinding | null> | 비동기 메서드입니다. 아래 인수 타입과 반환 타입을 확인하세요. | |
| request?: VisualMapExtentRequest | Promise<VisualMapExtent | null> | The extent a bound `sy-visual-map` adopts as its domain: z (`value` / `z`), x, y, or the index range. |
| index: number | Promise<CartesianTooltipEventDetail | null> | Open the tooltip on a bubble (the facade's `showTooltipAtPoint` routes here); null off the bubbles or with the tooltip off. |
Promise<void> | Close every tooltip. | |
| index: number | Promise<BubblePointEventDetail | null> | Move the keyboard focus ring to a bubble (null off the bubbles); emits pointHover like the walk. |
| request: CartesianZoomRequest | Promise<CartesianZoomChangeEventDetail | null> | Zoom to explicit windows: `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 (pack mode: the unit square). |
Promise<ChartEngineStatus> | The requested engine, the engine that draws and why (ROADMAP-loading §5.3, CHART-ADD-08) — the last engine decision. A Chart Pro license decision names `chart.webgpu` and its state; renderer causes (not in this build, no WebGPU, a failed GPU) stay apart and never list an entitlement. |
일치하는 API가 없습니다.