TrademarkTrademark
Docs
Ctrl k
Search docs...
Data

LineChart

Updated: October 18, 2026
View on GitHub
Soon
Not released yet. This is on main and is not in any published version yet. It will not install today.

LineChart draws a line for each series across the rows of data, with the area under it filled. It sits on a bordered card with an optional title and description, a legend and axis labels, and draws with react-native-svg. It takes the same data and series as the web LineChart. Tap a row to see its values.

Data and series

Each row of data is an object. The x value is the first key that is not a series, here date. Each entry in series names a key that holds a number and gives it a color. A color can be a data color ("blue", "emerald" and the other schemes), any theme color token, or a raw #hex value. If you leave out color, the series gets a distinct scheme, as on the web. Rows without a number for a series are skipped, and the line joins their neighbours.

Curve

curve sets how the line runs between points. It takes the names of d3's curves: natural (the default), monotone, linear, step, stepBefore, stepAfter, bump and basis. monotone never overshoots the data, which suits values that can't go below zero.

Variant

variant fills the area under the line with a fading gradient (the default), a solid flat color or nothing (outline). data-viz-style="sequential" draws every series in shades of the brand color, and divergent uses core's diverging palette.

Dates

date.start and date.end keep only the rows between them. date.format writes date x values, given as a Date or an ISO string, with the common date-fns tokens: yyyy, yy, MMMM, MMM, MM, M, dd, d, EEEE, EEE, HH and mm.

Numeric x axis

By default the rows are spread evenly, the first on the left edge and the last on the right. Set xAxisType="number" to place each row by its x value instead, over xDomain or the values' range.

Tooltip

Tap a row to show a line through it, a dot on each series and a tooltip with the values. Tap the same row again to hide it, or another row to move it. tooltip={false} turns tapping off. Screen readers read each row as a button labelled with its values.

Loading, empty and error states

loading shows a spinner instead of the plot. With no rows, the chart shows emptyState, and with error it shows errorState. Both take a string or your own element.

Size

The chart fills its parent's width, measured with onLayout, so the plot redraws when the screen rotates. The card is 24 rem tall by default. Set height (a number of rem, a spacing token or a percentage, as on Flex) to change it. The header and legend take their own height and the plot takes the rest.

Differences from the web

  • Tapping a row shows the tooltip and the dots, instead of hovering.
  • The legend sits above or below the plot, instead of over it.
  • There is no date range picker. date.selector, presets, dual, min, max and onChange are not taken, and date.format knows the tokens listed above.
  • There is no DataThemeProvider. variant is a prop (gradient by default), and data-viz-style sets the color mode per chart.
  • The chart doesn't animate in, so animation, animationBegin, animationDuration and animationEasing are not taken.
  • reverseX and reverseY are not taken. The x labels are always below and the y labels on the left.
  • The *Closed, *Open and *Y curves draw as their plain form (basisClosed as basis, monotoneY as monotone).
  • Rows without a value are joined over, instead of leaving a gap.
  • The y labels take only the width they need, instead of a fixed 64px column. When x labels would overlap, only every second (or third, and so on) label is shown.
  • Without series, only the keys that hold numbers become series.

API reference

Prop
Type
Default
Description
dataDataPoint[]The rows. Each is an object with an x value and a number per series.
seriesSeriesConfig | SeriesConfig[]The keys to draw, each { key, color? }.
titleReactNodeThe heading above the plot.
descriptionReactNodeA line under the title.
curveCurveType"natural"How the line runs between points.
variant"gradient" | "flat" | "outline""gradient"How the area under the line is filled.
axis"x" | "y" | "both" | "none""both"Which axes show labels.
grid"x" | "y" | "both" | "none""both"Which grid lines to draw.
legend{ display?, position?, direction? }{ display: true, position: "top-left" }The legend's visibility, place and direction.
tooltipbooleantrueTap a row to show its values.
xAxisType"category" | "number""category"Spread rows evenly, or place them by their x value.
xDomain[number, number]The x range for xAxisType="number".
date{ start?, end?, format? }Filters date rows and formats date labels.
loadingbooleanfalseShows a spinner instead of the plot.
errorbooleanfalseShows errorState instead of the plot.
emptyStateReactNode"No data available for the selected period"Shown when there are no rows.
errorStateReactNode"An error occurred while fetching data"Shown when error is set.
data-viz-style"categorical" | "divergent" | "sequential""categorical"The color mode. sequential draws in brand shades.
heightnumber | SpacingToken | "50%"24The card's height, in rem as on Flex.
...Flex propsFlexPropsMargin, border, radius and the other Flex props.
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club