Chart API
View componentThe full prop reference for the Chart component. A comprehensive custom SVG chart library with 45+ components — bar, line, area, pie/donut, scatter, bubble, radar, heatmap, treemap, funnel, gauge, candlestick, radial bar, radial line, sankey, waterfall, gantt, boxplot, sunburst, chord, histogram, and more. No external charting dependency.
Import
import { Chart } from '@structyl/styled';Props
Chart.Root
Cartesian chart container. Compose Bar, Line, Area, Scatter and Bubble inside.
| Prop | Type | Default |
|---|---|---|
| data# | Record<string, unknown>[]Array of data objects. | — |
| height# | numberSVG height in pixels. | 300 |
| width# | numberSVG width. Omit for responsive layout. | — |
| margin# | { top, right, bottom, left }Inner margin for axes. | { top:10, right:10, bottom:30, left:40 } |
| accessibilityLabel# | stringSets aria-label on the SVG. | — |
| accessibilityMode# | booleanEnables pattern fills for colorblind accessibility. | false |
Chart.Bar
Vertical (or horizontal) bar series inside Chart.Root.
Chart.Line
Line series inside Chart.Root.
Chart.Area
Filled area series inside Chart.Root. Accepts all Chart.Line props plus fillOpacity and stackId.
| Prop | Type | Default |
|---|---|---|
| dataKey# | stringRequired. Field name in data. | — |
| fillOpacity# | numberFill transparency (0–1). | 0.2 |
| stackId# | stringAreas with the same stackId are stacked. | — |
Chart.Pie / Chart.PieRoot
Pie or donut chart. Wrap Chart.Pie in Chart.PieRoot.
| Prop | Type | Default |
|---|---|---|
| dataKey# | stringRequired. Numeric value field. | — |
| nameKey# | stringLabel field for segments. | — |
| innerRadius# | numberInner radius (> 0 = donut). | 0 |
| padAngle# | numberGap between segments in radians. | — |
| cornerRadius# | numberRounded segment corners. | — |
| colors# | string[]Per-segment color overrides. | — |
Chart.Radar / Chart.RadarRoot
Radar/spider chart. Wrap Chart.Radar(s) in Chart.RadarRoot.
| Prop | Type | Default |
|---|---|---|
| dataKey# | stringRequired. Numeric value field to plot. | — |
| name# | stringDisplay name. | — |
| color# | stringOverride color. | — |
| fillOpacity# | numberFill transparency. | 0.25 |
Chart.Heatmap
Standalone heatmap grid. xKey, yKey and valueKey map data fields to cells.
Chart.Treemap
Standalone treemap using the squarify algorithm. Supports nested children.
Chart.Funnel
Standalone funnel chart rendered top-down.
Chart.Gauge
Standalone half-circle arc gauge.
Chart.Candlestick
Standalone OHLC candlestick chart.
| Prop | Type | Default |
|---|---|---|
| data# | OhlcEntry[]Required. Objects with open, high, low, close. | — |
| width# | numberSVG width. | 600 |
| height# | numberSVG height. | 300 |
| bullColor# | stringColor for bullish (close > open) candles. | hsl(var(--chart-2)) |
| bearColor# | stringColor for bearish (close < open) candles. | hsl(var(--chart-5)) |
Source code
If you didn't find what you need here, read the component implementation .