caliper uidocs

Surface chart

Pro

One value over two variables, drawn as a surface you can turn. It is orthographic, with no perspective, so a tall point is tall from every side. Cells over the threshold turn ember, and the top view is the same data as a heatmap.

Installs components/ui/surface-chart.tsxDepends on @radix-ui/react-slot, lucide-reactMotion shared motion tokens
pnpm dlx shadcn@latest add @caliper/surface-chart
p95 latency by request rate and cache hit rate
cache hits \ rps03086921,0001,3081,6922,000
30%44 ms58 ms88 ms145 ms260 ms264 ms332 ms
41%44 ms57 ms85 ms157 ms328 ms255 ms302 ms
54%44 ms57 ms82 ms133 ms243 ms219 ms263 ms
65%44 ms56 ms78 ms108 ms156 ms186 ms231 ms
76%44 ms56 ms76 ms96 ms123 ms161 ms198 ms
89%44 ms55 ms72 ms87 ms105 ms131 ms154 ms
100%44 ms55 ms68 ms79 ms90 ms103 ms114 ms

1,538 rps · 43% cache hits · p95 283 ms · over the 250 ms SLO

under the thresholdover the 250 ms SLOOrthographic: heights compare honestly.

When to use #

Use it for

  • Response surfaces: latency by load and cache hit rate, yield by temperature and time.
  • Finding where a value falls off a cliff.

Skip it when

  • One variable, or two categories; use a line or a heatmap.
  • Exact comparison; the top view and the table are for that.

Decisions #

Why it is built this way, so you know what to keep when you change your copy.

Behaviour

A probe you can read
Click or use the arrows to stand the probe on a cell; its value is written out in a live region, not only drawn.
Paused when idle
It paints only while it is turning or when something changes, and repaints when the theme does.

Styling

No perspective
Heights compare honestly. Perspective would make the near edge look taller than the far one.

Installation #

terminal
pnpm dlx shadcn@latest add @caliper/surface-chart

Adds its 8 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage #

Import it from your copy of the source. The example behind the preview comes with the source.

example.tsx
import { SurfaceChart } from "@/components/ui/surface-chart"

The worked example comes with Pro

The 28-line example behind the preview opens here with a Pro or Team licence.

Checking your licence…

API reference #

SurfaceChart

component
PropTypeDefaultDescription
label *string—
x *SurfaceAxis—The axis along the bottom, left to right.
y *SurfaceAxis—The axis into the screen, front to back.
z *readonly (readonly number[])[]—One array per y step, one number per x step. At least 2 by 2.
zLabel *string—What the height is, for example "p95 latency".
zFormat((value: number) => string)(n: number) => String(Math.round(n))
thresholdnumber—Cells above this value turn ember.
thresholdLabelstring"over the threshold"
statusDepthStatus"ready"
messagesDepthMessages—
onRetry(() => void)—
disabledboolean—
classNamestring—

Accessibility #

It exposes group semantics, with aria-label, aria-describedby and aria-live kept in step with state. Changes that matter are announced through a live region.

No custom key handling; Tab and the native activation keys do the work.

Motion #

Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.