The LineChart
component renders a single continuous line across discrete labeled points. It is useful for visualizing simple trends or progressions where each data point is mapped to a category or label.
It shares the same API as BarChart
and is ideal for basic one-line comparisons over labeled axes.
This example visualizes the count of different toy shapes (Cube
, Sphere
, Pyramid
) using a single line. The user can toggle between horizontal and vertical layouts using labelOnYAxis
.
labelOnYAxis?: boolean
true
, category labels are shown on the Y-axis, and the line is plotted horizontally.false
(default), labels appear on the X-axis, and the line is plotted vertically.marks: Array<object>
(required)Each item defines a point on the line:
label: string | Date
The axis label corresponding to the point (e.g., category, time, name).
value: number
The numeric value for this point.
Optional fields from ChartMarkProps
can also be applied:
foregroundStyle
symbol
annotation
cornerRadius
opacity
, etc.LineChart
is useful for: