---
code: "DIS-12"
id: "c-stackcol"
tab: "distribution"
kind: "core"
title: "Stacked Column · 누적 수직 막대"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "composition"
dataShape: "category shares or weighted blocks"
tasks: ["show composition", "show frequency", "compare magnitudes", "show part-to-whole"]
tags: ["distribution", "비율", "빈도", "composition", "share", "stacked", "column", "누적", "수직", "막대"]
gallery: "https://graph.heal7.com/#DIS-12"
js: "/sku/DIS-12.js"
---

# [DIS-12] Stacked Column · 누적 수직 막대

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

## 언제 가져가나
절대값 기준 누적 수직 — Stacked 100%와 짝, 총량 변화도 함께 봄.

**응용** 분기별 매출 + 채널 구성, 인구 합계 + 연령대별.

## 데이터 모양
- family: `composition`
- dataShape: category shares or weighted blocks
- tasks: show composition, show frequency, compare magnitudes, show part-to-whole
- tags: distribution, 비율, 빈도, composition, share, stacked, column, 누적, 수직, 막대


## 의존
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 cats = ['1Q','2Q','3Q','4Q'];
  const sd = [
    {n:'직접', d:[12,15,18,20], c:T.gold},
    {n:'검색', d:[20,22,25,28], c:T.royal},
    {n:'SNS',  d:[ 8,12,15,18], c:T.rose},
    {n:'기타', d:[ 4, 5, 6, 7], c:T.teal}
  ];
  reg('c-stackcol', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    legend:{textStyle:{color:T.sub}, top:0, right:8},
    grid:{top:36, right:24, bottom:30, left:42},
    xAxis:{type:'category', data:cats, axisLabel:{color:T.sub,fontSize:11}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series: sd.map(s=>({name:s.n, type:'bar', stack:'a', data:s.d, itemStyle:{color:s.c},
      label:{show:true, color:'#fff', fontSize:10, formatter:'{c}'}}))
  });
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 2435-2452
- gallery: https://graph.heal7.com/#DIS-12
- raw js: https://graph.heal7.com/sku/DIS-12.js

```js
function(){
  const cats = ['1Q','2Q','3Q','4Q'];
  const sd = [
    {n:'직접', d:[12,15,18,20], c:T.gold},
    {n:'검색', d:[20,22,25,28], c:T.royal},
    {n:'SNS',  d:[ 8,12,15,18], c:T.rose},
    {n:'기타', d:[ 4, 5, 6, 7], c:T.teal}
  ];
  reg('c-stackcol', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    legend:{textStyle:{color:T.sub}, top:0, right:8},
    grid:{top:36, right:24, bottom:30, left:42},
    xAxis:{type:'category', data:cats, axisLabel:{color:T.sub,fontSize:11}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series: sd.map(s=>({name:s.n, type:'bar', stack:'a', data:s.d, itemStyle:{color:s.c},
      label:{show:true, color:'#fff', fontSize:10, formatter:'{c}'}}))
  });
}
```

