recharts
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "recharts":https://skillpi.com/zh/skills/deepskill-c84dd7f876396aa91e627ed29cd85057e8c25cb27f931b45fdb6db72627c6b57。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
使用 Recharts 在 React 中构建响应式图表。适用于创建折线图、柱状图、面积图、饼图或使用 Recharts 组件库构建复合仪表板可视化的场景。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
Frontmatter
name: recharts
description: >-
Build responsive charts in React with Recharts. Use when a user asks to create line charts, bar charts, area charts, pie charts, or composed dashboard visualizations using the Recharts component library.
license: Apache-2.0
compatibility: "No special requirements"
metadata:
author: terminal-skills
version: "1.0.0"
category: development
tags: ["charts", "react", "data-visualization", "svg", "dashboard"]Recharts — React Charting Library
Overview
You are an expert in Recharts, the composable React charting library built on D3. You help developers create line charts, bar charts, area charts, pie charts, scatter plots, and custom visualizations using React's declarative component model with responsive containers and smooth animations.
Instructions
Common Chart Types
// Line chart with multiple series
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from "recharts";
const data = [
{ month: "Jan", revenue: 4000, costs: 2400, profit: 1600 },
{ month: "Feb", revenue: 3000, costs: 1398, profit: 1602 },
{ month: "Mar", revenue: 5000, costs: 3200, profit: 1800 },
{ month: "Apr", revenue: 4780, costs: 2908, profit: 1872 },
{ month: "May", revenue: 5890, costs: 3800, profit: 2090 },
{ month: "Jun", revenue: 6390, costs: 3900, profit: 2490 },
];
function RevenueChart() {
return (
<ResponsiveContainer width="100%" height={400}>
<LineChart data={data} margin={{ top: 5, right: 30, left: 20, bottom: 5 }}>
<CartesianGrid strokeDasharray="3 3" stroke="#f0f0f0" />
<XAxis dataKey="month" />
<YAxis tickFormatter={(v) => `$${v / 1000}k`} />
<Tooltip
formatter={(value: number) => [`$${value.toLocaleString()}`, undefined]}
contentStyle={{ borderRadius: 8, border: "1px solid #e0e0e0" }}
/>
<Legend />
<Line type="monotone" dataKey="revenue" stroke="#4f46e5" strokeWidth={2} dot={{ r: 4 }} />
<Line type="monotone" dataKey="costs" stroke="#ef4444" strokeWidth={2} dot={{ r: 4 }} />
<Line type="monotone" dataKey="profit" stroke="#22c55e" strokeWidth={2} strokeDasharray="5 5" />
</LineChart>
</ResponsiveContainer>
);
}
// Bar chart
import { BarChart, Bar } from "recharts";
function MRRChart({ data }) {
return (
<ResponsiveContainer width="100%" height={300}>
<BarChart data={data}>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="month" />
<YAxis />
<Tooltip />
<Bar dataKey="newMRR" stackId="a" fill="#4f46e5" name="New MRR" />
<Bar dataKey="expansionMRR" stackId="a" fill="#22c55e" name="Expansion" />
<Bar dataKey="churnMRR" stackId="a" fill="#ef4444" name="Churn" />
</BarChart>
</ResponsiveContainer>
);
}
// Area chart
import { AreaChart, Area } from "recharts";
function TrafficChart({ data }) {
return (
<ResponsiveContainer width="100%" height={300}>
<AreaChart data={data}>
<defs>
<linearGradient id="colorVisits" x1="0" y1="0" x2="0" y2="1">
<stop offset="5%" stopColor="#4f46e5" stopOpacity={0.3} />
<stop offset="95%" stopColor="#4f46e5" stopOpacity={0} />
</linearGradient>
</defs>
<XAxis dataKey="date" />
<YAxis />
<Tooltip />
<Area type="monotone" dataKey="visits" stroke="#4f46e5" fill="url(#colorVisits)" />
</AreaChart>
</ResponsiveContainer>
);
}
// Pie / Donut chart
import { PieChart, Pie, Cell } from "recharts";
const COLORS = ["#4f46e5", "#22c55e", "#f59e0b", "#ef4444"];
function PlanDistribution({ data }) {
return (
<ResponsiveContainer width="100%" height={300}>
<PieChart>
<Pie data={data} dataKey="value" nameKey="plan" cx="50%" cy="50%"
innerRadius={60} outerRadius={100} paddingAngle={2}>
{data.map((_, i) => <Cell key={i} fill={COLORS[i % COLORS.length]} />)}
</Pie>
<Tooltip />
<Legend />
</PieChart>
</ResponsiveContainer>
);
}
Custom Tooltips and Labels
// Custom tooltip component
const CustomTooltip = ({ active, payload, label }) => {
if (!active || !payload) return null;
return (
<div style={{ background: "white", padding: 12, borderRadius: 8, boxShadow: "0 2px 8px rgba(0,0,0,0.1)" }}>
<p style={{ fontWeight: 600 }}>{label}</p>
{payload.map((entry, i) => (
<p key={i} style={{ color: entry.color }}>
{entry.name}: ${entry.value.toLocaleString()}
</p>
))}
</div>
);
};
// Usage: <Tooltip content={<CustomTooltip />} />
Installation
npm install recharts
Examples
Example 1: User asks to set up recharts
User: "Help me set up recharts for my project"
The agent should:
- Check system requirements and prerequisites
- Install or configure recharts
- Set up initial project structure
- Verify the setup works correctly
Example 2: User asks to build a feature with recharts
User: "Create a dashboard using recharts"
The agent should:
- Scaffold the component or configuration
- Connect to the appropriate data source
- Implement the requested feature
- Test and validate the output
Guidelines
- ResponsiveContainer always — Wrap every chart in
<ResponsiveContainer width="100%" height={...}>for responsive sizing - Composable architecture — Mix and match components (Line + Bar + Area in one chart); Recharts is fully composable
- Custom tooltips — Replace default tooltips with styled components for polished dashboards
- Color consistency — Define a color palette once and reuse; match your brand colors
- Data transformation outside — Transform data before passing to Recharts; keep chart components focused on rendering
- Gradients for area charts — Use SVG
<linearGradient>in<defs>for polished area fills - Animation control — Set
isAnimationActive={false}for real-time data; animations on initial render only for static dashboards - Reference lines — Use
<ReferenceLine>for targets, thresholds, and benchmarks overlaid on charts
当前收录版本
1.0.0
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Recharts 多种图表类型的完整实现示例
- 覆盖折线图、柱状图、面积图、饼图等高频可视化需求
- 适用于 React 开发者构建数据仪表板的通用场景
亮点
- 触发词覆盖多种图表类型和复合仪表板场景
- 边界清晰,不易与其他 Skill 重叠
亮点
- 结构完整,包含代码示例、安装指南、使用案例和规范建议
- frontmatter 信息齐全,文档组织清晰
亮点
- 提供标准 npm 安装命令,工具来源明确
- 代码示例参数正确,涵盖主要异常处理(如自定义 Tooltip)
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 142 行
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。