Communitygithub.com

YepAPI/skills - 資料視覺化

使用 Recharts/Nivo/D3 製作圖表模式,支援響應式容器、色彩比例與無障礙存取。

skills - 資料視覺化 是什麼?

這個技能提供統一的資料視覺化指南,專注於 React 生態系中的圖表實作。它強制規範圖表庫的選擇:Recharts 用於標準圖表、Nivo 用於豐富互動圖表(如熱力圖、樹狀圖)、D3 僅用於自訂視覺化,且不讓 D3 直接操作 DOM。主要功能包括預設使用 `<ResponsiveContainer>` 實現響應式設計、採用色盲安全調色盤(如 Tableau 10、ColorBrewer)、人類可讀的座標軸格式、提示框在地化、以及支援暗色模式主題切換。技能也規定資料應由父元件取得並以 props 傳入圖表,避免圖表元件內直接進行資料擷取。此外,它提供常見圖表類型(折線圖、長條圖、圓餅圖等)的選用指南,並明確禁止 3D 圖表、超過 5 個區塊的圓餅圖、缺少標籤的圖表,以及非必要的重複動畫。此技能特別適合 YepAPI 的 SEO 儀表板應用,可將頁面稽核分數、關鍵字趨勢、反向連結成長等資料視覺化。支援平台包括所有 React 專案,尤其是使用 Claude Code、Coder 或 Codex 等 AI 代理的開發環境。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/data-visualization

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

資料視覺化

規則

  • Recharts 用於標準 React 圖表 — 可組合、有型別、開箱即用的響應式
  • Nivo 用於豐富互動圖表(熱力圖、樹狀圖、桑基圖)— 宣告式 API,內建動畫
  • D3 僅用於自訂/新穎的視覺化 — 使用 React refs,不要讓 D3 管理 DOM
  • 務必包裹在 <ResponsiveContainer width="100%" height={300}> 中 — 永遠不要硬編碼像素尺寸
  • 色彩調色盤:使用色盲安全的調色盤(例如 Tableau 10、ColorBrewer)— 永遠不要單獨依賴紅/綠色
  • 座標軸格式:人類可讀的數字(1.2K、$3.4M),若類別超過 8 個則旋轉標籤
  • 提示框:懸停時顯示精確數值,包含單位與地區感知格式
  • 圖例:放置在圖表區域外部,使用清楚標籤 — 若僅有一個數列則隱藏圖例
  • 載入狀態:渲染與圖表形狀相符的骨架 — 而非一般的旋轉圈
  • 在父元件中取得資料,以 props 傳遞給圖表 — 永遠不要在圖表元件內部擷取資料
  • 對於 SEO 儀表板,使用 YepAPI 端點資料(頁面稽核分數、關鍵字趨勢、反向連結成長)作為圖表資料來源
  • 暗色模式:定義一個包含背景、網格、文字與數列色彩的主題物件 — 根據主題上下文切換

圖表類型選擇

  • 折線圖:隨時間變化的趨勢(流量、營收)
  • 長條圖:類別比較(頁面分數、關鍵字數)
  • 面積圖:累積體積(反向連結總數隨時間變化)
  • 圓餅圖/甜甜圈圖:整體中的部分,最多 5 個區塊 — 將小數值分組為「其他」
  • 熱力圖:二維資料密度(按小時和日的流量)
  • 漏斗圖:轉換步驟與流失率

避免

  • 3D 圖表 — 它們會扭曲資料感知
  • 超過 5 個區塊的圓餅圖 — 改用水平長條圖
  • 缺少座標軸標籤或上下文的圖表 — 務必提供單位與時間範圍
  • 每次重新渲染都播放動畫 — 僅在初次載入或資料變更時播放動畫

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Tenant isolation (row-level vs schema), subdomain routing, per-tenant config, and data partitioning.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

相關技能