---
code: "DIS-11"
id: "c-pareto"
tab: "distribution"
kind: "core"
title: "Pareto · 파레토"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "distribution"
dataShape: "aggregated categories or shares"
tasks: ["show composition", "show frequency", "compare magnitudes"]
tags: ["distribution", "비율", "빈도", "pareto", "파레토"]
gallery: "https://graph.heal7.com/#DIS-11"
js: "/sku/DIS-11.js"
---

# [DIS-11] Pareto · 파레토

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

## 언제 가져가나
막대(빈도) + 누적%(라인) — 80%가 어느 항목에서 나오는지.

**응용** 결함 원인 분석, 매출 기여도 80-20.

## 데이터 모양
- family: `distribution`
- dataShape: aggregated categories or shares
- tasks: show composition, show frequency, compare magnitudes
- tags: distribution, 비율, 빈도, pareto, 파레토


## 의존
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 = ['A','B','C','D','E','F','G','H'];
  const vals = [40, 30, 22, 18, 12, 8, 5, 3];
  const total = vals.reduce((s,v)=>s+v, 0);
  let cum = 0;
  const cumPct = vals.map(v => { cum += v; return +(cum/total*100).toFixed(1); });
  reg('c-pareto', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    legend:{data:['빈도','누적 %'], top:0, right:8, textStyle:{color:T.sub}},
    grid:{top:32, right:48, 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}}},
      {type:'value', max:100, axisLabel:{color:T.sub,fontSize:10, formatter:'{value}%'}, splitLine:{show:false}}
    ],
    series:[
      {name:'빈도', type:'bar', data:vals, itemStyle:{color:T.royal, borderRadius:[4,4,0,0]}},
      {name:'누적 %', type:'line', data:cumPct, yAxisIndex:1, smooth:true, symbol:'circle', symbolSize:7,
        lineStyle:{color:T.gold, width:2.4}, itemStyle:{color:T.gold},
        markLine:{data:[{yAxis:80, lineStyle:{color:T.rose, type:'dashed'}, label:{formatter:'80%', color:T.rose, fontSize:10}}]}}
    ]
  });
};
factory();
```

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

```js
function(){
  const cats = ['A','B','C','D','E','F','G','H'];
  const vals = [40, 30, 22, 18, 12, 8, 5, 3];
  const total = vals.reduce((s,v)=>s+v, 0);
  let cum = 0;
  const cumPct = vals.map(v => { cum += v; return +(cum/total*100).toFixed(1); });
  reg('c-pareto', {
    backgroundColor:T.bg, tooltip:{trigger:'axis'},
    legend:{data:['빈도','누적 %'], top:0, right:8, textStyle:{color:T.sub}},
    grid:{top:32, right:48, 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}}},
      {type:'value', max:100, axisLabel:{color:T.sub,fontSize:10, formatter:'{value}%'}, splitLine:{show:false}}
    ],
    series:[
      {name:'빈도', type:'bar', data:vals, itemStyle:{color:T.royal, borderRadius:[4,4,0,0]}},
      {name:'누적 %', type:'line', data:cumPct, yAxisIndex:1, smooth:true, symbol:'circle', symbolSize:7,
        lineStyle:{color:T.gold, width:2.4}, itemStyle:{color:T.gold},
        markLine:{data:[{yAxis:80, lineStyle:{color:T.rose, type:'dashed'}, label:{formatter:'80%', color:T.rose, fontSize:10}}]}}
    ]
  });
}
```

