Line Chart

The LineChart component renders trends across labeled data points with optional grid and point markers.

Usage & Examples

Response Trend

Response trend
Jan: 24Feb: 38Mar: 31Apr: 47470
response-trend.tsx
const chartData = [
  { label: "Jan", value: 24, color: "#2f80ed" },
  { label: "Feb", value: 38, color: "#27ae60" },
  { label: "Mar", value: 31, color: "#f2994a" },
  { label: "Apr", value: 47, color: "#9b51e0" },
];
<LineChart data={chartData} label="Response trend" />

Props API

17 props
Columns
Line Chart props API
Default
Description
aria-labelstringNoariaAccessible label for the chart graphic.
classNamestringNostylingAdditional class name for the root.
colorstringNoprops"currentColor"Stroke color for the line.
dataChartDatum[]YespropsLabelled values rendered as a line chart.
data-testidstringNotestingBackward-compatible alias for test ID attributes.
heightnumberNoprops200Height of the SVG viewport.
labelReactNodeNopropsVisible chart label.
loadingbooleanNopropsfalseWhether the component should display a loading state.
paddingnumberNoprops24Inner SVG padding.
showGridbooleanNopropstrueWhether to render guide lines.
showPointsbooleanNopropstrueWhether to render point markers.
stateStateTypeNostylingVisual state class used for styling.