---
code: "3D-06"
id: "c-bubble3d"
tab: "spatial"
kind: "core"
title: "3D Bubble · 입체 버블"
library: "ECharts-GL"
deps: ["echarts@5", "echarts-gl"]
load: "med"
pasteKind: "echarts-mount"
family: "spatial-3d"
dataShape: "3D coordinates, surfaces or paths"
tasks: ["inspect spatial form", "rotate perspective", "show structure", "compare profiles", "inspect shape in 3D"]
tags: ["3d", "spatial", "webgl", "multivariate", "bubble", "입체", "버블"]
gallery: "https://graph.heal7.com/#3D-06"
js: "/sku/3D-06.js"
---

# [3D-06] 3D Bubble · 입체 버블

> AI 붙여넣기 카드. 갤러리 런타임(`main.js`)이 아니라 이 파일을 가져와라.

## 언제 가져가나
크기까지 4번째 변수로 — 3축 + 크기 + 색 = 5차원 시각화.

**응용** 다변량 제품 매핑, 도시 인구·소득·면적·만족도.

## 데이터 모양
- family: `spatial-3d`
- dataShape: 3D coordinates, surfaces or paths
- tasks: inspect spatial form, rotate perspective, show structure, compare profiles, inspect shape in 3D
- tags: 3d, spatial, webgl, multivariate, bubble, 입체, 버블


## 의존
echarts@5, echarts-gl · load `med` · library `ECharts-GL`

## 붙여넣는 법
1. echarts 5.x 로드 (GL이면 echarts-gl도)
2. 컨테이너 id를 원본 id와 맞추거나 `document.getElementById` 한 줄만 바꾼다
3. `T`, `reg`, `cssv` 가 필요하면 갤러리 테마 스텁을 함께 가져간다

```js
const T = {
  "bg": "transparent",
  "fg": "#ece8f5",
  "sub": "#a59bbd",
  "grid": "rgba(255,255,255,.08)",
  "gold": "#e8c069",
  "royal": "#6b8cff",
  "rose": "#e07a9f",
  "teal": "#6dd2c4",
  "plum": "#b487e8"
};
const cssv = (n, fb) => (getComputedStyle(document.documentElement).getPropertyValue(n).trim() || fb);
const isDark = () => document.documentElement.getAttribute('data-theme') !== 'light';
const charts = [];
const reg = (id, opt) => {
  const dom = document.getElementById(id); if (!dom) return;
  const c = echarts.init(dom, null, {renderer:'canvas'});
  c.setOption(opt);
  charts.push(c);
  return c;
};
const factory = function(){
  const data = [];
  for(let i=0;i<80;i++){
    data.push([Math.random()*10, Math.random()*10, Math.random()*10, 5+Math.random()*30, Math.random()]);
  }
  reg('c-bubble3d', {
    backgroundColor:T.bg,
    visualMap:{show:false, dimension:4, min:0, max:1, inRange:{color:[T.royal, T.plum, T.gold]}},
    xAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:9}}, yAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:9}}, zAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:9}},
    grid3D:{viewControl:{autoRotate:true, autoRotateSpeed:5}, axisLine:{lineStyle:{color:T.grid}}, splitLine:{lineStyle:{color:T.grid}}},
    series:[{type:'scatter3D', data, symbolSize:p=>p[3], itemStyle:{opacity:.7}}]
  });
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 2604-2616
- gallery: https://graph.heal7.com/#3D-06
- raw js: https://graph.heal7.com/sku/3D-06.js

```js
function(){
  const data = [];
  for(let i=0;i<80;i++){
    data.push([Math.random()*10, Math.random()*10, Math.random()*10, 5+Math.random()*30, Math.random()]);
  }
  reg('c-bubble3d', {
    backgroundColor:T.bg,
    visualMap:{show:false, dimension:4, min:0, max:1, inRange:{color:[T.royal, T.plum, T.gold]}},
    xAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:9}}, yAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:9}}, zAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:9}},
    grid3D:{viewControl:{autoRotate:true, autoRotateSpeed:5}, axisLine:{lineStyle:{color:T.grid}}, splitLine:{lineStyle:{color:T.grid}}},
    series:[{type:'scatter3D', data, symbolSize:p=>p[3], itemStyle:{opacity:.7}}]
  });
}
```

