---
code: "TIM-13"
id: "c-spiral"
tab: "timeline"
kind: "core"
title: "Spiral Time · 시간 나선"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "time-series"
dataShape: "ordered time steps, events or schedules"
tasks: ["show trend", "show seasonality", "show sequence", "show trend over time"]
tags: ["time-series", "trend", "timeline", "spiral", "time", "시간", "나선"]
gallery: "https://graph.heal7.com/#TIM-13"
js: "/sku/TIM-13.js"
---

# [TIM-13] Spiral Time · 시간 나선

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

## 언제 가져가나
시간을 안→밖 나선으로 감아 주기성과 누적을 동시에 — 한 바퀴 = 한 주기.

**응용** 24시간 사이클 누적, 월별/연도별 패턴, 학습 사이클.

## 데이터 모양
- family: `time-series`
- dataShape: ordered time steps, events or schedules
- tasks: show trend, show seasonality, show sequence, show trend over time
- tags: time-series, trend, timeline, spiral, time, 시간, 나선


## 의존
echarts@5 · load `low` · library `ECharts`

## 붙여넣는 법
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(){
  // 시간 = 각도(0~24h → 0~360°), 사이클(요일/주차) = 반지름
  const CYCLES = 7, PER = 24;
  const data=[];
  for(let c=0;c<CYCLES;c++){
    for(let h=0;h<PER;h++){
      const angle = h/PER * 360;
      const radius = 30 + c*10; // 30 → 90까지 균등 확장
      // 한낮(11~14시) 활동 강도 패턴 + cycle별 약간의 추세
      const v = 30 + Math.sin((h-9)/24*Math.PI*2) * 25 + c*3 + Math.random()*8;
      data.push([angle, radius, +v.toFixed(1), c, h]);
    }
  }
  // 같은 cycle을 잇는 나선 라인 (가독성용)
  const spiralLine = [];
  for(let c=0;c<CYCLES;c++) for(let h=0;h<=PER;h++){
    const angle = (h%PER)/PER * 360;
    const radius = 30 + c*10 + (h/PER)*10;
    spiralLine.push([angle, radius]);
  }
  reg('c-spiral', {
    backgroundColor:T.bg,
    tooltip:{formatter: p => p.value && p.value.length>=5 ? `${p.value[4]}시 · 사이클 ${p.value[3]+1}<br/>강도 ${p.value[2]}` : ''},
    polar:{radius:'78%'},
    angleAxis:{type:'value', min:0, max:360, startAngle:90, clockwise:true, interval:30,
      axisLine:{lineStyle:{color:T.grid}},
      axisLabel:{color:T.sub, fontSize:9, formatter: v => `${Math.round(v/15)%24}h`},
      splitLine:{lineStyle:{color:T.grid, type:'dashed', opacity:.4}}},
    radiusAxis:{type:'value', min:0, max:105, axisLabel:{show:false}, splitLine:{lineStyle:{color:T.grid, opacity:.3}}, axisLine:{show:false}, axisTick:{show:false}},
    visualMap:{min:20, max:80, show:false, inRange:{color:[T.royal, T.teal, T.gold, T.rose]}},
    series:[
      {type:'line', coordinateSystem:'polar', data:spiralLine.map(p=>[p[1], p[0]]), showSymbol:false, smooth:false,
        lineStyle:{color:T.grid, width:1, type:'solid', opacity:0.35}, silent:true, animation:false},
      {type:'scatter', coordinateSystem:'polar',
        data: data.map(d=>({value:[d[1], d[0], d[2], d[3], d[4]]})),
        symbolSize: p => 4 + p[2]/8,
        itemStyle:{opacity:0.92, shadowBlur:6, shadowColor:'rgba(232,192,105,.35)'}}
    ]
  });
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 3034-3073
- gallery: https://graph.heal7.com/#TIM-13
- raw js: https://graph.heal7.com/sku/TIM-13.js

```js
function(){
  // 시간 = 각도(0~24h → 0~360°), 사이클(요일/주차) = 반지름
  const CYCLES = 7, PER = 24;
  const data=[];
  for(let c=0;c<CYCLES;c++){
    for(let h=0;h<PER;h++){
      const angle = h/PER * 360;
      const radius = 30 + c*10; // 30 → 90까지 균등 확장
      // 한낮(11~14시) 활동 강도 패턴 + cycle별 약간의 추세
      const v = 30 + Math.sin((h-9)/24*Math.PI*2) * 25 + c*3 + Math.random()*8;
      data.push([angle, radius, +v.toFixed(1), c, h]);
    }
  }
  // 같은 cycle을 잇는 나선 라인 (가독성용)
  const spiralLine = [];
  for(let c=0;c<CYCLES;c++) for(let h=0;h<=PER;h++){
    const angle = (h%PER)/PER * 360;
    const radius = 30 + c*10 + (h/PER)*10;
    spiralLine.push([angle, radius]);
  }
  reg('c-spiral', {
    backgroundColor:T.bg,
    tooltip:{formatter: p => p.value && p.value.length>=5 ? `${p.value[4]}시 · 사이클 ${p.value[3]+1}<br/>강도 ${p.value[2]}` : ''},
    polar:{radius:'78%'},
    angleAxis:{type:'value', min:0, max:360, startAngle:90, clockwise:true, interval:30,
      axisLine:{lineStyle:{color:T.grid}},
      axisLabel:{color:T.sub, fontSize:9, formatter: v => `${Math.round(v/15)%24}h`},
      splitLine:{lineStyle:{color:T.grid, type:'dashed', opacity:.4}}},
    radiusAxis:{type:'value', min:0, max:105, axisLabel:{show:false}, splitLine:{lineStyle:{color:T.grid, opacity:.3}}, axisLine:{show:false}, axisTick:{show:false}},
    visualMap:{min:20, max:80, show:false, inRange:{color:[T.royal, T.teal, T.gold, T.rose]}},
    series:[
      {type:'line', coordinateSystem:'polar', data:spiralLine.map(p=>[p[1], p[0]]), showSymbol:false, smooth:false,
        lineStyle:{color:T.grid, width:1, type:'solid', opacity:0.35}, silent:true, animation:false},
      {type:'scatter', coordinateSystem:'polar',
        data: data.map(d=>({value:[d[1], d[0], d[2], d[3], d[4]]})),
        symbolSize: p => 4 + p[2]/8,
        itemStyle:{opacity:0.92, shadowBlur:6, shadowColor:'rgba(232,192,105,.35)'}}
    ]
  });
}
```

