---
code: "3D-07"
id: "c-net3d"
tab: "spatial"
kind: "core"
title: "3D Network · 공간 네트워크"
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", "show connections", "inspect shape in 3D"]
tags: ["3d", "spatial", "webgl", "network", "flow", "공간", "네트워크"]
gallery: "https://graph.heal7.com/#3D-07"
js: "/sku/3D-07.js"
---

# [3D-07] 3D Network · 공간 네트워크

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

## 언제 가져가나
노드(scatter3D) + 엣지(lines3D)를 입체 공간에 — 회전으로 층 분리 확인.

**응용** 분자 모형, 도시 간 항로, 신경망 구조.

## 데이터 모양
- family: `spatial-3d`
- dataShape: 3D coordinates, surfaces or paths
- tasks: inspect spatial form, rotate perspective, show structure, show connections, inspect shape in 3D
- tags: 3d, spatial, webgl, network, flow, 공간, 네트워크


## 의존
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 N = 14;
  const nodes = [];
  for(let i=0;i<N;i++) nodes.push([Math.random()*10-5, Math.random()*10-5, Math.random()*10-5]);
  const lines = [];
  for(let i=0;i<18;i++){
    const a = Math.floor(Math.random()*N), b = Math.floor(Math.random()*N);
    if(a!==b) lines.push({coords:[nodes[a], nodes[b]]});
  }
  reg('c-net3d', {
    backgroundColor:T.bg,
    xAxis3D:{type:'value', show:false}, yAxis3D:{type:'value', show:false}, zAxis3D:{type:'value', show:false},
    grid3D:{viewControl:{autoRotate:true, autoRotateSpeed:5, distance:180},
      axisLine:{lineStyle:{color:'rgba(255,255,255,.05)'}}, splitLine:{show:false}, axisPointer:{show:false}, boxWidth:140, boxDepth:140, boxHeight:120},
    series:[
      ...lines.map((edge, idx) => ({
        type:'line3D',
        coordinateSystem:'cartesian3D',
        data:edge.coords,
        lineStyle:{
          color:idx % 4 === 0 ? T.gold : 'rgba(232,192,105,.42)',
          width:idx % 5 === 0 ? 3 : 2,
          opacity:0.72
        },
        animation:false
      })),
      {type:'scatter3D', coordinateSystem:'cartesian3D', data:nodes, symbolSize:14, itemStyle:{color:T.royal, opacity:.9, borderColor:'#fff', borderWidth:1}}
    ]
  });
};
factory();
```

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

```js
function(){
  const N = 14;
  const nodes = [];
  for(let i=0;i<N;i++) nodes.push([Math.random()*10-5, Math.random()*10-5, Math.random()*10-5]);
  const lines = [];
  for(let i=0;i<18;i++){
    const a = Math.floor(Math.random()*N), b = Math.floor(Math.random()*N);
    if(a!==b) lines.push({coords:[nodes[a], nodes[b]]});
  }
  reg('c-net3d', {
    backgroundColor:T.bg,
    xAxis3D:{type:'value', show:false}, yAxis3D:{type:'value', show:false}, zAxis3D:{type:'value', show:false},
    grid3D:{viewControl:{autoRotate:true, autoRotateSpeed:5, distance:180},
      axisLine:{lineStyle:{color:'rgba(255,255,255,.05)'}}, splitLine:{show:false}, axisPointer:{show:false}, boxWidth:140, boxDepth:140, boxHeight:120},
    series:[
      ...lines.map((edge, idx) => ({
        type:'line3D',
        coordinateSystem:'cartesian3D',
        data:edge.coords,
        lineStyle:{
          color:idx % 4 === 0 ? T.gold : 'rgba(232,192,105,.42)',
          width:idx % 5 === 0 ? 3 : 2,
          opacity:0.72
        },
        animation:false
      })),
      {type:'scatter3D', coordinateSystem:'cartesian3D', data:nodes, symbolSize:14, itemStyle:{color:T.royal, opacity:.9, borderColor:'#fff', borderWidth:1}}
    ]
  });
}
```

