Data

Line Dots

A line chart whose points each ride a spring, so a change ripples along the line, with a bubble that slides between points.

Preview

Installation

Terminal
npx @usefluid/cli add line-dots

Usage

LineDots.tsx
import { LineDots } from "./LineDots";

<LineDots label="Signups" values={[24, 38, 31, 56]} labels={["Jan", "Feb", "Mar", "Apr"]} max={100} />

API reference

PropTypeDefaultDescription
labelstring—Accessible name of the chart.
valuesnumber[]—The points, from left to right. Change them and the line flows to them.
labelsstring[]—One label per point, unique, shown under the chart.
maxnumberthe largest valueThe value at the top. Keep it fixed when the values change.
formatIntl.NumberFormatOptions—How values are written, as in Intl.NumberFormat.
localestringthe browser'sLocale for the values.
colorstring`--fluid-accent`Colour of the line, the dots and the fill.

Keyboard and screen readers

Each point is a button named with its label and value. Tab reaches the chart once; the arrow keys, Home and End move between points, and the bubble follows. With reduced motion the line changes at once.

Notes

The chart measures its width, so the dots stay round at any size. pointsOf and linePath in line.ts draw the line, if you want it in your own svg. Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

Every point has its own spring, a little slower from left to right, and the line and its fill are redrawn through the points on each frame, so the curve bends like a rope settling. The value bubble slides between points on a spring of its own. Each point is a button read with its label and value.

For your agent

For your agent

Add Line Dots to my project with the Fluid library. Use LineDots for the time series of my dashboard, with my real labels and a fixed max. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.