Labeled Line Chart
ProNewLines that end in their own names, moved apart where they would overlap, on linear or logarithmic time. The nearest line takes its color and reads its value under the pointer.
Installation
pnpm dlx shadcn@latest add @viewport/labeled-line-chart
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| title* | string | — |
| yLabel* | string | — |
| xLabel* | string | — |
| series* | LineSeries[] | — |
| xTicks* | number[] | — |
| yTicks* | number[] | — |
| logX | booleanUse a logarithmic x axis, e.g. for time that runs from minutes to hours. | false |
| formatX | (value: number) => string | String |
| formatY | (value: number) => string | String |
| height | numberThe height of the plot, in pixels. | 300 |
| className | string | — |
Accessibility
- Up and Down choose a line; Left and Right move along it.
- Direct labels mean no legend to match by color.
- The data is also a table for screen readers.
- Lines appear already drawn under reduced motion.