---
code: "CMP-06"
id: "c-lolli"
tab: "compare"
kind: "core"
title: "Lollipop · 막대사탕"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "comparison"
dataShape: "ranked categories or before-after pairs"
tasks: ["compare alternatives", "show delta", "benchmark groups", "compare categories"]
tags: ["comparison", "benchmark", "delta", "ranking", "lollipop", "막대사탕"]
gallery: "https://graph.heal7.com/#CMP-06"
js: "/sku/CMP-06.js"
---

# [CMP-06] Lollipop · 막대사탕

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

## 언제 가져가나
가는 선 + 끝 원 — 막대보다 가벼운 시각, 정렬된 비교에 적합.

**응용** 항목별 점수, 변화량 ↑↓, 순위 시각화.

## 데이터 모양
- family: `comparison`
- dataShape: ranked categories or before-after pairs
- tasks: compare alternatives, show delta, benchmark groups, compare categories
- tags: comparison, benchmark, delta, ranking, lollipop, 막대사탕


## 의존
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 = ['창의','분석','관계','실행','보호','혁신','통찰','도약'];
  const vals = [82,68,54,76,42,88,60,72];
  reg('c-lolli', {
    backgroundColor:T.bg, grid:{top:14, right:14, bottom:30, left:32},
    xAxis:{type:'category', data:cats, axisLabel:{color:T.sub,fontSize:10, rotate:25}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series:[
      {type:'bar', data:vals, barWidth:2, itemStyle:{color:'rgba(232,192,105,.65)'}, silent:true, animation:false},
      {type:'scatter', data:vals.map((v,i)=>[i,v]), symbolSize:18,
        itemStyle:{color:T.gold, borderColor:'#fff', borderWidth:1.5, shadowBlur:8, shadowColor:T.gold},
        label:{show:true, color:T.fg, fontSize:10, position:'top', formatter:p=>p.data[1]}}
    ]
  });
};
factory();
```

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

```js
function(){
  const cats = ['창의','분석','관계','실행','보호','혁신','통찰','도약'];
  const vals = [82,68,54,76,42,88,60,72];
  reg('c-lolli', {
    backgroundColor:T.bg, grid:{top:14, right:14, bottom:30, left:32},
    xAxis:{type:'category', data:cats, axisLabel:{color:T.sub,fontSize:10, rotate:25}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', max:100, axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series:[
      {type:'bar', data:vals, barWidth:2, itemStyle:{color:'rgba(232,192,105,.65)'}, silent:true, animation:false},
      {type:'scatter', data:vals.map((v,i)=>[i,v]), symbolSize:18,
        itemStyle:{color:T.gold, borderColor:'#fff', borderWidth:1.5, shadowBlur:8, shadowColor:T.gold},
        label:{show:true, color:T.fg, fontSize:10, position:'top', formatter:p=>p.data[1]}}
    ]
  });
}
```

