---
code: "3D-01"
id: "c-bars3d"
tab: "spatial"
kind: "core"
title: "3D Bars · 입체 막대"
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 categories", "inspect shape in 3D"]
tags: ["3d", "spatial", "webgl", "comparison", "ranking", "bars", "입체", "막대"]
gallery: "https://graph.heal7.com/#3D-01"
js: "/sku/3D-01.js"
---

# [3D-01] 3D Bars · 입체 막대

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

## 언제 가져가나
8캐릭터 × 5오행 매트릭스를 3D로. 자동 회전.

**응용** 부서×분기 매출, 지역×제품 판매량 비교.

## 데이터 모양
- family: `spatial-3d`
- dataShape: 3D coordinates, surfaces or paths
- tasks: inspect spatial form, rotate perspective, show structure, compare categories, inspect shape in 3D
- tags: 3d, spatial, webgl, comparison, ranking, bars, 입체, 막대


## 의존
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 xs = ['탐구','창조','조화','실행','보호','혁신','통찰','도약'];
  const ys = ['목','화','토','금','수'];
  const data = [];
  for(let i=0;i<8;i++) for(let j=0;j<5;j++) data.push([i,j, Math.round(30+Math.random()*60)]);
  // Highlight "본인" cell
  data[2*5+1][2] = 100;
  reg('c-bars3d', {
    backgroundColor:T.bg, tooltip:{},
    visualMap:{min:30,max:100, show:false, inRange:{color:['#1f1640','#6b8cff','#b487e8','#e8c069']}},
    xAxis3D:{type:'category', data:xs, axisLabel:{color:T.sub,fontSize:11}},
    yAxis3D:{type:'category', data:ys, axisLabel:{color:T.fg,fontSize:13,fontWeight:700}},
    zAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:10}},
    grid3D:{boxWidth:160, boxDepth:90, boxHeight:70, viewControl:{autoRotate:true, autoRotateSpeed:6, distance:200}, light:{main:{intensity:1.2, shadow:true}, ambient:{intensity:.4}},
      axisLine:{lineStyle:{color:T.grid}}, splitLine:{lineStyle:{color:T.grid}}},
    series:[{type:'bar3D', data, shading:'realistic', bevelSize:.2, bevelSmoothness:4,
      label:{show:false}, itemStyle:{opacity:.92}}]
  });
};
factory();
```

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

```js
function(){
  const xs = ['탐구','창조','조화','실행','보호','혁신','통찰','도약'];
  const ys = ['목','화','토','금','수'];
  const data = [];
  for(let i=0;i<8;i++) for(let j=0;j<5;j++) data.push([i,j, Math.round(30+Math.random()*60)]);
  // Highlight "본인" cell
  data[2*5+1][2] = 100;
  reg('c-bars3d', {
    backgroundColor:T.bg, tooltip:{},
    visualMap:{min:30,max:100, show:false, inRange:{color:['#1f1640','#6b8cff','#b487e8','#e8c069']}},
    xAxis3D:{type:'category', data:xs, axisLabel:{color:T.sub,fontSize:11}},
    yAxis3D:{type:'category', data:ys, axisLabel:{color:T.fg,fontSize:13,fontWeight:700}},
    zAxis3D:{type:'value', axisLabel:{color:T.sub,fontSize:10}},
    grid3D:{boxWidth:160, boxDepth:90, boxHeight:70, viewControl:{autoRotate:true, autoRotateSpeed:6, distance:200}, light:{main:{intensity:1.2, shadow:true}, ambient:{intensity:.4}},
      axisLine:{lineStyle:{color:T.grid}}, splitLine:{lineStyle:{color:T.grid}}},
    series:[{type:'bar3D', data, shading:'realistic', bevelSize:.2, bevelSmoothness:4,
      label:{show:false}, itemStyle:{opacity:.92}}]
  });
}
```

