---
code: "CMP-04"
id: "c-box"
tab: "compare"
kind: "core"
title: "Box+Strip · 박스 분포 + 개별 점"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "distribution"
dataShape: "value distribution or density bins"
tasks: ["compare alternatives", "show delta", "benchmark groups", "show spread"]
tags: ["comparison", "benchmark", "delta", "distribution", "density", "box+strip", "박스", "분포", "개별"]
gallery: "https://graph.heal7.com/#CMP-04"
js: "/sku/CMP-04.js"
---

# [CMP-04] Box+Strip · 박스 분포 + 개별 점

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

## 언제 가져가나
HR 부서별 평가점수 분포 — 5분위 박스 + 개별 직원 점 오버레이. 박스플롯·스트립 패턴 통합.

**응용** 부서별 연봉/평가 분포, 코호트 응답시간 SLA + 본인 위치, 시험점수 모집단.

## 데이터 모양
- family: `distribution`
- dataShape: value distribution or density bins
- tasks: compare alternatives, show delta, benchmark groups, show spread
- tags: comparison, benchmark, delta, distribution, density, box+strip, 박스, 분포, 개별


## 의존
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 DEPTS = ['개발','디자인','마케팅','영업','HR'];
  // 각 부서마다 5분위 + 개별 직원 11~14명 분포
  const presets = [
    {center:78, spread:18, n:13}, // 개발
    {center:74, spread:16, n:12}, // 디자인
    {center:70, spread:22, n:14}, // 마케팅
    {center:72, spread:20, n:13}, // 영업
    {center:80, spread:14, n:11}  // HR
  ];
  const box = [];     // [min, Q1, median, Q3, max]
  const strip = [];   // [deptIdx, score]
  presets.forEach((p,i)=>{
    const samples = Array.from({length:p.n}, ()=>{
      let s = p.center + (Math.random()-.5)*p.spread*2;
      s = Math.max(40, Math.min(100, s));
      return Math.round(s);
    });
    samples.sort((a,b)=>a-b);
    const q = (k)=> samples[Math.floor(k*(samples.length-1))];
    box.push([samples[0], q(.25), q(.5), q(.75), samples[samples.length-1]]);
    samples.forEach(s=> strip.push([i + (Math.random()-.5)*0.4, s]));
  });
  reg('c-box', {
    backgroundColor:T.bg, tooltip:{}, grid:{top:18,right:18,bottom:30,left:42},
    xAxis:{type:'category', data:DEPTS, axisLabel:{color:T.fg,fontSize:11,fontWeight:600}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', name:'평가점수', nameTextStyle:{color:T.sub,fontSize:10}, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}, min:35, max:100},
    series:[
      {name:'분위', type:'boxplot', data:box, itemStyle:{color:'rgba(107,140,255,.22)', borderColor:T.royal, borderWidth:1.5}},
      {name:'직원', type:'scatter', data:strip, symbolSize:7, itemStyle:{color:T.gold, opacity:.65, borderColor:'rgba(232,192,105,.6)', borderWidth:.5}}
    ]
  });
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 800-832
- gallery: https://graph.heal7.com/#CMP-04
- raw js: https://graph.heal7.com/sku/CMP-04.js

```js
function(){
  const DEPTS = ['개발','디자인','마케팅','영업','HR'];
  // 각 부서마다 5분위 + 개별 직원 11~14명 분포
  const presets = [
    {center:78, spread:18, n:13}, // 개발
    {center:74, spread:16, n:12}, // 디자인
    {center:70, spread:22, n:14}, // 마케팅
    {center:72, spread:20, n:13}, // 영업
    {center:80, spread:14, n:11}  // HR
  ];
  const box = [];     // [min, Q1, median, Q3, max]
  const strip = [];   // [deptIdx, score]
  presets.forEach((p,i)=>{
    const samples = Array.from({length:p.n}, ()=>{
      let s = p.center + (Math.random()-.5)*p.spread*2;
      s = Math.max(40, Math.min(100, s));
      return Math.round(s);
    });
    samples.sort((a,b)=>a-b);
    const q = (k)=> samples[Math.floor(k*(samples.length-1))];
    box.push([samples[0], q(.25), q(.5), q(.75), samples[samples.length-1]]);
    samples.forEach(s=> strip.push([i + (Math.random()-.5)*0.4, s]));
  });
  reg('c-box', {
    backgroundColor:T.bg, tooltip:{}, grid:{top:18,right:18,bottom:30,left:42},
    xAxis:{type:'category', data:DEPTS, axisLabel:{color:T.fg,fontSize:11,fontWeight:600}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', name:'평가점수', nameTextStyle:{color:T.sub,fontSize:10}, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}, min:35, max:100},
    series:[
      {name:'분위', type:'boxplot', data:box, itemStyle:{color:'rgba(107,140,255,.22)', borderColor:T.royal, borderWidth:1.5}},
      {name:'직원', type:'scatter', data:strip, symbolSize:7, itemStyle:{color:T.gold, opacity:.65, borderColor:'rgba(232,192,105,.6)', borderWidth:.5}}
    ]
  });
}
```

