---
code: "CMP-07"
id: "c-slope"
tab: "compare"
kind: "core"
title: "Slope · 기울기 변화"
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", "slope", "기울기", "변화"]
gallery: "https://graph.heal7.com/#CMP-07"
js: "/sku/CMP-07.js"
---

# [CMP-07] Slope · 기울기 변화

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

## 언제 가져가나
두 시점 사이 라인 — 기울기 부호로 ↑↓ 직관 인지.

**응용** Before/After 점수, 분기 간 순위 변동.

## 데이터 모양
- family: `comparison`
- dataShape: ranked categories or before-after pairs
- tasks: compare alternatives, show delta, benchmark groups, compare categories
- tags: comparison, benchmark, delta, ranking, slope, 기울기, 변화


## 의존
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 = ['항목 A','항목 B','항목 C','항목 D','항목 E','항목 F'];
  const before = [40, 60, 75, 30, 55, 70];
  const after  = [70, 55, 85, 60, 50, 90];
  const series = items.map((n,i)=>{
    const up = after[i] >= before[i];
    const c = up ? T.gold : T.rose;
    return {name:n, type:'line',
      data:[
        {value:before[i], label:{show:true, position:'left', formatter:n+': '+before[i], color:T.fg, fontSize:10}},
        {value:after[i],  label:{show:true, position:'right', formatter:''+after[i], color:c, fontSize:10, fontWeight:600}}
      ],
      symbol:'circle', symbolSize:10,
      lineStyle:{color:c, width:2}, itemStyle:{color:c}
    };
  });
  reg('c-slope', {
    backgroundColor:T.bg, tooltip:{},
    grid:{top:14, right:60, bottom:24, left:60},
    xAxis:{type:'category', data:['이전','현재'], axisLabel:{color:T.fg, fontSize:11, fontWeight:600}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', show:false, min:0, max:100},
    series
  });
};
factory();
```

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

```js
function(){
  const items = ['항목 A','항목 B','항목 C','항목 D','항목 E','항목 F'];
  const before = [40, 60, 75, 30, 55, 70];
  const after  = [70, 55, 85, 60, 50, 90];
  const series = items.map((n,i)=>{
    const up = after[i] >= before[i];
    const c = up ? T.gold : T.rose;
    return {name:n, type:'line',
      data:[
        {value:before[i], label:{show:true, position:'left', formatter:n+': '+before[i], color:T.fg, fontSize:10}},
        {value:after[i],  label:{show:true, position:'right', formatter:''+after[i], color:c, fontSize:10, fontWeight:600}}
      ],
      symbol:'circle', symbolSize:10,
      lineStyle:{color:c, width:2}, itemStyle:{color:c}
    };
  });
  reg('c-slope', {
    backgroundColor:T.bg, tooltip:{},
    grid:{top:14, right:60, bottom:24, left:60},
    xAxis:{type:'category', data:['이전','현재'], axisLabel:{color:T.fg, fontSize:11, fontWeight:600}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', show:false, min:0, max:100},
    series
  });
}
```

