---
code: "TIM-09"
id: "c-dual"
tab: "timeline"
kind: "core"
title: "Dual Axis · 이중축"
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", "dual", "axis", "이중축"]
gallery: "https://graph.heal7.com/#TIM-09"
js: "/sku/TIM-09.js"
---

# [TIM-09] Dual Axis · 이중축

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

## 언제 가져가나
매출(막대) + 성장률(라인) — 단위가 다른 두 지표를 한 차트에.

**응용** 가격 vs 판매량, 사용자수 vs 전환율.

## 데이터 모양
- family: `time-series`
- dataShape: time-indexed series, events or schedules
- tasks: show trend, show seasonality, show sequence
- tags: time-series, trend, timeline, dual, axis, 이중축


## 의존
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 months = ['1','2','3','4','5','6','7','8','9','10','11','12'].map(m=>m+'월');
  const sales = [320, 280, 380, 420, 480, 510, 550, 600, 580, 620, 680, 720];
  const growth = sales.map((v,i)=> i===0 ? 0 : +((v-sales[i-1])/sales[i-1]*100).toFixed(1));
  reg('c-dual', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    legend:{data:['매출','성장률'], top:0, right:8, textStyle:{color:T.sub}},
    grid:{top:36, right:48, bottom:30, left:48},
    xAxis:{type:'category', data:months, axisLabel:{color:T.sub,fontSize:10}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:[
      {type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
      {type:'value', axisLabel:{color:T.sub,fontSize:10, formatter:'{value}%'}, splitLine:{show:false}}
    ],
    series:[
      {name:'매출', type:'bar', data:sales, itemStyle:{color:T.royal, borderRadius:[4,4,0,0]}, barWidth:'55%'},
      {name:'성장률', type:'line', data:growth, yAxisIndex:1, smooth:true, symbol:'circle', symbolSize:7,
        lineStyle:{color:T.gold, width:2.4, shadowBlur:6, shadowColor:T.gold}, itemStyle:{color:T.gold}}
    ]
  });
};
factory();
```

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

```js
function(){
  const months = ['1','2','3','4','5','6','7','8','9','10','11','12'].map(m=>m+'월');
  const sales = [320, 280, 380, 420, 480, 510, 550, 600, 580, 620, 680, 720];
  const growth = sales.map((v,i)=> i===0 ? 0 : +((v-sales[i-1])/sales[i-1]*100).toFixed(1));
  reg('c-dual', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    legend:{data:['매출','성장률'], top:0, right:8, textStyle:{color:T.sub}},
    grid:{top:36, right:48, bottom:30, left:48},
    xAxis:{type:'category', data:months, axisLabel:{color:T.sub,fontSize:10}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:[
      {type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
      {type:'value', axisLabel:{color:T.sub,fontSize:10, formatter:'{value}%'}, splitLine:{show:false}}
    ],
    series:[
      {name:'매출', type:'bar', data:sales, itemStyle:{color:T.royal, borderRadius:[4,4,0,0]}, barWidth:'55%'},
      {name:'성장률', type:'line', data:growth, yAxisIndex:1, smooth:true, symbol:'circle', symbolSize:7,
        lineStyle:{color:T.gold, width:2.4, shadowBlur:6, shadowColor:T.gold}, itemStyle:{color:T.gold}}
    ]
  });
}
```

