---
code: "TIM-10"
id: "c-spark"
tab: "timeline"
kind: "core"
title: "Sparkline Grid · 미니 라인 격자"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "time-series"
dataShape: "time-indexed series, events or schedules"
tasks: ["show trend", "show seasonality", "show sequence"]
tags: ["time-series", "trend", "timeline", "sparkline", "grid", "미니", "라인", "격자"]
gallery: "https://graph.heal7.com/#TIM-10"
js: "/sku/TIM-10.js"
---

# [TIM-10] Sparkline Grid · 미니 라인 격자

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

## 언제 가져가나
2×3 격자에 6개 미니 시계열 — 대시보드 헤드라인.

**응용** 핵심 KPI 6종 한눈에, 부서별 트렌드.

## 데이터 모양
- family: `time-series`
- dataShape: time-indexed series, events or schedules
- tasks: show trend, show seasonality, show sequence
- tags: time-series, trend, timeline, sparkline, grid, 미니, 라인, 격자


## 의존
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 = ['매출','신규가입','이탈률','NPS','앱열기','문의'];
  const COL = [T.gold, T.royal, T.rose, T.teal, T.plum, '#f0a060'];
  const grids = [], xAxes = [], yAxes = [], series = [], graphics = [];
  for(let i=0;i<6;i++){
    const col = i % 3, row = Math.floor(i/3);
    const left = (col*33+2)+'%', top = (row*48+14)+'%';
    grids.push({left, top, width:'30%', height:'30%'});
    xAxes.push({gridIndex:i, type:'category', show:false, boundaryGap:false, data:Array.from({length:30},(_,k)=>''+k)});
    yAxes.push({gridIndex:i, type:'value', show:false});
    let v = 50 + Math.random()*20;
    const data = Array.from({length:30}, ()=>{ v += (Math.random()*8-4); v = Math.max(10, Math.min(95, v)); return Math.round(v); });
    series.push({type:'line', xAxisIndex:i, yAxisIndex:i, data, smooth:true, symbol:'none',
      lineStyle:{color:COL[i], width:2}, areaStyle:{color:COL[i]+'33'}});
    graphics.push({type:'text', left, top:(row*48+4)+'%', style:{text:items[i], fontSize:10, fontWeight:600, fill:T.fg}});
  }
  reg('c-spark', {backgroundColor:T.bg, grid:grids, xAxis:xAxes, yAxis:yAxes, series, graphic:graphics});
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 2555-2572
- gallery: https://graph.heal7.com/#TIM-10
- raw js: https://graph.heal7.com/sku/TIM-10.js

```js
function(){
  const items = ['매출','신규가입','이탈률','NPS','앱열기','문의'];
  const COL = [T.gold, T.royal, T.rose, T.teal, T.plum, '#f0a060'];
  const grids = [], xAxes = [], yAxes = [], series = [], graphics = [];
  for(let i=0;i<6;i++){
    const col = i % 3, row = Math.floor(i/3);
    const left = (col*33+2)+'%', top = (row*48+14)+'%';
    grids.push({left, top, width:'30%', height:'30%'});
    xAxes.push({gridIndex:i, type:'category', show:false, boundaryGap:false, data:Array.from({length:30},(_,k)=>''+k)});
    yAxes.push({gridIndex:i, type:'value', show:false});
    let v = 50 + Math.random()*20;
    const data = Array.from({length:30}, ()=>{ v += (Math.random()*8-4); v = Math.max(10, Math.min(95, v)); return Math.round(v); });
    series.push({type:'line', xAxisIndex:i, yAxisIndex:i, data, smooth:true, symbol:'none',
      lineStyle:{color:COL[i], width:2}, areaStyle:{color:COL[i]+'33'}});
    graphics.push({type:'text', left, top:(row*48+4)+'%', style:{text:items[i], fontSize:10, fontWeight:600, fill:T.fg}});
  }
  reg('c-spark', {backgroundColor:T.bg, grid:grids, xAxis:xAxes, yAxis:yAxes, series, graphic:graphics});
}
```

