Line Chart

Donut ChartSparkline

Trends across several series, with a crosshair tooltip.

p95 latency
Milliseconds, last 7 days
daySearchAPIWeb
Mon240 ms182 ms124 ms
Tue228 ms176 ms131 ms
Wed251 ms191 ms118 ms
Thu219 ms168 ms122 ms
Fri262 ms204 ms140 ms
Sat205 ms158 ms109 ms
Sun198 ms150 ms102 ms

Installation

pnpm add krz-ui

Usage

import { LineChart } from "krz-ui";
<LineChart
  data={latency}
  index="day"
  series={[{ key: "api", label: "API" }, { key: "web", label: "Web" }]}
  valueFormatter={(v) => `${v} ms`}
/>

API Reference

PropTypeDescription
curvedbooleanSmooth monotone curves. Default true.
startAtZerobooleanStart the y-axis at zero. Default false.
dataRecord<string, string | number | null>[]One row per x-axis point.
indexstringKey of the x-axis label in each row.
series(string | { key, label?, color? })[]Value keys to plot. Colors follow the palette in order; pass `color` to pin one.
heightnumberPlot height in px. Default 240.
title / descriptionReactNodeCaption above the chart; also used for the accessible name.
valueFormatter(value: number) => stringFormats tooltip and table values.
tickFormatter(value: number) => stringFormats y-axis ticks. Default: comma'd, compact from 10k.
showLegendbooleanDefaults to shown for 2+ series.
tableTogglebooleanShow the “Show data” table toggle. Default true.
className / style / ref—All go to the outer <figure>. See Customization.
classNames{ header?, title?, description?, plot?, legend?, legendItem?, tableToggle?, table?, tooltip? }Extra classes for inner parts.