Data

Area Morph

An area chart that flows from one set of numbers to the next like a liquid, on the engine that morphs logos.

Preview

Installation

Terminal
npx @usefluid/cli add area-morph

Usage

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

<AreaMorph label="Visitors" values={[20, 34, 28, 52, 46, 70]} max={100} labels={["Jan", "Mar", "May"]} />

API reference

PropTypeDefaultDescription
labelstring—Accessible name of the chart.
valuesnumber[]—The points, from left to right. Change them and the area flows to the new shape.
maxnumberthe largest valueThe value at the top. Keep it fixed when the values change, so shapes compare.
labelsstring[]—Text under the chart, spread from left to right.

Keyboard and screen readers

The chart is an image named with its label and its values. With reduced motion the area changes at once.

Notes

areaPath(values, max) in area.ts draws the area in the 120 box, if you want the shape in your own svg. Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

The values become a smooth closed shape in the 120 box, and the morph engine flows it to the next shape: every point of the outline has its own spring, so the area moves like water settling. At rest the exact drawing of the data comes back. The chart is an image read with its label and values.

For your agent

For your agent

Add Area Morph to my project with the Fluid library. Use AreaMorph for the trend charts of my dashboard, switching ranges such as week, month and year. 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.