markleetw/reverse-due-diligence-skill
rdd
Verified反向盡職調查(reverse due diligence)——求職者視角的公司調查。在接受 offer 或投入面試流程前,用公開資料把公司的財務體質、股價與股權、營收引擎、組織文化、低潮期與復原路徑查清楚,產出一份可存檔的 HTML 報告與一份面試提問清單。這個 skill 的簡稱是 rdd,使用者打 /rdd 就是要跑這套流程。Use this whenever the user is evaluating a job opportunity and wants to research the company behind it — triggers include /rdd, rdd, 反向盡職調查, 反向盡調, 調查這家公司, 我在面試某公司想先了解, 這份工作值不值得接, 幫我查某公司的財報與風評, 這家公司值得去嗎, background check on an employer, should I take this job, research this company before I interview, vet this employer. Also use when they name a company plus a role and ask what they should know about it, even if they never say the words "due diligence" or "rdd".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 15.7 KB |
| examples/audit-spec.example.json | config | 1.5 KB |
| references/analysis-playbook.md | markdown | 39.9 KB |
| references/global-sources.md | markdown | 2.4 KB |
| references/report-template.md | markdown | 7.9 KB |
| references/taiwan-sources.md | markdown | 4.8 KB |
| scripts/audit.pyexecutable | script | 14.1 KB |
| scripts/browser_test.py | script | 9.2 KB |
| scripts/check_repo.py | script | 18.6 KB |
| scripts/package.py | script | 4.3 KB |
| scripts/release_notes.py | script | 1.9 KB |
| templates/report-shell.html | other | 28.3 KB |
templates/report-shell.html
View on GitHub<!DOCTYPE html>
<html lang="zh-Hant">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{公司名}} 反向盡職調查</title>
<!--
報告樣板 — reverse-due-diligence skill
1) 把 {{...}} 佔位符換掉
2) 依 references/report-template.md 的骨架填章節
3) <style> 與 renderer JavaScript 視為 SSOT,不自行改寫;只改正文與 RDD_REPORT_DATA_START/END 之間的圖表資料
4) 若環境有資料視覺化指南/Skill,先讀取;若支援 browser automation,實際載入並檢查排版、深淺色與 console/page errors
-->
<style>
:root{
color-scheme: light;
--surface-0:#f6f5f2; --surface-1:#fcfcfb; --surface-2:#f0efec;
--border:#e2e0da; --border-strong:#c9c6bd;
--text-primary:#0b0b0b; --text-secondary:#52514e; --text-muted:#7c7a74;
--series-1:#2a78d6; --series-2:#eb6834; --series-3:#1baf7a; --series-4:#eda100;
--good:#008300; --warn:#eda100; --serious:#eb6834; --critical:#e34948;
--grid:#e6e4de;
}
:root[data-theme="dark"], :root:where(:not([data-theme="light"])){}
@media (prefers-color-scheme: dark){
:root:where(:not([data-theme="light"])){
color-scheme: dark;
--surface-0:#121211; --surface-1:#1a1a19; --surface-2:#242422;
--border:#33332f; --border-strong:#4a4a45;
--text-primary:#ffffff; --text-secondary:#c3c2b7; --text-muted:#96958c;
--series-1:#3987e5; --series-2:#d95926; --series-3:#199e70; --series-4:#c98500;
--good:#4caf50; --warn:#c98500; --serious:#d95926; --critical:#e66767;
--grid:#2e2e2b;
}
}
:root[data-theme="dark"]{
color-scheme: dark;
--surface-0:#121211; --surface-1:#1a1a19; --surface-2:#242422;
--border:#33332f; --border-strong:#4a4a45;
--text-primary:#ffffff; --text-secondary:#c3c2b7; --text-muted:#96958c;
--series-1:#3987e5; --series-2:#d95926; --series-3:#199e70; --series-4:#c98500;
--good:#4caf50; --warn:#c98500; --serious:#d95926; --critical:#e66767;
--grid:#2e2e2b;
}
*{box-sizing:border-box}
body{
margin:0; background:var(--surface-0); color:var(--text-primary);
font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans TC","PingFang TC","Microsoft JhengHei",sans-serif;
line-height:1.75; font-size:15.5px; -webkit-font-smoothing:antialiased;
}
.wrap{max-width:960px;margin:0 auto;padding:0 22px 100px}
header.hero{padding:56px 0 30px;border-bottom:1px solid var(--border)}
.kicker{font-size:12.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--text-muted);font-weight:600}
h1{font-size:clamp(28px,4.6vw,42px);line-height:1.2;margin:14px 0 10px;letter-spacing:-.02em}
.sub{color:var(--text-secondary);font-size:16px;max-width:64ch;margin:0}
.meta{margin-top:20px;font-size:13px;color:var(--text-muted)}
h2{font-size:23px;margin:56px 0 6px;letter-spacing:-.01em;scroll-margin-top:20px}
h2 .num{color:var(--text-muted);font-variant-numeric:tabular-nums;font-weight:500;margin-right:10px}
h3{font-size:17px;margin:30px 0 8px}
p{margin:12px 0}
a{color:var(--series-1)}
small{color:var(--text-muted)}
.lead{color:var(--text-secondary)}
.card{background:var(--surface-1);border:1px solid var(--border);border-radius:14px;padding:22px 24px;margin:22px 0}
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(158px,1fr));gap:12px;margin:26px 0}
.tile{background:var(--surface-1);border:1px solid var(--border);border-radius:12px;padding:15px 16px}
.tile .lab{font-size:11.5px;color:var(--text-muted);letter-spacing:.03em;font-weight:600}
.tile .val{font-size:26px;font-weight:650;letter-spacing:-.02em;font-variant-numeric:tabular-nums;margin-top:5px;line-height:1.15}
.tile .note{font-size:12px;color:var(--text-secondary);margin-top:3px}
.up{color:var(--good)} .down{color:var(--critical)}
table{width:100%;border-collapse:collapse;margin:18px 0;font-size:14px;font-variant-numeric:tabular-nums}
th,td{text-align:right;padding:9px 10px;border-bottom:1px solid var(--border)}
th:first-child,td:first-child{text-align:left;font-variant-numeric:normal}
thead th{font-size:12px;color:var(--text-muted);letter-spacing:.04em;border-bottom:1px solid var(--border-strong);font-weight:650}
tbody tr:hover{background:var(--surface-2)}
tfoot td{font-size:12px;color:var(--text-muted);border:0;text-align:left}
.fig{background:var(--surface-1);border:1px solid var(--border);border-radius:14px;padding:20px 20px 14px;margin:26px 0}
.fig .ftitle{font-size:15px;font-weight:650;margin-bottom:2px}
.fig .fsub{font-size:12.5px;color:var(--text-secondary);margin-bottom:14px}
.fig figcaption{font-size:12px;color:var(--text-muted);margin-top:10px;border-top:1px solid var(--border);padding-top:9px}
.legend{display:flex;flex-wrap:wrap;gap:14px;margin:2px 0 12px;font-size:12.5px;color:var(--text-secondary)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.sw{width:11px;height:11px;border-radius:3px;display:inline-block}
svg{display:block;width:100%;height:auto;overflow:visible}
.grid-line{stroke:var(--grid);stroke-width:1}
.axis-t{fill:var(--text-muted);font-size:11px;font-variant-numeric:tabular-nums}
.lab-t{fill:var(--text-primary);font-size:11.5px;font-weight:600;font-variant-numeric:tabular-nums}
.lab-s{fill:var(--text-secondary);font-size:10.5px;font-variant-numeric:tabular-nums}
.two{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media(max-width:680px){.two{grid-template-columns:1fr}}
ul,ol{padding-left:22px;margin:12px 0}
li{margin:7px 0}
.flag{border-left:3px solid var(--border-strong);padding:4px 0 4px 16px;margin:18px 0;color:var(--text-secondary)}
.flag.red{border-color:var(--critical)}
.flag.amber{border-color:var(--warn)}
.flag.green{border-color:var(--good)}
.flag b{color:var(--text-primary)}
.pill{display:inline-block;font-size:11px;font-weight:650;padding:2px 9px;border-radius:99px;border:1px solid var(--border-strong);color:var(--text-secondary);margin-right:6px;vertical-align:2px}
.pill.g{border-color:var(--good);color:var(--good)}
.pill.r{border-color:var(--critical);color:var(--critical)}
.pill.a{border-color:var(--warn);color:var(--warn)}
details{border:1px solid var(--border);border-radius:12px;padding:0;margin:14px 0;background:var(--surface-1)}
details summary{cursor:pointer;padding:13px 18px;font-weight:600;font-size:14.5px;list-style:none}
details summary::-webkit-details-marker{display:none}
details summary::before{content:"▸ ";color:var(--text-muted)}
details[open] summary::before{content:"▾ "}
details .body{padding:0 18px 16px}
.toc{background:var(--surface-1);border:1px solid var(--border);border-radius:14px;padding:16px 22px;margin:26px 0;font-size:14px}
.toc ol{columns:2;column-gap:30px;margin:6px 0 0}
@media(max-width:600px){.toc ol{columns:1}.themebtn{position:absolute;top:10px;right:10px}header.hero{padding-top:72px}}
.toc a{text-decoration:none;color:var(--text-secondary)}
.toc a:hover{color:var(--series-1)}
#tt{position:fixed;pointer-events:none;opacity:0;transition:opacity .09s;background:var(--surface-1);border:1px solid var(--border-strong);
border-radius:9px;padding:8px 11px;font-size:12.5px;box-shadow:0 6px 22px rgba(0,0,0,.16);z-index:99;max-width:250px;line-height:1.5}
#tt b{display:block;margin-bottom:3px;font-size:12px}
.themebtn{position:fixed;top:14px;right:14px;z-index:50;background:var(--surface-1);border:1px solid var(--border);
border-radius:99px;padding:7px 14px;font-size:12.5px;cursor:pointer;color:var(--text-secondary);font-family:inherit}
.q{background:var(--surface-1);border:1px solid var(--border);border-radius:12px;padding:16px 20px;margin:12px 0}
.q .why{font-size:13px;color:var(--text-secondary);margin-top:6px}
.q .qt{font-weight:600}
.src{font-size:13px;color:var(--text-secondary)}
.src li{margin:5px 0}
hr{border:0;border-top:1px solid var(--border);margin:40px 0}
.verdict{background:var(--surface-1);border:1px solid var(--border-strong);border-radius:16px;padding:26px 28px;margin:26px 0}
.scorebar{display:flex;align-items:center;gap:10px;margin:9px 0;font-size:13.5px}
.scorebar .nm{width:120px;color:var(--text-secondary);flex:none}
.scorebar .track{flex:1;height:9px;background:var(--surface-2);border-radius:99px;overflow:hidden}
.scorebar .fillb{display:block;height:100%;border-radius:99px;background:var(--series-1)}
.scorebar .sc{width:34px;text-align:right;font-variant-numeric:tabular-nums;font-weight:650;flex:none}
</style>
</head>
<body>
<button class="themebtn" id="tbtn">◐ 深/淺色</button>
<div id="tt"></div>
<div class="wrap">
<header class="hero">
<div class="kicker">Reverse Due Diligence · 求職者視角</div>
<h1>{{公司名}}({{代號}})<br>反向盡職調查</h1>
<p class="sub">為評估 <b>{{職缺}}</b> 職缺而做的公司調查:{{涵蓋範圍一句話}}。</p>
<p class="meta">資料截止:{{日期}} | {{關鍵即時數字}} | 全部數字來自公開財報、法說會紀要與媒體報導,來源列於文末</p>
</header>
<nav class="toc">
<b style="font-size:13px;color:var(--text-muted);letter-spacing:.05em">目錄</b>
<ol>
<li><a href="#s1">一分鐘結論</a></li>
<li><a href="#s2">公司是什麼、怎麼賺錢</a></li>
<!-- 依 references/report-template.md 的 17 節骨架續列 -->
</ol>
</nav>
<h2 id="s1"><span class="num">01</span>一分鐘結論</h2>
<!-- stat tiles:一分鐘結論放 4–6 個。note 的 class:up=綠、down=紅、留空=中性 -->
<div class="tiles">
<div class="tile"><div class="lab">標籤</div><div class="val">數值</div><div class="note up">附註</div></div>
</div>
<p class="lead">定調段落。先講結論,不要鋪陳。</p>
<!-- 旗標:green 好消息/red 壞消息/amber 需留意/無 class 為中性 -->
<div class="flag green"><b>好消息:</b>…</div>
<div class="flag red"><b>壞消息:</b>…</div>
<div class="flag amber"><b>需留意:</b>…</div>
<div class="flag"><b>中性提示:</b>…</div>
<h2 id="s2"><span class="num">02</span>章節標題</h2>
<!-- 圖表:容器 id 對應 drawAll() 裡的呼叫 -->
<figure class="fig">
<div class="ftitle">圖表標題</div>
<div class="fsub">副標:說明口徑與期間</div>
<div class="legend" id="leg-demo"></div>
<div id="c-demo"></div>
<figcaption>資料來源與限制。<b>推估值一定要在這裡標明。</b></figcaption>
</figure>
<!-- 小倍數:兩張並排 -->
<figure class="fig">
<div class="two">
<div><div class="ftitle">左圖標題</div><div class="fsub">副標</div><div id="c-mini-a"></div></div>
<div><div class="ftitle">右圖標題</div><div class="fsub">副標</div><div id="c-mini-b"></div></div>
</div>
<figcaption>資料來源。</figcaption>
</figure>
<!-- 表格:tfoot 放口徑與推估標註 -->
<table>
<thead><tr><th>欄位</th><th>數值</th></tr></thead>
<tbody><tr><td>項目</td><td>123</td></tr></tbody>
<tfoot><tr><td colspan="2">口徑說明、資料來源、推估標註</td></tr></tfoot>
</table>
<!-- 雙欄對照:正反兩種讀法 -->
<div class="two">
<div class="card"><b>正面讀法</b><p style="margin-bottom:0">…</p></div>
<div class="card" style="border-color:var(--warn)"><b>負面讀法</b><p style="margin-bottom:0">…</p></div>
</div>
<!-- pill:g 綠/r 紅/a 黃/無 中性 -->
<p><span class="pill g">低調</span><span class="pill r">非常高調</span><span class="pill a">中高</span><span class="pill">28% 營收</span></p>
<!-- 值不值得接:評分條 -->
<div class="verdict">
<h3 style="margin-top:0">整體判斷</h3>
<p class="lead">一句話定調。</p>
<div class="scorebar"><span class="nm">公司財務體質</span><span class="track"><span class="fillb" style="width:85%"></span></span><span class="sc">8.5</span></div>
<div class="scorebar"><span class="nm">角色實權</span><span class="track"><span class="fillb" style="width:60%"></span></span><span class="sc">6.0</span></div>
<p><small>分數為依公開資料的主觀評估,非公司官方或第三方評等。</small></p>
</div>
<!-- 面試題卡片 -->
<div class="q"><div class="qt">1. 具體到數字的提問,不是通用題庫。</div>
<div class="why">為什麼問這個、什麼答案是紅旗。</div></div>
<!-- 摺疊區塊(附錄、算式明細) -->
<details><summary>算式明細</summary><div class="body"><p>…</p></div></details>
<h2 id="sN"><span class="num">17</span>資料來源與方法說明</h2>
<div class="flag"><b>方法:</b>全部依據公開資料。匿名評論平台樣本小且自願填答,存在選擇偏誤,已在引用處標註。查不到的項目已標明「公開來源查不到」並註明可去哪裡找。</div>
<h3>分組標題</h3>
<ul class="src">
<li><a href="#">來源名稱</a>|<a href="#">另一個來源</a></li>
</ul>
<p style="margin-top:40px"><small>本報告依 {{日期}} 前之公開資訊彙整,僅供求職決策參考,不構成投資或法律建議。</small></p>
</div>
<script>
(function(){
const root=document.documentElement, btn=document.getElementById('tbtn');
btn.addEventListener('click',()=>{
const cur=root.getAttribute('data-theme');
const dark=cur?cur==='dark':window.matchMedia('(prefers-color-scheme: dark)').matches;
root.setAttribute('data-theme',dark?'light':'dark');
setTimeout(drawAll,30);
});
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change',()=>setTimeout(drawAll,30));
const tt=document.getElementById('tt');
function showTT(e,html){
// Only renderer-defined <b> formatting is supported. Source text stays text.
const match=/^<b>([\s\S]*?)<\/b>([\s\S]*)$/.exec(String(html));
if(match){
const heading=document.createElement('b');
heading.textContent=match[1];
tt.replaceChildren(heading,document.createTextNode(match[2]));
} else {
tt.textContent=String(html);
}
tt.style.opacity=1;moveTT(e);
}
function moveTT(e){
const p=12; let x=e.clientX+p, y=e.clientY+p;
const r=tt.getBoundingClientRect();
if(x+r.width>window.innerWidth-8) x=e.clientX-r.width-p;
if(y+r.height>window.innerHeight-8) y=e.clientY-r.height-p;
tt.style.left=x+'px'; tt.style.top=y+'px';
}
function hideTT(){tt.style.opacity=0;}
function bind(el,html){
el.style.cursor='default';
el.addEventListener('mouseenter',e=>showTT(e,html));
el.addEventListener('mousemove',moveTT);
el.addEventListener('mouseleave',hideTT);
}
const cs=()=>getComputedStyle(document.body);
const V=n=>cs().getPropertyValue(n).trim();
function appendLegend(leg,name,color){
const label=document.createElement('span'), swatch=document.createElement('i');
swatch.className='sw';
swatch.style.background=V(color);
label.append(swatch,document.createTextNode(String(name)));
leg.appendChild(label);
}
const NS='http://www.w3.org/2000/svg';
function E(t,a){const e=document.createElementNS(NS,t);for(const k in a)e.setAttribute(k,a[k]);return e;}
function svg(w,h){const s=E('svg',{viewBox:`0 0 ${w} ${h}`,role:'img'});return s;}
function txt(s,x,y,t,cls,anchor){const e=E('text',{x,y,class:cls||'axis-t'});if(anchor)e.setAttribute('text-anchor',anchor);e.textContent=t;s.appendChild(e);return e;}
function rrect(s,x,y,w,h,r,fill,extra){
// rounded top only (data end), anchored to baseline
r=Math.min(r,w/2,h);
const d=`M${x},${y+h} L${x},${y+r} Q${x},${y} ${x+r},${y} L${x+w-r},${y} Q${x+w},${y} ${x+w},${y+r} L${x+w},${y+h} Z`;
const p=E('path',Object.assign({d,fill},extra||{})); s.appendChild(p); return p;
}
/* ═══════════════════════════════════════════════════════════════════════
繪圖函式庫 — 改資料陣列即可,不要重寫樣式;若環境有資料視覺化指南/Skill,先讀取。
drawBars(id, data, o) 直條圖 data:[{y,v,est?,note?}]
drawSignedBars(id, data, o) 正負值直條圖 data:[{y,v,note?}]
drawNodeLine(id, pts, o) 節點折線圖 pts:[{t,v,l,key?}]
drawGrouped(id, data, o) 分組直條圖 data:[{n,a,b}] o.labels:[A,B]
drawStacked(id, rows, ser) 百分比堆疊橫條 rows:[{y,v:[..]}] ser:[{n,k}]
drawMini(id, data, o) 小倍數圖(放進 .two 並排)
drawScores(id, data, o) 橫條評分圖 data:[{n,v}] o.max, o.lowBelow
drawRanges(id, data, o) 區間橫條圖 data:[{n,lo,hi,c,t}]
共通 o:max 上限、unit 單位字串、fmt 格式化函式、ticks 格線數
所有 mark 自動綁 tooltip;深淺色切換自動重繪。
═══════════════════════════════════════════════════════════════════════ */
const F = v => v.toLocaleString();
function axisY(s,ml,mr,W,mt,ph,max,ticks,fmt,unit){
for(let i=0;i<=ticks;i++){
const g=max*i/ticks, y=mt+ph-(g/max)*ph;
s.appendChild(E('line',{x1:ml,x2:W-mr,y1:y,y2:y,class:'grid-line'}));
txt(s,ml-9,y+4,fmt(g),'axis-t','end');
}
if(unit) txt(s,ml-9,mt-16,unit,'axis-t','end');
}
function drawBars(id,data,o){
o=o||{}; const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const fmt=o.fmt||F, max=o.max||Math.max(...data.map(d=>d.v))*1.25, ticks=o.ticks||4;
const W=780,H=o.height||290,ml=o.ml||52,mr=14,mt=26,mb=40, pw=W-ml-mr, ph=H-mt-mb;
const s=svg(W,H); host.appendChild(s); const c1=V('--series-1');
axisY(s,ml,mr,W,mt,ph,max,ticks,fmt,o.unit);
const bw=pw/data.length, iw=Math.min(60,bw*0.6);
data.forEach((d,i)=>{
const x=ml+i*bw+(bw-iw)/2, h=(d.v/max)*ph, y=mt+ph-h;
const p=rrect(s,x,y,iw,h,4, d.est?'none':c1,
d.est?{stroke:c1,'stroke-width':2,'stroke-dasharray':'5 4'}:{});
bind(p,`<b>${d.y} ${fmt(d.v)}${o.unit||''}</b>${d.note||(d.est?'推估值,非公司財測':'')}`);
txt(s,x+iw/2,y-8,fmt(d.v),'lab-t','middle');
txt(s,x+iw/2,H-14,d.y,'axis-t','middle');
});
}
function drawSignedBars(id,data,o){
o=o||{}; const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const fmt=o.fmt||(v=>v.toFixed(2));
const vs=data.map(d=>d.v), min=o.min!==undefined?o.min:Math.min(0,...vs)*1.4, max=o.max||Math.max(...vs)*1.25;
const W=780,H=o.height||270,ml=52,mr=14,mt=26,mb=40, pw=W-ml-mr, ph=H-mt-mb, span=max-min;
const s=svg(W,H); host.appendChild(s);
const pos=V('--series-1'), neg=V('--critical'), zero=mt+ph-((0-min)/span)*ph;
const step=(max-min)/(o.ticks||6);
for(let g=min; g<=max+1e-9; g+=step){
const y=mt+ph-((g-min)/span)*ph, isZero=Math.abs(g)<1e-9;
s.appendChild(E('line',{x1:ml,x2:W-mr,y1:y,y2:y,class:'grid-line',
'stroke-width':isZero?1.6:1, stroke:isZero?V('--border-strong'):undefined}));
txt(s,ml-9,y+4,g.toFixed(0),'axis-t','end');
}
if(o.unit) txt(s,ml-9,mt-16,o.unit,'axis-t','end');
const bw=pw/data.length, iw=Math.min(66,bw*0.5), rr=4;
data.forEach((d,i)=>{
const x=ml+i*bw+(bw-iw)/2, hv=Math.abs(d.v)/span*ph;
let p;
if(d.v>=0){ p=rrect(s,x,zero-hv,iw,hv,rr,pos); }
else{ const y=zero,w=iw,h=hv;
p=E('path',{d:`M${x},${y} L${x},${y+h-rr} Q${x},${y+h} ${x+rr},${y+h} L${x+w-rr},${y+h} Q${x+w},${y+h} ${x+w},${y+h-rr} L${x+w},${y} Z`,fill:neg});
s.appendChild(p); }
bind(p,`<b>${d.y} ${d.v>0?'+':''}${fmt(d.v)}${o.unit||''}</b>${d.note||''}`);
txt(s,x+iw/2, d.v>=0?zero-hv-8:zero+hv+16, (d.v>0?'+':'')+fmt(d.v),'lab-t','middle');
txt(s,x+iw/2,H-14,d.y,'axis-t','middle');
});
}
function drawNodeLine(id,pts,o){
o=o||{}; const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const max=o.max||Math.max(...pts.map(p=>p.v))*1.12, ticks=o.ticks||4;
const W=780,H=o.height||300,ml=52,mr=o.mr||90,mt=30,mb=44, pw=W-ml-mr, ph=H-mt-mb;
const s=svg(W,H); host.appendChild(s);
const c1=V('--series-1'), surf=V('--surface-1');
axisY(s,ml,mr,W,mt,ph,max,ticks,o.fmt||(v=>Math.round(v)),null);
const X=i=>ml+(i/(pts.length-1))*pw, Y=v=>mt+ph-(v/max)*ph;
let d=''; pts.forEach((p,i)=>{ d+=(i?' L':'M')+X(i)+','+Y(p.v); });
s.appendChild(E('path',{d,fill:'none',stroke:c1,'stroke-width':2,
'stroke-linejoin':'round','stroke-dasharray': o.solid?null:'6 5', opacity:o.solid?1:.55}));
pts.forEach((p,i)=>{
const cx=X(i), cy=Y(p.v);
const c=E('circle',{cx,cy,r:p.key?6:5,fill:c1,stroke:surf,'stroke-width':2});
s.appendChild(c); bind(c,`<b>${p.t} · ${o.prefix||''}${p.v}</b>${p.l||''}`);
if(p.key) txt(s, i===0?cx+10:cx, cy-14, (o.prefix||'')+p.v, 'lab-t', i===0?'start':'middle');
txt(s,cx,H-24,p.t,'axis-t','middle');
});
(o.notes||[]).forEach(n=>txt(s,W-mr+8,Y(n.at)+4,n.text,'lab-s','start'));
}
function drawGrouped(id,data,o){
o=o||{}; const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const labels=o.labels||['A','B'], fmt=o.fmt||F;
const max=o.max||Math.max(...data.flatMap(d=>[d.a,d.b]))*1.2, ticks=o.ticks||4;
const W=780,H=o.height||280,ml=52,mr=14,mt=26,mb=44, pw=W-ml-mr, ph=H-mt-mb;
const s=svg(W,H); host.appendChild(s);
const c1=V('--series-1'), c2=V('--series-2');
axisY(s,ml,mr,W,mt,ph,max,ticks,fmt,o.unit);
const gw=pw/data.length, iw=Math.min(56,gw*0.3), gap=6;
data.forEach((d,i)=>{
const cx=ml+i*gw+gw/2;
[[d.a,c1,-1,labels[0]],[d.b,c2,1,labels[1]]].forEach(([v,col,side,lbl])=>{
const x=side<0?cx-iw-gap/2:cx+gap/2, hh=(v/max)*ph, y=mt+ph-hh;
const p=rrect(s,x,y,iw,hh,4,col);
bind(p,`<b>${d.n}</b>${lbl}:${fmt(v)}${o.unit||''}`);
txt(s,x+iw/2,y-8,fmt(v),'lab-t','middle');
});
txt(s,cx,H-16,d.n,'axis-t','middle');
});
}
function drawStacked(id,rows,series,o){
o=o||{};
const leg=document.getElementById(o.legendId||('leg-'+id.replace(/^c-/,'')));
if(leg){ leg.replaceChildren(); series.forEach(m=>appendLegend(leg,m.n,m.k)); }
const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const W=780,H=o.height||(rows.length*76+52),ml=o.ml||92,mr=20,mt=14, pw=W-ml-mr, bh=48, gap=28;
const s=svg(W,H); host.appendChild(s);
rows.forEach((r,ri)=>{
const y=mt+ri*(bh+gap); let x=ml;
txt(s,ml-12,y+bh/2+5,r.y,'lab-t','end');
r.v.forEach((val,i)=>{
const w=(val/100)*pw-2, first=i===0, last=i===r.v.length-1, rr=4;
let d;
if(first) d=`M${x+rr},${y} L${x+w},${y} L${x+w},${y+bh} L${x+rr},${y+bh} Q${x},${y+bh} ${x},${y+bh-rr} L${x},${y+rr} Q${x},${y} ${x+rr},${y} Z`;
else if(last) d=`M${x},${y} L${x+w-rr},${y} Q${x+w},${y} ${x+w},${y+rr} L${x+w},${y+bh-rr} Q${x+w},${y+bh} ${x+w-rr},${y+bh} L${x},${y+bh} Z`;
else d=`M${x},${y} L${x+w},${y} L${x+w},${y+bh} L${x},${y+bh} Z`;
const p=E('path',{d,fill:V(series[i].k)}); s.appendChild(p);
bind(p,`<b>${r.y}</b>${series[i].n}:${val}%`);
// 淺色系色塊(黃)改用深色字,否則對比不足
if(w>34) txt(s,x+w/2,y+bh/2+5,val+'%','lab-t','middle')
.setAttribute('fill', /yellow|--series-4/.test(series[i].k) ? '#0b0b0b' : '#ffffff');
x+=w+2;
});
});
if(o.caption) txt(s,ml,H-10,o.caption,'axis-t','start');
}
function drawMini(id,data,o){
o=o||{}; const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const fmt=o.fmt||F, max=o.max||Math.max(...data.map(d=>d.v))*1.25, ticks=o.ticks||4;
const W=360,H=210,ml=40,mr=10,mt=24,mb=34, pw=W-ml-mr, ph=H-mt-mb;
const s=svg(W,H); host.appendChild(s); const c1=V('--series-1');
for(let i=0;i<=ticks;i++){ const g=max*i/ticks, y=mt+ph-(g/max)*ph;
s.appendChild(E('line',{x1:ml,x2:W-mr,y1:y,y2:y,class:'grid-line'}));
txt(s,ml-8,y+4,fmt(g),'axis-t','end'); }
const bw=pw/data.length, iw=Math.min(42,bw*0.56);
data.forEach((d,i)=>{
const x=ml+i*bw+(bw-iw)/2, h=(d.v/max)*ph, y=mt+ph-h;
const p=rrect(s,x,y,iw,h,4,c1);
bind(p,`<b>${d.y} ${fmt(d.v)} ${o.unit||''}</b>${d.note||''}`);
txt(s,x+iw/2,y-7,fmt(d.v),'lab-t','middle');
txt(s,x+iw/2,H-12,d.y,'axis-t','middle');
});
}
function drawScores(id,data,o){
o=o||{}; const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const max=o.max||5, low=o.lowBelow!==undefined?o.lowBelow:3, row=38, bh=20;
const W=780,H=data.length*row+42,ml=o.ml||92,mr=44,mt=8, pw=W-ml-mr;
const s=svg(W,H); host.appendChild(s);
const c1=V('--series-1'), warn=V('--critical');
for(let g=0;g<=max;g++){ const x=ml+(g/max)*pw;
s.appendChild(E('line',{x1:x,x2:x,y1:mt,y2:mt+data.length*row-14,class:'grid-line'}));
txt(s,x,H-12,g,'axis-t','middle'); }
data.forEach((d,i)=>{
const y=mt+i*row, w=(d.v/max)*pw, isLow=d.v<low, rr=4;
const p=E('path',{d:`M${ml},${y} L${ml+w-rr},${y} Q${ml+w},${y} ${ml+w},${y+rr} L${ml+w},${y+bh-rr} Q${ml+w},${y+bh} ${ml+w-rr},${y+bh} L${ml},${y+bh} Z`,
fill:isLow?warn:c1});
s.appendChild(p);
bind(p,`<b>${d.n} ${d.v.toFixed(1)} / ${max.toFixed(1)}</b>${isLow?'低於中位水準':(d.note||'')}`);
txt(s,ml-12,y+bh/2+5,d.n,'lab-s','end');
txt(s,ml+w+8,y+bh/2+5,d.v.toFixed(1),'lab-t','start');
});
}
function drawRanges(id,data,o){
o=o||{}; const host=document.getElementById(id); if(!host) return; host.innerHTML='';
const max=o.max||Math.max(...data.map(d=>d.hi))*1.1, suffix=o.suffix||'%';
const row=44,bh=18;
const W=780,H=data.length*row+46,ml=o.ml||176,mr=54,mt=10, pw=W-ml-mr;
const s=svg(W,H); host.appendChild(s);
const step=max/(o.ticks||5);
for(let g=0;g<=max+1e-9;g+=step){ const x=ml+(g/max)*pw;
s.appendChild(E('line',{x1:x,x2:x,y1:mt,y2:mt+data.length*row-18,class:'grid-line'}));
txt(s,x,H-12,Math.round(g)+suffix,'axis-t','middle'); }
data.forEach((d,i)=>{
const y=mt+i*row, x1=ml+(d.lo/max)*pw, x2=ml+(d.hi/max)*pw, point=d.lo===d.hi;
const w=point?9:Math.max(x2-x1,9), xx=point?x1-4.5:x1, rr=4;
const p=E('path',{d:`M${xx+rr},${y} L${xx+w-rr},${y} Q${xx+w},${y} ${xx+w},${y+rr} L${xx+w},${y+bh-rr} Q${xx+w},${y+bh} ${xx+w-rr},${y+bh} L${xx+rr},${y+bh} Q${xx},${y+bh} ${xx},${y+bh-rr} L${xx},${y+rr} Q${xx},${y} ${xx+rr},${y} Z`,
fill:V(d.c||'--series-1')});
s.appendChild(p);
const lbl=point?d.lo+suffix:d.lo+'–'+d.hi+suffix;
bind(p,`<b>${d.n} ${lbl}</b>${d.t||''}`);
txt(s,ml-14,y+bh/2+5,d.n,'lab-s','end');
txt(s,xx+w+9,y+bh/2+5,lbl,'lab-t','start');
});
}
function legend(id,items){
const leg=document.getElementById(id); if(!leg) return; leg.replaceChildren();
items.forEach(([n,k])=>appendLegend(leg,n,k));
}
/* RDD_REPORT_DATA_START */
/* ── 在這裡呼叫需要的圖表。其餘為可直接改用的範例 ───────────────── */
function drawAll(){
drawBars('c-demo',
[{y:'2022',v:420},{y:'2023',v:774},{y:'2024',v:867},{y:'2025',v:1048},{y:'2026E',v:1260,est:true}],
{max:1400, unit:'百萬元'});
// drawSignedBars('c-eps', [{y:'2023',v:0.16},{y:'2024',v:-1.24},{y:'2025',v:1.58}],
// {min:-2, max:4, unit:'元'});
// drawNodeLine('c-price', [{t:'2023.07',v:236.5,l:'掛牌開盤',key:1},{t:'2026.08',v:132.5,l:'現價',key:1}],
// {max:260, prefix:'NT$', notes:[{at:236.5,text:'−38%'}]});
// legend('leg-demo', [['方案年費','--series-1'],['平均每人年費','--series-2']]);
// drawGrouped('c-price2', [{n:'個人版',a:890,b:890},{n:'家庭版',a:2590,b:518}],
// {max:3000, unit:'元/年', labels:['方案年費','平均每人年費']});
// drawStacked('c-mix', [{y:'2025 全年',v:[31,32,27,10]},{y:'2026 Q2',v:[34,29,28,9]}],
// [{n:'數位廣告',k:'--series-1'},{n:'訂閱',k:'--series-2'},
// {n:'金融科技',k:'--series-3'},{n:'企業防詐',k:'--series-4'}],
// {caption:'占總營收比重(%)'});
// drawMini('c-mini-a', [{y:'2023',v:155},{y:'2024',v:246,note:'高峰'},{y:'2025',v:211}], {max:260, unit:'人'});
// drawMini('c-mini-b', [{y:'2023',v:5.0},{y:'2024',v:3.5},{y:'2025',v:5.0}], {max:7, fmt:v=>v.toFixed(1)});
// drawScores('c-rate', [{n:'生活平衡',v:4.0},{n:'升遷機會',v:2.3}], {max:5, lowBelow:3});
// drawRanges('c-rates', [
// {n:'銀行信用貸款',lo:2,hi:16,c:'--text-muted',t:'需信用紀錄'},
// {n:'實質年化(推算)',lo:36,hi:36,c:'--series-2',t:'依單一公開案例推算'},
// {n:'當舖法定年利率上限(非總成本)',lo:30,hi:30,c:'--text-muted',t:'《當舖業法》第 11 條;口徑不同,不可直接比較'}], {max:100});
}
drawAll();
/* RDD_REPORT_DATA_END */
})();
</script>
</body>
</html>
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |