Charts
LineChart
Several series compared over a continuous axis.
When to reach for it
Examples
default
| month | Desktop | Mobile |
|---|---|---|
| Jan | 186 | 80 |
| Feb | 305 | 200 |
| Mar | 237 | 120 |
| Apr | 273 | 190 |
| May | 209 | 130 |
| Jun | 314 | 240 |
stroke dot curve
| Desktop |
|---|
| 186 |
| 305 |
| 237 |
| 273 |
| 209 |
| 314 |
legend variants
| Desktop | Mobile |
|---|---|
| 186 | 80 |
| 305 | 200 |
| 237 | 120 |
| 273 | 190 |
backgrounds
| Desktop |
|---|
| 186 |
| 305 |
| 237 |
| 273 |
| 209 |
| 314 |
emphasis
| Desktop | Mobile |
|---|---|
| 186 | 80 |
| 305 | 200 |
| 237 | 120 |
| 273 | 190 |
| 209 | 130 |
| 314 | 240 |
| Desktop | Mobile |
|---|---|
| 186 | 80 |
| 305 | 200 |
| 237 | 120 |
| 273 | 190 |
| 209 | 130 |
| 314 | 240 |
brush
| day | Desktop | Mobile |
|---|---|---|
| D1 | 160 | 140 |
| D2 | 177 | 139 |
| D3 | 194 | 136 |
| D4 | 208 | 131 |
| D5 | 219 | 125 |
| D6 | 226 | 117 |
| D7 | 230 | 108 |
| D8 | 229 | 98 |
| D9 | 224 | 89 |
| D10 | 214 | 79 |
| D11 | 202 | 69 |
| D12 | 187 | 61 |
| D13 | 170 | 53 |
| D14 | 152 | 47 |
| D15 | 135 | 43 |
| D16 | 120 | 41 |
| D17 | 107 | 40 |
| D18 | 97 | 42 |
| D19 | 92 | 45 |
| D20 | 90 | 50 |
| D21 | 93 | 57 |
| D22 | 100 | 65 |
| D23 | 111 | 75 |
| D24 | 124 | 84 |
| D25 | 140 | 94 |
| D26 | 158 | 104 |
| D27 | 175 | 113 |
| D28 | 192 | 122 |
| D29 | 206 | 129 |
| D30 | 218 | 134 |
| D31 | 226 | 138 |
| D32 | 230 | 140 |
| D33 | 229 | 140 |
| D34 | 225 | 138 |
| D35 | 216 | 133 |
| D36 | 204 | 128 |
| D37 | 189 | 120 |
| D38 | 172 | 112 |
| D39 | 155 | 103 |
| D40 | 138 | 93 |
loading
axis labels and format
| p95 latency |
|---|
| 1.42 |
| 1.61 |
| 2.04 |
| 1.88 |
| 1.34 |
| Ad spend |
|---|
| 4,210 |
| 5,180 |
| 4,890 |
| 6,320 |
| 7,010 |
sonify
| week | p95 latency | p50 latency |
|---|---|---|
| W1 | 142 | 61 |
| W2 | 161 | 64 |
| W3 | 204 | 66 |
| W4 | 188 | 63 |
| W5 | 134 | 58 |
| W6 | 129 | 57 |
toolbar
Arrow keys pan by one point, Page Up and Page Down by a screenful, Home and End jump to the ends. Plus and minus zoom, zero resets. Ctrl and the wheel zoom around the pointer, and dragging across the plot zooms to that span.
Showing D1 to D90, 90 of 90 points
| day | Desktop | Mobile |
|---|---|---|
| D1 | 160 | 140 |
| D2 | 172 | 140 |
| D3 | 183 | 139 |
| D4 | 194 | 137 |
| D5 | 203 | 135 |
| D6 | 212 | 132 |
| D7 | 219 | 129 |
| D8 | 224 | 126 |
| D9 | 228 | 122 |
| D10 | 230 | 117 |
| D11 | 230 | 112 |
| D12 | 228 | 107 |
| D13 | 224 | 102 |
| D14 | 218 | 96 |
| D15 | 211 | 91 |
| D16 | 202 | 85 |
| D17 | 192 | 80 |
| D18 | 181 | 74 |
| D19 | 170 | 69 |
| D20 | 158 | 64 |
| D21 | 147 | 60 |
| D22 | 135 | 55 |
| D23 | 125 | 52 |
| D24 | 115 | 48 |
| D25 | 107 | 46 |
| D26 | 100 | 43 |
| D27 | 95 | 42 |
| D28 | 92 | 41 |
| D29 | 90 | 40 |
| D30 | 91 | 40 |
| D31 | 93 | 41 |
| D32 | 97 | 42 |
| D33 | 103 | 44 |
| D34 | 111 | 47 |
| D35 | 120 | 50 |
| D36 | 130 | 53 |
| D37 | 140 | 57 |
| D38 | 152 | 62 |
| D39 | 164 | 66 |
| D40 | 175 | 71 |
| D41 | 186 | 77 |
| D42 | 197 | 82 |
| D43 | 206 | 88 |
| D44 | 214 | 93 |
| D45 | 221 | 99 |
| D46 | 226 | 104 |
| D47 | 229 | 109 |
| D48 | 230 | 114 |
| D49 | 229 | 119 |
| D50 | 227 | 123 |
| D51 | 222 | 127 |
| D52 | 216 | 131 |
| D53 | 208 | 134 |
| D54 | 199 | 136 |
| D55 | 189 | 138 |
| D56 | 178 | 139 |
| D57 | 166 | 140 |
| D58 | 155 | 140 |
| D59 | 143 | 139 |
| D60 | 132 | 138 |
| D61 | 122 | 136 |
| D62 | 113 | 134 |
| D63 | 105 | 131 |
| D64 | 98 | 128 |
| D65 | 94 | 124 |
| D66 | 91 | 120 |
| D67 | 90 | 115 |
| D68 | 91 | 110 |
| D69 | 94 | 105 |
| D70 | 99 | 99 |
| D71 | 105 | 94 |
| D72 | 113 | 88 |
| D73 | 122 | 83 |
| D74 | 133 | 77 |
| D75 | 144 | 72 |
| D76 | 155 | 67 |
| D77 | 167 | 62 |
| D78 | 178 | 58 |
| D79 | 189 | 54 |
| D80 | 200 | 50 |
| D81 | 209 | 47 |
| D82 | 216 | 44 |
| D83 | 222 | 42 |
| D84 | 227 | 41 |
| D85 | 229 | 40 |
| D86 | 230 | 40 |
| D87 | 229 | 40 |
| D88 | 225 | 41 |
| D89 | 220 | 43 |
| D90 | 214 | 45 |
Notes
Several series compared over a continuous axis — the shape for "which of these is going where".
The difference from <AreaChart> is what the reader is asked to do: an area says "read the magnitude under this", a line says "compare these against each other". Filling four overlapping series makes the second question unanswerable, which is why a line chart has no fill variant to offer.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| childrenrequired | ReactNode | The composed parts — axes, grid, tooltip, legend, and the marks themselves. | |
| configrequired | TConfig & ValidateKeys<TData, TConfig> | — | |
| datarequired | TData[] | The rows the chart draws. One entry per point, bar or category. | |
| titlerequired | string | What the chart shows, in a sentence a reader could act on. Required, and announced to a screen reader even when it is not printed. | |
| animationType | ChartRevealType | 'forward' | — |
| chartProps | ComponentProps<typeof RechartsLineChart> | Escape hatch onto the raw Recharts chart element. | |
| className | string | Merged onto the figure, last, so a call site can size or space it. | |
| curveType | ChartCurveType | 'linear' | How the line between two points is interpolated. Every mark inherits it unless it says otherwise. |
| defaultSelectedDataKey | string | null | null | The series lit on first render. Selection dims every other series. |
| description | ReactNode | A line under the title — the unit, the window, the caveat. | |
| empty | ChartEmptyProps | false | What the chart shows when it has nothing to draw. Rendered instead of the plot whenever `data` is empty and the chart is not loading — the state a real dashboard reaches within a week, and the one an empty pair of axes is indistinguishable from a failed load. `false` keeps the axes, for a chart whose emptiness is itself the reading. | |
| hideDataTable | boolean | false | Drops the hidden table view. Only correct when the page prints the data itself. |
| isLoading | boolean | false | Swaps the marks for an animated skeleton, keeping the measured height so the page does not jump when the data lands. |
| loadingPoints | number | How many points the skeleton draws. | |
| onSelectionChange | (selectedDataKey: string | null) => void | Fires when the selection changes, and with null when it is cleared. | |
| showTitle | boolean | Prints the title above the plot instead of hiding it from sight. | |
| xDataKey | keyof TData & string | The row field on the category axis. Needed by the brush and by the table view. |
Types
export type LineStrokeVariant = AreaStrokeVariantAccessibility
- title is required; the rows are also rendered as a visually hidden table.
- A clickable line gets a 15px transparent line underneath it, because a 1.6px stroke is not a pointer target.
- buffer draws the last segment dashed by measuring the real path length, so a projection is visibly a different kind of fact at any curve type.