Radar charts in pure CSS: porting st-core spider charts into ProvChart

Radar charts in pure CSS: porting st-core spider charts into ProvChart

●1 ●25 ●62
calendar_today ago • schedule3 min read
— Originally published at dev.to

Spider (radar) charts are the one chart type I kept getting asked for and kept skipping. The usual answer is a chart library, which is exactly the thing ProvChart exists to avoid.

But I already had. st-core.fscss has spider charts built in pure CSS, so this release is that idea, adapted to ProvChart's pipeline: JSON in, HTML/CSS or SVG out, no chart library on the page.

A two-series radar chart on a dark theme

What shipped

  • type: "radar" (alias spider) in the HTML/CSS engine, the SVG engine, and both API endpoints
  • Radar in the Pro Dashboard (Chart Builder and SVG Export tabs)
  • radar and gridShape in the MCP server (provchart-mcp 1.1.0)
  • Per-vertex tooltips in provchart-runtime 1.2.1

Using it

One value per axis, at least three axes. axisX names the axes.

{
  "type": "radar",
  "theme": "midnight",
  "axisX": ["Speed", "Quality", "UX", "Scale", "Cost", "Support"],
  "series": [
    { "name": "Team A", "color": "#8b7bff", "points": [92, 78, 85, 55, 48, 80] },
    { "name": "Team B", "color": "#4fd8c4", "points": [68, 82, 70, 95, 62, 58] }
  ]
}

For a README, ask for SVG and commit the file:

curl -s -X POST "https://provchart-api.devtem.org/api/v1/generate-svg" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"type":"radar","width":420,"height":420,"axisX":["A","B","C","D","E"],"series":[{"name":"S","points":[60,80,40,90,70]}]}'

For a web page, call /api/v1/generate from your server and inject the returned html and css.

Option What it does
gridShape circle (default) or polygon rings
grid: { rows: 5 } Number of rings (default 4)
axisY: false Hide the ring values
min / max Fix the scale

If you leave max out, the outer ring rounds up to a clean step. A data peak of 92 gives rings at 25, 50, 75 and 100 instead of 23, 46, 69 and 92.

ProvChart polygon shape radar chart

How the CSS version works

The browser never does trig. I compute every vertex at generation time and write it into CSS custom properties as plain percentages:

x = 50% + r * sin(angle)
y = 50% - r * cos(angle)

Axis 0 points up and the rest run clockwise. The fill is a clip-path: polygon() that reads those variables, so updating a chart is just rewriting variables, same as the line and area charts.

The part I liked most is the outline. There is no stroke in clip-path, so the line is the same polygon minus a copy of itself nudged toward the center by 2px, using the evenodd fill rule:

clip-path: polygon(evenodd, /* outer vertices */, /* inner vertices */);

The spokes are plain 1px lines rotated into place, so they always sit exactly on the axes. The circle grid is a radial-gradient with closest-side sizing, so ring radii match the data scale.

Things to know

  • A series needs at least 3 points, otherwise the API returns a 400 with the reason.
  • The HTML/CSS version uses modern CSS (color-mix(), aspect-ratio, evenodd clip paths). The SVG output works anywhere.
  • Radar is a Pro chart type.
  • The optional runtime adds hover tooltips on each vertex (axis name, series, real value). Painting never depends on it.

If a radar renders oddly with your data, open an issue and include the payload. That is the fastest way for me to fix it.

Want more #webdev & #opensource deep dives?

Join 6,011+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

Tailwind CSS for Beginners: From Zero to Your First Component

muhammadfarhan.dev - Jul 21

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

Finally Shipped st-core.fscss v2 — CSS Charts Without the 8-Point Ceiling

Figsh - Sep 18
chevron_left
1.8k Points • 88 Badges
28Posts
18Comments
14Connections
A full-stack web developer: Building smart solutions, designing meaningful experiences, and continuo... Show more

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!