---
code: "TIM-07"
id: "c-range"
tab: "timeline"
kind: "core"
title: "Range Area · 신뢰구간 영역"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "time-series"
dataShape: "time-indexed series, events or schedules"
tasks: ["show trend", "show seasonality", "show sequence"]
tags: ["time-series", "trend", "timeline", "range", "area", "신뢰구간", "영역"]
gallery: "https://graph.heal7.com/#TIM-07"
js: "/sku/TIM-07.js"
---

# [TIM-07] Range Area · 신뢰구간 영역

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

## 언제 가져가나
최저/최고 사이를 음영 영역으로 + 중앙값 라인 — 불확실성과 추세를 한 화면에.

**응용** 예측 신뢰구간, 일중 가격 변동 폭, 응답시간 P5–P95.

## 데이터 모양
- family: `time-series`
- dataShape: time-indexed series, events or schedules
- tasks: show trend, show seasonality, show sequence
- tags: time-series, trend, timeline, range, area, 신뢰구간, 영역


## 의존
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(){
  const N = 36;
  const xs = Array.from({length:N},(_,i)=>'M'+(i+1));
  const median = Array.from({length:N},(_,i)=>50 + Math.sin(i/4)*15 + Math.cos(i/7)*6);
  const lo = median.map(v=>v-8-Math.random()*5);
  const range = median.map((v,i)=> (v+8+Math.random()*5) - lo[i]);
  reg('c-range', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    grid:{top:18,right:24,bottom:30,left:42},
    xAxis:{type:'category', data:xs, boundaryGap:false, axisLabel:{color:T.sub,fontSize:9}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series:[
      {name:'_lo',  type:'line', data:lo,    stack:'b', symbol:'none', lineStyle:{opacity:0}, silent:true, animation:false},
      {name:'범위', type:'line', data:range, stack:'b', symbol:'none', lineStyle:{opacity:0},
        areaStyle:{color:'rgba(232,192,105,.22)'}},
      {name:'중앙값', type:'line', data:median, smooth:true, symbol:'none',
        lineStyle:{color:T.gold, width:2.4, shadowBlur:8, shadowColor:T.gold}}
    ]
  });
};
factory();
```

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

```js
function(){
  const N = 36;
  const xs = Array.from({length:N},(_,i)=>'M'+(i+1));
  const median = Array.from({length:N},(_,i)=>50 + Math.sin(i/4)*15 + Math.cos(i/7)*6);
  const lo = median.map(v=>v-8-Math.random()*5);
  const range = median.map((v,i)=> (v+8+Math.random()*5) - lo[i]);
  reg('c-range', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    grid:{top:18,right:24,bottom:30,left:42},
    xAxis:{type:'category', data:xs, boundaryGap:false, axisLabel:{color:T.sub,fontSize:9}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series:[
      {name:'_lo',  type:'line', data:lo,    stack:'b', symbol:'none', lineStyle:{opacity:0}, silent:true, animation:false},
      {name:'범위', type:'line', data:range, stack:'b', symbol:'none', lineStyle:{opacity:0},
        areaStyle:{color:'rgba(232,192,105,.22)'}},
      {name:'중앙값', type:'line', data:median, smooth:true, symbol:'none',
        lineStyle:{color:T.gold, width:2.4, shadowBlur:8, shadowColor:T.gold}}
    ]
  });
}
```

