Line charts
Every line chart from shadcn's gallery in Material 3 Expressive: 3px round lines, a big readout that follows the point in focus, a ring and a line to mark it, and the value axis on the right with a reference value called out. The demos follow an E. coli culture. Hover to preview, click or tap to select, or tab to a chart and use the arrow keys.
Default, Linear and Step
The three curve types. Default is monotone: smooth, and never overshoots a point. Linear joins the points with straight segments, Step holds each value until the next. The readout gives the fold change since the previous reading.
Line Chart
E. coli growth, OD600 every two hours. The dotted line is OD600 0.6, where you would induce.
Line Chart - Linear
Straight segments between readings.
Line Chart - Step
Each reading holds until the next.
Multiple
With two series a readout cannot say everything, so the inverse tooltip stays. It replaces the gray cursor with the focus line and a ring on each series.
Line Chart - Multiple
Wild type and a slow-growing mutant, OD600 every two hours. Illustrative.
Dots, Custom Dots and Dots Colors
Dots are ringed in the card surface. Custom dots can be any shape: here the induction point is a scalloped cookie with a bolt. Dots Colors takes each dot's color from a band in the config, here the growth phase, and the legend names the bands.
Line Chart - Dots
Every reading marked with a ringed dot.
Line Chart - Custom Dots
The reading where you would induce wears a scalloped bolt.
Line Chart - Dots Colors
Each reading takes the color of its growth phase.
Label and Custom Label
Value labels are small pills above their points, inverse for values and tonal for names, never bare floating numbers.
Line Chart - Label
E. coli growth, with each OD600 reading on its point.
Line Chart - Custom Label
E. coli doubling time on each carbon source, each point named in a chip. Illustrative.
Interactive
The series switcher shows each series' total for the period; the connected toggle changes the period. The readout, the dotted average and the focus all follow the choice.
Line Chart - Interactive
Samples received by a sequencing core each day, DNA and RNA. Pick a series and a period; the chart follows.
Usage
const focus = useChartFocus({ count: data.length, describe: (i) => `${data[i].hour}: OD600 ${data[i].od}` })<ChartContainer config={config} focus={focus} aria-label="E. coli growth curve, OD600 every two hours"> <LineChart data={data} {...focus.chartProps}> <XAxis dataKey="hour" tickLine={false} axisLine={false} /> <YAxis orientation="right" tickLine={false} axisLine={false} tick={chartTicks()} /> <ChartTooltip cursor={false} content={() => null} /> <Line {...chartLine("od")} dot={chartCookieDot("od", { when: (d) => d.induced })} /> <ReferenceLine x={data[focus.index].hour} {...chartFocusLine} /> </LineChart></ChartContainer>Line helpers
| Prop | Type | Default | Notes |
|---|---|---|---|
chartLine(key) | props | 3px round line, monotone, no resting dots. Override type for linear or step | |
chartColorDot(colorOf, { r }) | Line dot | A dot whose color comes from the data point, ringed in the surface | |
chartCookieDot(key, { when, glyph, r }) | Line dot | Points where when is true become a scalloped cookie with an optional SVG path glyph; the rest a small dot | |
chartPillLabel(key, { text, tone, offset }) | LabelList content | A value or name as a pill above its point: inverse or tonal | |
chartCookiePath(cx, cy, r) | string | The scalloped cookie outline as an SVG path |