---
code: "NET-12"
id: "c-upset"
tab: "network"
kind: "core"
title: "Upset · 집합 교집합"
library: "ECharts"
deps: ["echarts@5"]
load: "low"
pasteKind: "echarts-mount"
family: "set-intersection"
dataShape: "intersection sizes with set-membership matrix"
tasks: ["show connections", "show hierarchy", "trace flow", "compare set overlaps"]
tags: ["network", "relationship", "flow", "upset", "set", "집합", "교집합"]
gallery: "https://graph.heal7.com/#NET-12"
js: "/sku/NET-12.js"
---

# [NET-12] Upset · 집합 교집합

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

## 언제 가져가나
위=교집합 크기 막대, 아래=소속 점 매트릭스 — 3집합 이상에서 벤보다 읽히는 집합 과업.

**응용** 스킬 조합, 세그먼트 중복, 기능 플래그 동시 사용, 태그 공출현.

## 데이터 모양
- family: `set-intersection`
- dataShape: intersection sizes with set-membership matrix
- tasks: show connections, show hierarchy, trace flow, compare set overlaps
- tags: network, relationship, flow, upset, set, 집합, 교집합


## 의존
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 sets = ['분석','창의','실행','관계'];
  const cols = [
    {label:'분석', m:[1,0,0,0], n:48},
    {label:'창의', m:[0,1,0,0], n:41},
    {label:'실행', m:[0,0,1,0], n:36},
    {label:'관계', m:[0,0,0,1], n:33},
    {label:'분석+창의', m:[1,1,0,0], n:22},
    {label:'분석+실행', m:[1,0,1,0], n:18},
    {label:'창의+관계', m:[0,1,0,1], n:15},
    {label:'3중첩', m:[1,1,1,0], n:9}
  ];
  const xs = cols.map(c => c.label);
  const heat=[];
  cols.forEach((c,x)=> c.m.forEach((bit,y)=> heat.push([x,y, bit?c.n:0])));
  reg('c-upset', {
    backgroundColor:T.bg,
    tooltip:{formatter:p=>{
      const on = p.value[2]>0;
      return sets[p.value[1]]+' · '+xs[p.value[0]]+'<br/>'+(on?('소속 · 크기 '+p.value[2]):'미소속');
    }},
    grid:{top:18, right:16, bottom:36, left:56},
    xAxis:{type:'category', data:xs, axisLabel:{color:T.sub,fontSize:11}, axisTick:{show:false}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'category', data:sets, inverse:true, axisLabel:{color:T.fg,fontSize:12,fontWeight:600}, splitArea:{show:true}},
    visualMap:{min:0, max:48, show:false, inRange:{color:['rgba(255,255,255,.06)', T.gold]}},
    series:[{type:'heatmap', data:heat,
      label:{show:true, color:'#1a1230', fontSize:11, fontWeight:700, formatter:p=>p.value[2]||''},
      itemStyle:{borderRadius:4, borderColor:'#0e0a1a', borderWidth:1}}]
  });
};
factory();
```

## 원본 factory (갤러리 정본 발췌)
- file: `frontend/js/graph-gallery/main.js`
- lines: 3203-3232
- gallery: https://graph.heal7.com/#NET-12
- raw js: https://graph.heal7.com/sku/NET-12.js

```js
function(){
  const sets = ['분석','창의','실행','관계'];
  const cols = [
    {label:'분석', m:[1,0,0,0], n:48},
    {label:'창의', m:[0,1,0,0], n:41},
    {label:'실행', m:[0,0,1,0], n:36},
    {label:'관계', m:[0,0,0,1], n:33},
    {label:'분석+창의', m:[1,1,0,0], n:22},
    {label:'분석+실행', m:[1,0,1,0], n:18},
    {label:'창의+관계', m:[0,1,0,1], n:15},
    {label:'3중첩', m:[1,1,1,0], n:9}
  ];
  const xs = cols.map(c => c.label);
  const heat=[];
  cols.forEach((c,x)=> c.m.forEach((bit,y)=> heat.push([x,y, bit?c.n:0])));
  reg('c-upset', {
    backgroundColor:T.bg,
    tooltip:{formatter:p=>{
      const on = p.value[2]>0;
      return sets[p.value[1]]+' · '+xs[p.value[0]]+'<br/>'+(on?('소속 · 크기 '+p.value[2]):'미소속');
    }},
    grid:{top:18, right:16, bottom:36, left:56},
    xAxis:{type:'category', data:xs, axisLabel:{color:T.sub,fontSize:11}, axisTick:{show:false}, axisLine:{lineStyle:{color:T.grid}}},
    yAxis:{type:'category', data:sets, inverse:true, axisLabel:{color:T.fg,fontSize:12,fontWeight:600}, splitArea:{show:true}},
    visualMap:{min:0, max:48, show:false, inRange:{color:['rgba(255,255,255,.06)', T.gold]}},
    series:[{type:'heatmap', data:heat,
      label:{show:true, color:'#1a1230', fontSize:11, fontWeight:700, formatter:p=>p.value[2]||''},
      itemStyle:{borderRadius:4, borderColor:'#0e0a1a', borderWidth:1}}]
  });
}
```

