Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

recharts

БесплатноБез исполняемых скриптовНе проверен

Recharts is a composable charting library for React that renders responsive SVG charts. Use when a user asks to create line charts, bar charts, area charts…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Recharts — React Charting Library

Overview

Recharts is a composable charting library for React that renders SVG and uses D3 for scales and shapes. A chart is a tree of components — a chart container such as LineChart, plus axes, grid, tooltip, legend and one component per data series — so line, bar, area, pie, scatter and mixed charts are all built the same way.

This skill targets Recharts 3 (3.10 at the time of writing). Version 3 rewrote the internal state and changed a few public APIs: custom tooltips are typed with TooltipContentProps, Cell is deprecated in favour of the shape prop or a fill field in the data, activeIndex is gone, keyboard accessibility is on by default, and since 3.3 a chart can size itself with the responsive prop instead of a ResponsiveContainer wrapper.

Instructions

Installation

npm install recharts react-is

react-is must be the same version as the installed react.

Common Chart Types

// Line chart with multiple series
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from "recharts";

type Row = Record<string, string | number>;
const data: Row[] = [
  { 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 },
];

// `responsive` (3.3+) makes the chart follow its container; size it with ordinary CSS
function RevenueChart() {
  return (
    <LineChart responsive data={data} style={{ width: "100%", height: 400 }}
               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()}`}
        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>
  );
}

// Bar chart — ResponsiveContainer still works and is the only option before 3.3;
// with a percentage height its parent element must have a height, or the chart renders with no size
import { BarChart, Bar } from "recharts";

function MRRChart({ data }: { data: Row[] }) {
  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 }: { data: Row[] }) {
  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 — give each row a `fill`; sectors, legend and tooltip all pick it up
import { PieChart, Pie } from "recharts";

const plans = [
  { plan: "Free", value: 620, fill: "#4f46e5" },
  { plan: "Starter", value: 240, fill: "#22c55e" },
  { plan: "Growth", value: 105, fill: "#f59e0b" },
  { plan: "Pro", value: 35, fill: "#ef4444" },
];

function PlanDistribution() {
  return (
    <PieChart responsive style={{ width: "100%", maxWidth: 360, aspectRatio: 1 }}>
      <Pie data={plans} dataKey="value" nameKey="plan" cx="50%" cy="50%"
           innerRadius={60} outerRadius={100} paddingAngle={2} />
      <Tooltip />
      <Legend />
    </PieChart>
  );
}

Custom Tooltips and Labels

// Custom tooltip component — in v3 the props type is TooltipContentProps, not TooltipProps
import { Tooltip, type TooltipContentProps } from "recharts";

const CustomTooltip = ({ active, payload, label }: TooltipContentProps) => {
  if (!active || !payload?.length) return null;
  return (
    <div style={{ background: "whi
Полный SKILL.md на GitHub

Установить recharts в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл recharts?

Recharts is a composable charting library for React that renders responsive SVG charts. Use when a user asks to create line charts, bar charts, area charts, pie charts, or composed dashboard visualizations using the Recharts component library.

Как установить скилл recharts?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл recharts запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить recharts с