Communitygithub.com

YepAPI/skills

使用 Recharts/Chart.js 进行数据可视化 — 柱状图、折线图、面积图、饼图。

skills 是什么?

此技能专注于使用 Recharts 和 Chart.js 库在 React 项目中进行高效、无障碍的数据可视化。它提供了一套清晰的规则,指导开发者如何选择合适的图表类型(如折线图用于趋势、柱状图用于比较、面积图展示体积、饼图展示占比),并确保图表具备良好的响应式布局、无障碍颜色、清晰的轴标签和工具提示。该技能强调了最佳实践,例如始终使用 `<ResponsiveContainer>` 包裹图表、避免 3D 效果和过多饼图切片,以及将数据获取逻辑从图表组件中分离出来。它适用于所有使用 React 和 Recharts 或 Chart.js 的前端开发项目,能够帮助团队产出专业、易用且美观的数据可视化界面。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/charts

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

图表与数据可视化

规则

  • 在 React 项目中使用 Recharts — 可组合、响应式、类型完善
  • 使用 <ResponsiveContainer width="100%" height={300}> 包裹图表 — 切勿使用固定像素宽度
  • 无障碍颜色:使用色盲友好的调色板(不依赖红/绿区分)
  • 轴标签:始终标注两个坐标轴,使用可读的数字格式(如 1.2K 而非 1200)
  • 工具提示:悬停时显示精确数值 — 格式包含单位并使用本地化数字
  • 加载状态:数据加载时显示骨架图表形状
  • 根据数据选择图表类型:折线图(随时间变化的趋势)、柱状图(比较)、面积图(体积)、饼图(整体中的部分 — 最多 5 个切片)
  • 动态数据上的 key 属性 — 当数据变化时 Recharts 能正确重新渲染

避免

  • 3D 图表 — 它们会扭曲感知,始终使用平面/2D 图表
  • 超过 5-6 个切片的饼图 — 改用水平柱状图
  • 没有轴标签或图例的图表 — 始终提供上下文
  • 在图表组件内部获取数据 — 在父组件中获取,通过 props 传递

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

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

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

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

相关技能