---
code: "3D-09"
id: "c-contour3d"
tab: "spatial"
kind: "core"
title: "3D Contour Surface · 등고선 표면"
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", "contour", "surface", "등고선", "표면"]
gallery: "https://graph.heal7.com/#3D-09"
js: "/sku/3D-09.js"
---

# [3D-09] 3D Contour Surface · 등고선 표면

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

## 언제 가져가나
3D 표면 위에 등고선 색대 — 지형의 고저와 등고를 동시에 인식.

**응용** 적합도 지형(loss surface), 압력장, 지형 모델링.

## 데이터 모양
- 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, contour, surface, 등고선, 표면


## 의존
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(){
  if(!echarts || !echarts.registerCoordinateSystem) {} // GL probably loaded
  const data=[]; const step=2;
  for(let x=-30;x<=30;x+=step) for(let y=-30;y<=30;y+=step){
    const z = Math.sin(x/8) * Math.cos(y/8) * 20 + Math.exp(-(x*x+y*y)/600)*15;
    data.push([x,y,z]);
  }
  try{
    const dom = document.getElementById('c-contour3d');
    if(!dom) return;
    const c = echarts.init(dom, null, {renderer:'canvas'});
    c.setOption({
      backgroundColor:T.bg,
      tooltip:{},
      visualMap:{show:false, dimension:2, min:-25, max:35, inRange:{color:['#1a3a6b','#3a6b9a','#6dd2c4','#e8c069','#e07a5f']}},
      xAxis3D:{type:'value', axisLabel:{color:T.sub}}, yAxis3D:{type:'value', axisLabel:{color:T.sub}}, zAxis3D:{type:'value', axisLabel:{color:T.sub}},
      grid3D:{boxWidth:120, boxDepth:120, boxHeight:60, viewControl:{autoRotate:true, autoRotateSpeed:6, distance:170}, light:{main:{intensity:1.1}, ambient:{intensity:0.4}}},
      series:[{
        type:'surface', data, wireframe:{show:true, lineStyle:{color:'rgba(255,255,255,.15)'}},
        shading:'realistic', itemStyle:{opacity:0.95}
      }]
    });
    charts.push(c);
  }catch(e){console.warn('contour3d', e);}
};
factory();
```

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

```js
function(){
  if(!echarts || !echarts.registerCoordinateSystem) {} // GL probably loaded
  const data=[]; const step=2;
  for(let x=-30;x<=30;x+=step) for(let y=-30;y<=30;y+=step){
    const z = Math.sin(x/8) * Math.cos(y/8) * 20 + Math.exp(-(x*x+y*y)/600)*15;
    data.push([x,y,z]);
  }
  try{
    const dom = document.getElementById('c-contour3d');
    if(!dom) return;
    const c = echarts.init(dom, null, {renderer:'canvas'});
    c.setOption({
      backgroundColor:T.bg,
      tooltip:{},
      visualMap:{show:false, dimension:2, min:-25, max:35, inRange:{color:['#1a3a6b','#3a6b9a','#6dd2c4','#e8c069','#e07a5f']}},
      xAxis3D:{type:'value', axisLabel:{color:T.sub}}, yAxis3D:{type:'value', axisLabel:{color:T.sub}}, zAxis3D:{type:'value', axisLabel:{color:T.sub}},
      grid3D:{boxWidth:120, boxDepth:120, boxHeight:60, viewControl:{autoRotate:true, autoRotateSpeed:6, distance:170}, light:{main:{intensity:1.1}, ambient:{intensity:0.4}}},
      series:[{
        type:'surface', data, wireframe:{show:true, lineStyle:{color:'rgba(255,255,255,.15)'}},
        shading:'realistic', itemStyle:{opacity:0.95}
      }]
    });
    charts.push(c);
  }catch(e){console.warn('contour3d', e);}
}
```

