Line chart
Draws values over time as lines, with units, a legend, and an alternative table.
Preview
Local preview. It doesn't affect real accounts, environments, or run data.
Compare the same example at each size and density. Switching keeps input values and selection state. Size guidance and comparisons
Six sample days. Workspace rises from 12 to 27 runs. Inventory has no measurement on October 3, so the chart leaves a gap there.
Pipeline run count (runs)
Reporting day
Focus the chart and use Left/Right to inspect points. Escape clears details. The data table includes every series.
View data table
All series are visible.
Usage
Draw values that change along time or another order as lines, such as a temperature, a latency, a price or a portfolio against its benchmark. A line says its slope, so it also reads values far from zero: set includeZero={false} and the line takes the height. Always provide a title, a factual summary, and axis names with units. Series default to brand and neutral lines, told apart by dashes and markers; pass palette="categorical" when color must separate categories, such as buckets, or palette="extended" for a chart with more series than twelve, which adds a second dozen hues, the same twelve a step along the ramp; dashes={false} draws every line solid and leaves the markers to tell the series apart. For monitoring, xScale="time" places rows by data[].time, ticks on round times and breaks a line where sampling stops, or past breakAfter, such as 4 days for closes on trading days; references draw thresholds and target bands, and mark events and periods on the x axis; a comparison series, such as a benchmark, draws quieter, and difference shades the lead between two lines; curve="step" holds values sampled on change; yScale="log" spans orders of magnitude. In a dashboard card, density="compact" keeps the plot, legend and floating values; for a trend on a card, minimal leaves the marks alone and extremes labels the period's high and low. Pass data as an immutable array that the caller owns.
- Don't mix units on one axis. Use separate charts instead.
- Don't draw parts of a whole as lines, such as tokens by kind. Use AreaChart or BarChart with stacked, which shows their total.
- Don't plot one measure against another here. Use ScatterChart, one point per item.
- Don't put more than seven series on one chart where you can choose: keep the largest, sum the rest as Other, or split the chart. A monitoring view that must compare more, such as tokens per project, keeps every line on the plot, takes the twelve categorical colors, or the twenty-four of palette="extended" when there are more than twelve, and folds the legend with legendLimit.
- Don't turn dashes off to unclutter a crowded plot: past 40 points the plot already drops its markers to do that, and a chart drawn solid keeps them, which adds ink. Turn them off for a line style; split the chart when the plot is crowded.
- Don't replace missing values with 0. Pass null instead: the chart treats null, undefined, NaN, and Infinity as missing and doesn't connect lines across them.
- Don't expect a second value axis. Put a second unit on a second chart, and values orders of magnitude apart on yScale="log".
- Don't expect smoothed curves. Lines are linear or steps, so the chart doesn't invent extremes that weren't measured.
- Don't expect the chart to show loading, error, or retry states. Build them in the product screen.
- Don't expect the description prop to be an automatically inferred analysis. It holds the caller's factual summary.
Size: SizeProvider size="small" resizes the whole composition, including portals. The default size is Default. Size guidance and comparisons
Anatomy
figure → figcaption(title + summary) + legend toggle buttons + named axes + responsive Recharts ComposedChart + persistent inline value readout + details → Table.Container → full data table
Keyboard and accessibility
- Tab reaches the legend buttons, the chart, and the data table toggle.
- With the chart focused, Left and Right move between data points.
- Enter or Space on a legend button shows or hides its series, and aria-pressed reports whether it's shown. Hidden series stay in the data table.
- View data table is a native details element that Enter or Space expands. Long tables scroll on both axes. Each series header names the unit once, and the cells hold full values aligned at the end.
- Escape clears the details, and an arrow key shows them again.
- Pointer, touch and the arrow keys show the point's values in a box beside it, which turns to whichever side has more room and stays inside the plot. The same values fill the details region below the plot, a polite live region that never covers the marks; the box itself stays out of the accessibility tree.
- Circle, square, and triangle markers and line patterns tell series apart beyond color. They remain in high contrast mode.
- With dashes off the markers carry that difference alone, so a chart drawn solid keeps its markers even past 40 points, where a chart drawn with dashes drops them.
- Above 40 points, the plot omits markers to reduce overlap. Legend markers, line patterns, details, and the table remain.
- Animation is off by default.
- While the chart's room keeps changing, as while a sidebar slides or a window edge is dragged, the plot holds the width it was drawn at, clipped to the chart, and redraws once the room settles. A single change of room draws at once.
- Test real assistive technology usability separately after product integration.
Give each control a name that describes its purpose. Connect error messages to their controls, and signal state with more than color. Automated checks don't replace manual keyboard and assistive technology testing.
Example code
Shared components take their styles from design tokens. Each example sets its own composition and accessibility attributes. The calling screen defines callbacks, refs, and product data.
Key API
The table lists the common wrapper's main props. See the package type declarations for the full types.