---
code: "3D-10"
id: "c-helix"
tab: "spatial"
kind: "core"
title: "DNA Helix · 이중 나선"
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", "dna", "helix", "이중", "나선"]
gallery: "https://graph.heal7.com/#3D-10"
js: "/sku/3D-10.js"
---

# [3D-10] DNA Helix · 이중 나선

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

## 언제 가져가나
두 가닥 나선 + 가로 연결선 — 회전하면 페어링 구조가 명확해진다.

**응용** 분자/생체 시각화, 페어링 데이터, 시간×시간 비교 입체.

## 데이터 모양
- 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, dna, helix, 이중, 나선


## 의존
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(){
  try{
    const dom = document.getElementById('c-helix'); if(!dom) return;
    const c = echarts.init(dom, null, {renderer:'canvas'});
    const N=80, R=20, H=60;
    const strandA=[], strandB=[], rungs=[];
    for(let i=0;i<N;i++){
      const t = i/(N-1);
      const a = t*Math.PI*8;
      const z = -H/2 + t*H;
      const xa = Math.cos(a)*R, ya = Math.sin(a)*R;
      const xb = Math.cos(a+Math.PI)*R, yb = Math.sin(a+Math.PI)*R;
      strandA.push([xa,ya,z]); strandB.push([xb,yb,z]);
      if(i%4===0) rungs.push([[xa,ya,z],[xb,yb,z]]);
    }
    c.setOption({
      backgroundColor:T.bg,
      xAxis3D:{show:false}, yAxis3D:{show:false}, zAxis3D:{show:false},
      grid3D:{show:false, boxWidth:60, boxDepth:60, boxHeight:120, viewControl:{autoRotate:true, autoRotateSpeed:10, distance:200, alpha:15}},
      series:[
        {type:'line3D', data:strandA, lineStyle:{color:T.gold, width:4, opacity:0.95}},
        {type:'line3D', data:strandB, lineStyle:{color:T.royal, width:4, opacity:0.95}},
        ...rungs.map(r=>({type:'line3D', data:r, lineStyle:{color:T.rose, width:1.5, opacity:0.5}})),
        {type:'scatter3D', data:strandA, symbolSize:6, itemStyle:{color:T.gold, opacity:0.8}},
        {type:'scatter3D', data:strandB, symbolSize:6, itemStyle:{color:T.royal, opacity:0.8}}
      ]
    });
    charts.push(c);
  }catch(e){console.warn('helix', e);}
};
factory();
```

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

```js
function(){
  try{
    const dom = document.getElementById('c-helix'); if(!dom) return;
    const c = echarts.init(dom, null, {renderer:'canvas'});
    const N=80, R=20, H=60;
    const strandA=[], strandB=[], rungs=[];
    for(let i=0;i<N;i++){
      const t = i/(N-1);
      const a = t*Math.PI*8;
      const z = -H/2 + t*H;
      const xa = Math.cos(a)*R, ya = Math.sin(a)*R;
      const xb = Math.cos(a+Math.PI)*R, yb = Math.sin(a+Math.PI)*R;
      strandA.push([xa,ya,z]); strandB.push([xb,yb,z]);
      if(i%4===0) rungs.push([[xa,ya,z],[xb,yb,z]]);
    }
    c.setOption({
      backgroundColor:T.bg,
      xAxis3D:{show:false}, yAxis3D:{show:false}, zAxis3D:{show:false},
      grid3D:{show:false, boxWidth:60, boxDepth:60, boxHeight:120, viewControl:{autoRotate:true, autoRotateSpeed:10, distance:200, alpha:15}},
      series:[
        {type:'line3D', data:strandA, lineStyle:{color:T.gold, width:4, opacity:0.95}},
        {type:'line3D', data:strandB, lineStyle:{color:T.royal, width:4, opacity:0.95}},
        ...rungs.map(r=>({type:'line3D', data:r, lineStyle:{color:T.rose, width:1.5, opacity:0.5}})),
        {type:'scatter3D', data:strandA, symbolSize:6, itemStyle:{color:T.gold, opacity:0.8}},
        {type:'scatter3D', data:strandB, symbolSize:6, itemStyle:{color:T.royal, opacity:0.8}}
      ]
    });
    charts.push(c);
  }catch(e){console.warn('helix', e);}
}
```

