Portaljs add chart

From jeremylongshore/tons-of-skills-marketplace · View interactive version

Portaljs add chart is an AI agent skill from the GitHub repository jeremylongshore/tons-of-skills-marketplace. 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.

How to use this skill

Skill file

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

Instructions

The canonical, full step-by-step workflow is

CODE0 —

the single source of truth. Read and follow it when executing. Summary:

  1. 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.

  1. Resolve the dataset from datasets.json (namespace, file, format).
  2. Validate that the X and every Y column exist in the data file's header; warn on

non-numeric Y columns (values are coerced with Number()).

  1. Install the chart library: npm install recharts@^2.15.0.
  2. Write components/Chart.tsx (idempotent — do not overwrite a customized component).
  3. 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.

  1. Verify with npx tsc --noEmit.
  2. Report the component, route, and dependency added.

Output

package.json (recharts@^2.15.0).

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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.