---
code: "INT-18"
id: "c-brush"
tab: "dynamic-2"
kind: "interactive"
title: "Brush Scatter · 브러시 산점"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "subset-selection"
dataShape: "scatter with brushable selection"
tasks: ["explore data", "filter subsets", "monitor change", "select cohorts"]
tags: ["interactive", "exploration", "linked view", "brush", "scatter", "브러시", "산점"]
gallery: "https://graph.heal7.com/#INT-18"
js: "/sku/INT-18.js"
---

# [INT-18] Brush Scatter · 브러시 산점

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

## 언제 가져가나
툴박스의 사각형/올가미로 점들을 드래그 선택 — 선택된 점만 강조됨.

**응용** 이상치 인스펙션, 코호트 정의, 다중 차트 linked view.

## 데이터 모양
- family: `subset-selection`
- dataShape: scatter with brushable selection
- tasks: explore data, filter subsets, monitor change, select cohorts
- tags: interactive, exploration, linked view, brush, scatter, 브러시, 산점


## 의존
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 data = [];
  for(let i=0;i<200;i++){
    const cl = Math.random()<.5 ? 0 : 1;
    const cx = cl ? 70 : 30, cy = cl ? 65 : 40;
    data.push([cx + (Math.random()-.5)*30, cy + (Math.random()-.5)*30]);
  }
  reg('c-brush', {
    backgroundColor:T.bg, tooltip:{},
    toolbox:{show:true, top:0, right:8, iconStyle:{borderColor:T.gold}, feature:{brush:{type:['rect','polygon','clear']}}},
    brush:{toolbox:['rect','polygon','clear'], xAxisIndex:0, yAxisIndex:0, throttleType:'debounce', throttleDelay:100,
      brushStyle:{borderColor:T.gold, borderWidth:1, color:'rgba(232,192,105,.12)'}},
    grid:{top:32, right:24, bottom:24, left:36},
    xAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series:[{type:'scatter', data, symbolSize:8,
      itemStyle:{color:T.royal, opacity:.5},
      emphasis:{itemStyle:{color:T.gold, shadowBlur:8, shadowColor:T.gold}}
    }]
  });
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 1924-1944
- gallery: https://graph.heal7.com/#INT-18
- raw js: https://graph.heal7.com/sku/INT-18.js

```js
function(){
  const data = [];
  for(let i=0;i<200;i++){
    const cl = Math.random()<.5 ? 0 : 1;
    const cx = cl ? 70 : 30, cy = cl ? 65 : 40;
    data.push([cx + (Math.random()-.5)*30, cy + (Math.random()-.5)*30]);
  }
  reg('c-brush', {
    backgroundColor:T.bg, tooltip:{},
    toolbox:{show:true, top:0, right:8, iconStyle:{borderColor:T.gold}, feature:{brush:{type:['rect','polygon','clear']}}},
    brush:{toolbox:['rect','polygon','clear'], xAxisIndex:0, yAxisIndex:0, throttleType:'debounce', throttleDelay:100,
      brushStyle:{borderColor:T.gold, borderWidth:1, color:'rgba(232,192,105,.12)'}},
    grid:{top:32, right:24, bottom:24, left:36},
    xAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'value', axisLabel:{color:T.sub,fontSize:10}, splitLine:{lineStyle:{color:T.grid}}},
    series:[{type:'scatter', data, symbolSize:8,
      itemStyle:{color:T.royal, opacity:.5},
      emphasis:{itemStyle:{color:T.gold, shadowBlur:8, shadowColor:T.gold}}
    }]
  });
}
```

