Chart
Beautiful data visualizations built on Apache ECharts. Declarative, theme-aware, and composable.
NeoUI Charts provide 8 chart types through a Recharts-inspired declarative API rendered via Apache ECharts SVG. Charts automatically pick up your theme's CSS variables — including dark mode — with no extra configuration required.
Component Model
Charts use a four-layer declarative composition. You pick only the layers you need.
Chart Root — BarChart, LineChart, AreaChart, PieChart, ScatterChart, RadarChart, RadialBarChart, ComposedChart
Primitives — Grid, XAxis, YAxis, ChartTooltip, Legend, RadarGrid, PolarGrid, CenterLabel
Series — Bar, Line, Area, Pie, Scatter, Radar, RadialBar
Fill / Paint — Fill, LinearGradient, Stop
Your First Chart
1. Define your data
Data can be any IEnumerable<T>.
Use the DataKey parameter on series components to map properties.
2. Build your chart
Wrap a ChartContainer around your chart root and pass
Data.
Setting a Height is required for responsive sizing.
3. Add a grid
Add <Grid> inside the chart root.
Use Vertical="false" for horizontal-only lines, matching the shadcn/ui chart style.
4. Add an axis
Add <XAxis DataKey="month"> to label the category axis.
Nest <AxisLabel> to style the tick labels independently.
5. Add a tooltip
Add <ChartTooltip> to show values on hover.
Hover over the chart below to see it in action.
6. Add a legend
Add <Legend> to identify series.
Labels come from the Name parameter on each series component.
Your first chart is complete!
Theming
Charts read color tokens directly from your CSS theme. Dark mode and theme switching work automatically.
Use Color="var(--chart-N)" on any series component.
Five semantic chart tokens are predefined in the component library's base theme and adapt to light/dark mode.
var(--chart-1)var(--chart-2)var(--chart-3)var(--chart-4)var(--chart-5)Color="#2563eb",
Color="hsl(220 98% 61%)", or
Color="oklch(0.65 0.22 41)".
Tooltip
| Prop | Type | Default | Description |
|---|---|---|---|
| Show | bool | true | Whether the tooltip is enabled. |
| Mode | TooltipMode | Item | Trigger mode: Item (hover series) or Axis (hover axis line). |
| Cursor | TooltipCursor | Default | Cursor indicator style: Default, Line, Cross, Shadow, or None. |
| Formatter | string? | null | Optional JavaScript function string for custom tooltip content. |
| Class | string? | null | Additional CSS classes on the tooltip container. |
Legend
| Prop | Type | Default | Description |
|---|---|---|---|
| Show | bool | true | Whether the legend is rendered. |
| TextColor | string? | null | CSS color for legend label text. Recommended: var(--foreground). |
| Align | LegendAlign | Center | Horizontal alignment: Left, Center, Right. |
| VerticalAlign | LegendVerticalAlign | Bottom | Vertical position: Top, Middle, Bottom. |
| Class | string? | null | Additional CSS classes. |
ChartContainer
Required wrapper around every chart root. Sets height and provides responsive sizing.
| Prop | Type | Default | Description |
|---|---|---|---|
| Height | int | 300 | Fixed pixel height of the chart area. |
| Class | string? | null | Additional CSS classes merged onto the container div. |
| ChildContent | RenderFragment | — | The chart root component (e.g. BarChart, LineChart). |