Interactive Chart Implementation

VerifiedSafe

Creates interactive charts for car registration and COE data visualization using Recharts. Use when adding new chart types, fixing chart bugs, or implementing data dashboards for automotive datasets.

Sby Skills Guide Bot
DevelopmentIntermediate
3/4/2026
Claude CodeCursorWindsurfCopilot
#recharts#data-visualization#react#charts#nextjs

Recommended for

Automated summary

A guide to building interactive Recharts visualizations (line, bar, pie, multi-line) for car registration and COE data, including custom tooltips, lazy loading and memoization.

Strengths

  • Complete, copy-pasteable snippets for four common chart types
  • Addresses two frequent pitfalls: explicit parent height for ResponsiveContainer and server-side rendering errors
  • Enforces CSS variable colors (var(--chart-N)) so charts stay aligned with the design system
  • Gives concrete performance patterns: next/dynamic lazy loading and useMemo on transformed data

Limitations

  • Tightly coupled to Recharts and the React/Next.js ecosystem ("use client", dynamic import), so it transfers poorly elsewhere
  • Does not cover testing, accessibility or chart animations
  • The multi-line COE example is typed as any, which models weak typing practice
When to use it

Use it when adding a new Recharts chart or fixing an existing one in a React/Next.js application.

When not to use it

Avoid it when the project relies on another visualization library (D3, Chart.js, visx) or a non-React framework.

Security analysis

Safe
Quality score84/100

The skill is purely instructional documentation containing Recharts/React/Next.js code samples. Its declared tools are limited to Read, Edit, Write, Grep, and Glob — no shell, network, or credential access. Nothing instructs destructive commands, exfiltration, obfuscation, or disabling safeguards; the only external reference is a doc lookup pointer (Context7), which carries no execution risk.

No concerns found

How this analysis is made

Examples

Add a COE multi-line chart
Add a Recharts multi-line chart showing COE prices for Cat A, B, C and E across bidding numbers, using our CSS chart variables for the line colors and a tooltip that formats prices with toLocaleString.
Fix a chart that won't render
My ResponsiveContainer chart renders blank — review the component and fix the parent height issue, and make sure it doesn't break during SSR.
Lazy load and memoize a pie chart
Refactor the market share pie chart to lazy load with next/dynamic (ssr: false) and memoize the transformed data with useMemo.

name: chart-implementation description: Create interactive charts for car registration and COE data visualization using Recharts. Use when adding new chart types, fixing chart bugs, or implementing data visualizations. allowed-tools: Read, Edit, Write, Grep, Glob

Chart Implementation Skill

Uses Recharts for data visualization. Always use CSS variables for colors (see design-language-system skill).

Common Chart Types

Line Chart

"use client";

import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts";

export function TrendChart({ data }: { data: { month: string; value: number }[] }) {
  return (
    <ResponsiveContainer width="100%" height={400}>
      <LineChart data={data}>
        <CartesianGrid strokeDasharray="3 3" />
        <XAxis dataKey="month" />
        <YAxis />
        <Tooltip />
        <Line type="monotone" dataKey="value" stroke="var(--chart-1)" strokeWidth={2} />
      </LineChart>
    </ResponsiveContainer>
  );
}

Bar Chart

import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts";

export function TopMakesChart({ data }: { data: { make: string; count: number }[] }) {
  return (
    <ResponsiveContainer width="100%" height={400}>
      <BarChart data={data}>
        <CartesianGrid strokeDasharray="3 3" />
        <XAxis dataKey="make" />
        <YAxis />
        <Tooltip />
        <Bar dataKey="count" fill="var(--chart-1)" radius={[8, 8, 0, 0]} />
      </BarChart>
    </ResponsiveContainer>
  );
}

Multi-Line Chart (COE Categories)

export function COETrends({ data }: { data: any[] }) {
  return (
    <ResponsiveContainer width="100%" height={400}>
      <LineChart data={data}>
        <CartesianGrid strokeDasharray="3 3" />
        <XAxis dataKey="biddingNo" />
        <YAxis />
        <Tooltip formatter={(value) => `$${Number(value).toLocaleString()}`} />
        <Line dataKey="catA" stroke="var(--chart-1)" name="Cat A" />
        <Line dataKey="catB" stroke="var(--chart-2)" name="Cat B" />
        <Line dataKey="catC" stroke="var(--chart-3)" name="Cat C" />
        <Line dataKey="catE" stroke="var(--chart-4)" name="Cat E" />
      </LineChart>
    </ResponsiveContainer>
  );
}

Pie Chart

import { PieChart, Pie, Cell, Tooltip, ResponsiveContainer } from "recharts";

export function MarketShareChart({ data }: { data: { name: string; value: number }[] }) {
  return (
    <ResponsiveContainer width="100%" height={400}>
      <PieChart>
        <Pie data={data} dataKey="value" cx="50%" cy="50%" outerRadius={120}>
          {data.map((entry, index) => (
            <Cell key={entry.name} fill={`var(--chart-${index + 1})`} />
          ))}
        </Pie>
        <Tooltip />
      </PieChart>
    </ResponsiveContainer>
  );
}

Custom Tooltip

import { TooltipProps } from "recharts";

function CustomTooltip({ active, payload, label }: TooltipProps<number, string>) {
  if (!active || !payload?.length) return null;
  return (
    <div className="bg-white p-4 rounded-lg shadow-lg border">
      <p className="font-semibold">{label}</p>
      {payload.map((entry, i) => (
        <p key={i} style={{ color: entry.color }}>{entry.name}: {entry.value?.toLocaleString()}</p>
      ))}
    </div>
  );
}

Performance

Lazy Load Charts

import dynamic from "next/dynamic";

const Chart = dynamic(() => import("./chart"), {
  ssr: false,
  loading: () => <div>Loading chart...</div>,
});

Memoize Data

const chartData = useMemo(() => transformData(rawData), [rawData]);

Common Issues

Chart Not Rendering

Ensure parent has explicit height:

// ❌ Wrong
<ResponsiveContainer width="100%" height={400}>

// ✅ Correct - parent with height
<div className="h-[400px]">
  <ResponsiveContainer width="100%" height="100%">

SSR Errors

Use dynamic import with ssr: false:

const Chart = dynamic(() => import("./chart"), { ssr: false });

Best Practices

  1. ResponsiveContainer - Always wrap charts
  2. CSS Variables - Use var(--chart-N) for colors
  3. Lazy Load - Dynamic import with ssr: false
  4. Memoize - Use useMemo for data transformations
  5. Tooltips - Provide formatted, detailed tooltips
  6. Mobile - Test on small screens

References

  • Recharts: Use Context7 for latest docs
  • Design Language System: See design-language-system skill for colors

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/interactive-chart-implementation-mmbizjpk' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/interactive-chart-implementation-mmbizjpk/download' --output '.skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md.part' && mv '.skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md.part' '.skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Edit, Write, Grep, Glob

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md' && test -s '.skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/chart-implementation' && cp -R '.skill-downloads/interactive-chart-implementation-mmbizjpk' '.claude/skills/chart-implementation'

Cursor
test -f '.skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md' && test -s '.skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/chart-implementation' && cp -R '.skill-downloads/interactive-chart-implementation-mmbizjpk' '.cursor/skills/chart-implementation'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/interactive-chart-implementation-mmbizjpk'

openskills read 'interactive-chart-implementation-mmbizjpk'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/interactive-chart-implementation-mmbizjpk/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills