Native Solid 2 fork of solid-recharts (MIT, © Thomas Guehenneux), derived from Recharts (MIT, © recharts). Adapted documentation; neither project endorses this fork.
Getting started
1. Install the package
Charts is published on npm as 0.1.0-rc.4 (release candidate, dist-tag next): @wsagency/radix2solid-charts@0.1.0-rc.4. The npm latest tag still points to rc.2, so pin the exact version:
Charts requires solid-js and @solidjs/web 2.0.0-rc.15 with the matching @solidjs/signals, @solidjs/compiler and @solidjs/babel-plugin 2.0.0-rc.15, compiled by @solidjs/vite-plugin 3.0.0-next.50. It has no dependency on Themes; install Themes as well if you want the token colors used below. The runnable Charts sandbox is a complete application with exact npm package versions, the RC15 workspace overrides and release-age exceptions for these Solid versions.
The earlier published rc.2 lacks the next-suite Legend, XAxis and Sankey APIs. To try those APIs with the full pinned setup, download and extract the runnable sandbox above, run pnpm install, then pnpm dev. To set up your own application, use the Solid RC15 workspace overrides; Charts itself needs no Primitives override.
2. Render a chart
Wrap a chart in ResponsiveContainer to fill its parent, or give the chart a fixed width and height. Series colors can be any CSS color, including Themes tokens such as var(--accent-9).
The composable model
| Piece | Role |
|---|---|
LineChart, BarChart, … | Chart container: owns layout, scales and interaction state |
Line, Bar, Area, … | A graphical series bound to a dataKey |
XAxis, YAxis | Axes, categorical or numerical, several per chart |
CartesianGrid | Background grid lines |
Tooltip, Legend | Hover information and the series legend |
Components register themselves with the chart context. In the browser you can add, remove or reorder them and the chart redraws. Server rendering is different: with automatic domains or axis sizes, the server HTML does not match the client. For server-rendered Cartesian charts, follow the complete bounded recipe in Server geometry needs explicit axes.
Accessibility
Pass title and desc to name and describe the chart's SVG. accessibilityLayer (on by default for cartesian and polar charts) makes the chart focusable and lets arrow keys move the active tooltip between data points. Charts are images of data: when the numbers matter, also provide them as text or a table.