Add a chart (line, bar, area, pie, or scatter) to a dataset's showcase in a PortalJS portal. Installs recharts, writes a reusable Chart component, and renders it in the showcase Views section. Use when visualizing a dataset already registered in datasets.json.
Getting started
Full instructionsInstall the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.
Instructions: SKILL.mdv1.0.1
PortalJS — Add Chart
Overview
Add a visualization to a dataset's showcase in a PortalJS portal. The skill installs
recharts (added directly — never @portaljs/components), writes a reusable client-side
Chart component into components/, and renders a <Chart /> into the Views section
of the showcase route pages/[owner]/[slug].tsx for one chosen dataset. The chart reads the
same /public/data/<file> the showcase <Table /> already uses, so no data is duplicated.
Five chart types are supported: line, bar, area, pie, and scatter.
Prerequisites
- A scaffolded PortalJS portal (see
portaljs-new-portal). - The target dataset already registered in
datasets.json(seeportaljs-add-dataset). components/ui/parseCsv.tspresent (ships with the template).- Node 18+ and npm available in the portal directory.
Instructions
The canonical, full step-by-step workflow is
.claude/commands/portaljs-add-chart.md —
the single source of truth. Read and follow it when executing. Summary:
- Gather input — dataset slug, X column, Y column(s), chart type (default
line), portal
directory. If any is missing, interview the user; never dead-end on a missing value. - Resolve the dataset from
datasets.json(namespace,file,format). - Validate that the X and every Y column exist in the data file's header; warn on
non-numeric Y columns (values are coerced withNumber()). - Install the chart library:
npm install recharts@^2.15.0. - Write
components/Chart.tsx(idempotent — do not overwrite a customized component). - Render
<Chart />into the Views section, gated on the dataset's(namespace, slug)so
other showcases are unaffected. Extend an existing view-dispatch block, do not overwrite. - Verify with
npx tsc --noEmit. - Report the component, route, and dependency added.
Output
- Created:
components/Chart.tsx(recharts wrapper, if absent). - Modified:
pages/[owner]/[slug].tsx(import + gated<Chart />in Views);
package.json(recharts@^2.15.0). - UI strings: any text it adds to JSX renders through
t()(lib/i18n.ts), with the
keys added tolocales/en.jsonand every otherlocales/*.json;npm run i18n:check
passes. - Verified:
npx tsc --noEmitpasses. - Result: the chart renders at
/@<namespace>/<slug>under a "Views" heading.
Error Handling
| Symptom | Cause | Fix |
|---|---|---|
| Missing dataset/columns | Slug or column not in manifest/header | List available slugs/headers and re-prompt; do not error out. |
| Gaps in the chart | Non-numeric cells coerced to NaN |
Clean the source data or pick a numeric Y column. |
tsc failure |
Bad column prop or import path | Fix the first reported error before reporting success. |
| Sluggish render | Over ~2,000 SVG points | Pre-aggregate the series (e.g. yearly buckets). |
Examples
Example 1 — Single line series
/portaljs-add-chart co2-emissions x=year y=emissions type=line
Example 2 — Multi-series bar chart
/portaljs-add-chart trade x=year y=imports,exports type=bar
Example 3 — Pie chart of a categorical breakdown
/portaljs-add-chart budget x=department y=amount type=pie
Resources
- Full workflow:
.claude/commands/portaljs-add-chart.md - Chart-type and prop reference:
references/reference.md - Related skills:
portaljs-add-dataset,portaljs-add-map,portaljs-define-schema - recharts documentation: https://recharts.org/
Explore more skills
Browse all- Portaljs MigrateMigrate (harvest) datasets between open-data platforms. Reads CKAN, a DCAT-US /data.json catalog (DKAN, ArcGIS Hub,…
- Portaljs New PortalScaffold a new PortalJS data portal from a brief. Copies the canonical template from examples/portaljs-catalog and…
- Portaljs Check Data QualityAudit a local or remote tabular file (CSV/TSV) for common data quality issues — schema, nulls, types, duplicates.…
- Portaljs ArchitectRecommend a data-portal architecture (storage, compute, catalog, access, hosting, metadata) from stated needs, then…
- Portaljs Connect CkanWire a scaffolded PortalJS portal to a CKAN backend over its API. Generates a tiny server-side fetch client (no runtime…
- Portaljs Define SchemaDefine a dataset's metadata profile — infer a Frictionless Table Schema from its data, add Data Package metadata…
Security
Reviews (0)
More from portaljs
View source →Frequently asked questions about portaljs-add-chart
What does the portaljs-add-chart skill do?
Add a chart (line, bar, area, pie, or scatter) to a dataset's showcase in a PortalJS portal. Installs recharts, writes a reusable Chart component, and renders it in the showcase Views section. Use when visualizing a dataset already registered in datasets.json. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the portaljs-add-chart skill?
Run `npx @skills-hub-ai/cli install portaljs-add-chart` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/portaljs-add-chart/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does portaljs-add-chart work with?
portaljs-add-chart runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the portaljs-add-chart skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use portaljs-add-chart after installing it?
In Claude Code, type `/portaljs-add-chart` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the portaljs-add-chart skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.
Badge for your README
Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.
[](https://skills-hub.ai/skills/portaljs-add-chart)<a href="https://skills-hub.ai/skills/portaljs-add-chart"><img src="https://skills-hub.ai/api/badges/skill/portaljs-add-chart" alt="Install on Skills Hub"></a>More options in the badge docs.