---
code: "CMP-05"
id: "c-bullet"
tab: "compare"
kind: "core"
title: "Bullet · 불릿 차트"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "kpi"
dataShape: "headline value, rank race or progress state"
tasks: ["compare alternatives", "show delta", "benchmark groups", "surface headline KPI"]
tags: ["comparison", "benchmark", "delta", "kpi", "progress", "bullet", "불릿", "차트"]
gallery: "https://graph.heal7.com/#CMP-05"
js: "/sku/CMP-05.js"
---

# [CMP-05] Bullet · 불릿 차트

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

## 언제 가져가나
실제값(굵은 막대) + 목표(세로선) + 성과 구간(배경 밴드).

**응용** KPI 대시보드, 영업 목표 달성률, 단일 게이지 대체.

## 데이터 모양
- family: `kpi`
- dataShape: headline value, rank race or progress state
- tasks: compare alternatives, show delta, benchmark groups, surface headline KPI
- tags: comparison, benchmark, delta, kpi, progress, bullet, 불릿, 차트


## 의존
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 items = [
    {n:'매출',     cur:78, tgt:85, b:[40,70,100]},
    {n:'NPS',      cur:55, tgt:70, b:[30,55,100]},
    {n:'리텐션',   cur:68, tgt:60, b:[30,60,100]}
  ];
  reg('c-bullet', {
    backgroundColor:T.bg, grid:{top:14, right:24, bottom:14, left:64},
    xAxis:{type:'value', max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'category', data:items.map(x=>x.n), axisLabel:{color:T.fg,fontSize:11,fontWeight:600}, axisLine:{show:false}, axisTick:{show:false}, inverse:true},
    series:[
      {name:'b1', type:'bar', stack:'b', data:items.map(x=>x.b[0]),         itemStyle:{color:'rgba(255,255,255,.05)'}, barWidth:24, silent:true, animation:false},
      {name:'b2', type:'bar', stack:'b', data:items.map(x=>x.b[1]-x.b[0]), itemStyle:{color:'rgba(255,255,255,.09)'}, silent:true, animation:false},
      {name:'b3', type:'bar', stack:'b', data:items.map(x=>x.b[2]-x.b[1]), itemStyle:{color:'rgba(255,255,255,.13)'}, silent:true, animation:false},
      {name:'현재', type:'bar', data:items.map(x=>x.cur), barWidth:10, barGap:'-90%', z:5,
        itemStyle:{color:T.gold, borderRadius:3},
        label:{show:true, position:'right', color:T.fg, fontSize:11, formatter:'{c}'}},
      {name:'목표', type:'scatter', symbol:'rect', symbolSize:[3,22], data:items.map((x,i)=>[x.tgt, i]),
        itemStyle:{color:T.rose}, z:6, animation:false}
    ]
  });
};
factory();
```

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

```js
function(){
  const items = [
    {n:'매출',     cur:78, tgt:85, b:[40,70,100]},
    {n:'NPS',      cur:55, tgt:70, b:[30,55,100]},
    {n:'리텐션',   cur:68, tgt:60, b:[30,60,100]}
  ];
  reg('c-bullet', {
    backgroundColor:T.bg, grid:{top:14, right:24, bottom:14, left:64},
    xAxis:{type:'value', max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'category', data:items.map(x=>x.n), axisLabel:{color:T.fg,fontSize:11,fontWeight:600}, axisLine:{show:false}, axisTick:{show:false}, inverse:true},
    series:[
      {name:'b1', type:'bar', stack:'b', data:items.map(x=>x.b[0]),         itemStyle:{color:'rgba(255,255,255,.05)'}, barWidth:24, silent:true, animation:false},
      {name:'b2', type:'bar', stack:'b', data:items.map(x=>x.b[1]-x.b[0]), itemStyle:{color:'rgba(255,255,255,.09)'}, silent:true, animation:false},
      {name:'b3', type:'bar', stack:'b', data:items.map(x=>x.b[2]-x.b[1]), itemStyle:{color:'rgba(255,255,255,.13)'}, silent:true, animation:false},
      {name:'현재', type:'bar', data:items.map(x=>x.cur), barWidth:10, barGap:'-90%', z:5,
        itemStyle:{color:T.gold, borderRadius:3},
        label:{show:true, position:'right', color:T.fg, fontSize:11, formatter:'{c}'}},
      {name:'목표', type:'scatter', symbol:'rect', symbolSize:[3,22], data:items.map((x,i)=>[x.tgt, i]),
        itemStyle:{color:T.rose}, z:6, animation:false}
    ]
  });
}
```

