---
code: "3D-08"
id: "c-heat3d"
tab: "spatial"
kind: "core"
title: "3D Heatmap · 입체 히트맵"
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", "inspect shape in 3D"]
tags: ["3d", "spatial", "webgl", "heatmap", "입체", "히트맵"]
gallery: "https://graph.heal7.com/#3D-08"
js: "/sku/3D-08.js"
---

# [3D-08] 3D Heatmap · 입체 히트맵

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

## 언제 가져가나
2D 히트맵을 막대 높이로 한 차원 더 — 거리감으로 강도 인식 강화.

**응용** 지역별 트래픽 강도, 시간×요일 활동 입체.

## 데이터 모양
- family: `spatial-3d`
- dataShape: 3D coordinates, surfaces or paths
- tasks: inspect spatial form, rotate perspective, show structure, inspect shape in 3D
- tags: 3d, spatial, webgl, heatmap, 입체, 히트맵


## 의존
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 X = 14, Y = 8;
  const data = [];
  for(let y=0;y<Y;y++) for(let x=0;x<X;x++){
    const v = Math.exp(-Math.hypot(x-X/2, y-Y/2)/2.4)*100 + Math.random()*15;
    data.push([x, y, +v.toFixed(1)]);
  }
  reg('c-heat3d', {
    backgroundColor:T.bg,
    visualMap:{show:false, min:0, max:120, inRange:{color:['#1f1640','#3a2a5e', T.royal, T.plum, T.gold]}},
    xAxis3D:{type:'value', max:X-1, axisLabel:{color:T.sub,fontSize:9}}, yAxis3D:{type:'value', max:Y-1, axisLabel:{color:T.sub,fontSize:9}}, zAxis3D:{type:'value', max:120, axisLabel:{color:T.sub,fontSize:9}},
    grid3D:{viewControl:{autoRotate:true, autoRotateSpeed:5, distance:200}, axisLine:{lineStyle:{color:T.grid}}, splitLine:{lineStyle:{color:T.grid}}, boxWidth:180, boxDepth:90, boxHeight:60},
    series:[{type:'bar3D', data, shading:'lambert', bevelSize:.1, bevelSmoothness:4, itemStyle:{opacity:.92}}]
  });
};
factory();
```

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

```js
function(){
  const X = 14, Y = 8;
  const data = [];
  for(let y=0;y<Y;y++) for(let x=0;x<X;x++){
    const v = Math.exp(-Math.hypot(x-X/2, y-Y/2)/2.4)*100 + Math.random()*15;
    data.push([x, y, +v.toFixed(1)]);
  }
  reg('c-heat3d', {
    backgroundColor:T.bg,
    visualMap:{show:false, min:0, max:120, inRange:{color:['#1f1640','#3a2a5e', T.royal, T.plum, T.gold]}},
    xAxis3D:{type:'value', max:X-1, axisLabel:{color:T.sub,fontSize:9}}, yAxis3D:{type:'value', max:Y-1, axisLabel:{color:T.sub,fontSize:9}}, zAxis3D:{type:'value', max:120, axisLabel:{color:T.sub,fontSize:9}},
    grid3D:{viewControl:{autoRotate:true, autoRotateSpeed:5, distance:200}, axisLine:{lineStyle:{color:T.grid}}, splitLine:{lineStyle:{color:T.grid}}, boxWidth:180, boxDepth:90, boxHeight:60},
    series:[{type:'bar3D', data, shading:'lambert', bevelSize:.1, bevelSmoothness:4, itemStyle:{opacity:.92}}]
  });
}
```

