014 / RECHARTS / AREA
Range Area
Bounded area visualization for showing a lower/upper envelope across an ordered domain, with optional central trend, truthful interval semantics, and explicit missing-bound behavior.
- SPEC
- #014
- ENGINE
- Recharts
- FAMILY
- Area
- RENDERER
- svg
- STATUS
- preview
Installation
Checking public registry…
View local registry JSONCopied as source into your project (requires recharts).
Overview
Range Area is the envelope-specialized chart of the Plotcn Area family. It visualizes a bounded lower and upper range across an ordered domain, with an optional central trend line.
The primary analytical question answered by Range Area is:
"What range or envelope contains the values across the ordered domain?"
The optional secondary question is:
"Where does the central or expected value sit inside that range?"
Unlike regular area charts that fill between a single metric and a zero baseline, Range Area fills strictly between two supplied boundary values (lower(x) → upper(x)). The filled region is the quantitative data itself—not a decorative background.
import { RangeArea } from "@/components/charts/recharts/area-range"const latencyData = [ { time: "10:00", min: 18, max: 26, median: 22 }, { time: "11:00", min: 19, max: 28, median: 23 }, { time: "12:00", min: 20, max: 36, median: 28 }, { time: "13:00", min: 17, max: 29, median: 21 }, { time: "14:00", min: 18, max: 25, median: 21 }, { time: "15:00", min: 21, max: 32, median: 25 },]export function ApiLatencyEnvelope() { return ( <RangeArea data={latencyData} xKey="time" series={{ lowerKey: "min", upperKey: "max", valueKey: "median", label: "Latency envelope", lowerLabel: "Min latency", upperLabel: "Max latency", valueLabel: "Median latency", }} color="var(--chart-1)" valueColor="var(--chart-2)" fillOpacity={0.25} showGrid /> )}Area-Family Positioning
The Plotcn Area family provides four distinct analytical instruments:
| Consideration | Prism Area (011) | Stack Flow Area (012) | Percent Stream Area (013) | Range Area (014) |
|---|---|---|---|---|
| Primary Question | "How much magnitude exists relative to baseline?" | "How do parts and total magnitude combine?" | "How does the composition of the whole evolve?" | "What envelope or interval contains the observations?" |
| Fill Geometry | Fills between metric and baseline | Fills additive layers from bottom to top | Fills 100% normalized proportional shares | Fills between supplied lower and upper bounds |
| Baseline Role | Configurable baseline ( or domain min) | Fixed baseline () | Fixed baseline () | No baseline fill; lower bound defines floor |
| Primary Identity | Single continuous area | Stacked additive layers | 100% normalized stream | Bounded range envelope; centerline is optional |
| Centerline | Not applicable | Not applicable | Not applicable | Supported via optional valueKey |
Critical Analytical Distinctions
- Range Area vs Range Line (004):
- Range Line: The central line is the primary visual and analytical object; the envelope is secondary supporting context.
- Range Area: The bounded envelope itself is the primary visual and analytical object; the centerline is optional supporting context.
- Range Area vs Forecast Line (010):
- Forecast Line: Implements an explicit transition from observed historical records to predicted future values.
- Range Area: Displays an envelope across the entire ordered domain with no implied observation-versus-forecast transition.
- Range Area vs Threshold Area:
- Threshold Area: Contextual reference limits are static horizontal lines.
- Range Area: Lower and upper bounds vary dynamically at every observation coordinate across the domain.
Range Envelope Model
Range Area Fills Between Two Supplied Bounds (lower → upper)
1. Bounded Fill Geometry
At every domain coordinate :
The SVG area polygon fills the vertical span between and . Neither zero nor the chart canvas bottom acts as an implicit baseline.
2. Optional Centerline
When valueKey is provided in series, a solid signal line renders over the envelope.
- No Midpoint Synthesis: If
valueKeyis omitted, Plotcn never invents a midpoint (). The mathematical midpoint may not represent any real statistic. - No Range Clamping: If the central value falls outside the envelope (e.g. an observed metric breaching an SLA tolerance band), Plotcn never clamps the centerline into the band. Values are rendered truthfully.
Truthful State Matrix & Missing Bounds
Truthful Handling of Missing Bounds, Missing Centerlines, and Inverted Data
lower ≤ upper and centerline present. Full bounded envelope with center marker.
One or both bounds null. Band gaps cleanly; centerline continues independently.
Centerline null while bounds valid. Band stays continuous; centerline gaps.
Inverted bounds omitted from band. Never silently swapped or rewritten.
Range Area handles missing bounds and malformed intervals with strict quantitative integrity:
| Observation Condition | Range Band Behavior | Centerline Behavior | Tooltip Range Status | Tooltip Center Status |
|---|---|---|---|---|
| Valid Interval & Center | Full filled band | Rendered point / line | Formatted lower – upper | Formatted value |
| Missing Lower Bound | Band gaps | Rendered if valid | "Unavailable" | Formatted value |
| Missing Upper Bound | Band gaps | Rendered if valid | "Unavailable" | Formatted value |
| Both Bounds Missing | Band gaps | Rendered if valid | "Unavailable" | Formatted value |
| Missing Centerline | Full filled band | Centerline gaps | Formatted lower – upper | "Unavailable" |
| Equal Bounds () | Zero-width line/point | Rendered if valid | Formatted value (Zero width) | Formatted value |
| Inverted Bounds () | Band segment omitted | Rendered if valid | "Invalid bounds" | Formatted value |
[!CAUTION] Data Integrity Guarantee: If , Plotcn never silently swaps the bounds. Silent swapping falsifies user data. Instead, the invalid segment is omitted from the envelope, an "Invalid bounds" badge appears in inspection tooltips, and a developmental warning is logged.Curve Safety & Smoothing Invariants
Upper and lower envelope boundaries and the optional centerline must share the exact same curve interpolation algorithm:
<RangeArea data={data} xKey="time" series={series} curve="linear" // "linear" | "monotone" | "step"/>- Default is
linear: For interval envelopes, piecewise linear interpolation guarantees that if at every point, the interpolated band will never self-intersect or invert between points. monotoneSafety: When using"monotone", ensure sample points are sufficiently dense to prevent cubic spline overshoot near sudden inflection steps.- Equal Curves Mandatory: Plotcn prohibits configuring different curves for lower and upper boundaries, which would create impossible synthetic self-intersections.
Data Contract
Range Area accepts a readonly array of objects. Caller data is never mutated or sorted in place.
interface LatencyObservation { time: string min: number | null max: number | null median?: number | null}<RangeArea data={observations} xKey="time" series={{ lowerKey: "min", upperKey: "max", valueKey: "median", label: "Operating envelope", }}/>Negative & Cross-Zero Bounds
Unlike additive stacked area charts, Range Area naturally supports negative numbers and cross-zero intervals:
- Negative Envelopes: E.g. temperature anomalies spanning .
- Zero-Crossing Envelopes: E.g. cash flow variance spanning .
- Zero Is Valid: Observations with $0$ are treated as truthful quantitative coordinates, not missing values.
Color Customization & Theme Roles
Range Area accepts semantic CSS theme tokens or custom color overrides:
<RangeArea data={data} xKey="time" series={series} color="var(--chart-1)" // Envelope fill & boundary strokes valueColor="var(--chart-2)" // Optional centerline fillOpacity={0.25} // Fill translucency (0.05 to 1.0) selectionColor="var(--chart-selection)"/>- Distinguishability: If
color === valueColor, the envelope and centerline remain readily distinguishable via fill translucency, line weight, and geometry. - Theme Adaptation: Semantic tokens adapt automatically across Light and Dark themes.
Props Reference
| Property | Type | Default | Description |
|---|---|---|---|
data | readonly TData[] | [] | Readonly array of observation records. Caller data is never mutated. |
xKey | keyof TData & string | — | Property key for horizontal domain coordinates. |
series | RangeAreaSeries<TData> | — | Semantic configuration defining lowerKey, upperKey, optional valueKey, and labels. |
height | number | string | 320 | Container height in pixels or CSS units. |
curve | "linear" | "monotone" | "step" | "linear" | Shared interpolation curve applied identically to envelope and centerline. |
domain | [number, number] | "auto" | auto | Explicit vertical domain override. Defaults to auto-padded scale enclosing all bounds. |
color | string | var(--chart-1) | Primary color for range envelope fill and boundaries. |
valueColor | string | var(--chart-2) | Color for optional central signal line. |
fillOpacity | number | 0.25 | Translucency of the range envelope fill (0.05 to 1.0). |
selectionColor | string | var(--chart-selection) | Accent color for active crosshair and locked pin. |
showGrid | boolean | true | Whether to render subtle Cartesian grid reference lines. |
showXAxis | boolean | true | Whether to render horizontal domain labels. |
showYAxis | boolean | true | Whether to render vertical metric scale ticks. |
showLegend | boolean | false | Whether to render series identity legend. |
lockableTooltip | boolean | true | Enables persistent tooltip pinning on click, tap, or Enter/Space. |
motion | boolean | { duration?: number } | true | Controls entry animations. Automatically bypassed under reduced motion. |
valueFormatter | (value: number) => string | n.toLocaleString() | Formatter for bounds and metric values. |
xFormatter | (value: string | number) => string | — | Formatter for horizontal tick labels. |
Props Reference & Interactive Prop Explorer
Inspect every component property, customize semantic color roles live with instant visual feedback, and copy production-ready code with active prop configurations.
Colors & Appearance Configuration
Customize primary, reference, or annotation series colors. Defaults derive from Plotcn theme tokens.
<RangeArea
data={data}
xKey="date"
series={{
lowerKey: "min",
upperKey: "max",
valueKey: "median",
label: "Latency envelope",
}}
/>Curve interpolation algorithm shared identically across the envelope and centerline.
curve="linear"Default: "linear"Primary color for range envelope fill and boundary strokes.
color="var(--chart-1)"Default: "var(--chart-1)"Opacity of the range envelope fill (0.05 to 1.0).
fillOpacity={0.25}Default: 0.25Whether to render subtle horizontal Cartesian grid reference lines.
showGrid={true}Default: trueWhether to render the series identity legend.
showLegend={false}Default: falseEnables persistent tooltip pinning on click, tap, or Enter/Space.
lockableTooltip={true}Default: true| Property | Type | Default | Required | Description |
|---|---|---|---|---|
dataReq | readonly TData[] | [] | Yes | Readonly array of observation records. Caller data is never mutated or sorted in place. |
xKeyReq | keyof TData & string | — | Yes | Property name on data records for horizontal domain coordinates. |
seriesReq | RangeAreaSeries<TData> | — | Yes | Semantic configuration defining lowerKey, upperKey, optional valueKey, and display labels. |
heightOpt | number | string | 320 | No | Container height in pixels or standard CSS dimension strings. |
curveOpt | "linear" | "monotone" | "step" | "linear" | No | Curve interpolation algorithm shared identically across the envelope and centerline. |
colorOpt | string | "var(--chart-1)" | No | Primary color for range envelope fill and boundary strokes. |
valueColorOpt | string | "var(--chart-2)" | No | Color for optional central signal line and center marker. |
fillOpacityOpt | number | 0.25 | No | Opacity of the range envelope fill (0.05 to 1.0). |
string | "var(--chart-selection)" | No | Accent color for the active inspection crosshair and locked pin. | |
showGridOpt | boolean | true | No | Whether to render subtle horizontal Cartesian grid reference lines. |
showXAxisOpt | boolean | true | No | Whether to render the horizontal category scale. |
showYAxisOpt | boolean | true | No | Whether to render the vertical value axis. |
showLegendOpt | boolean | false | No | Whether to render the series identity legend. |
boolean | true | No | Enables persistent tooltip pinning on click, tap, or Enter/Space. | |
animationOpt | "draw" | "fade" | "none" | "draw" | No | Initial reveal animation style. Bypassed automatically under reduced motion. |
(value: number) => string | — | No | Custom formatter for range bounds and centerline values in tooltips. | |
xFormatterOpt | (value: string | number) => string | — | No | Custom formatter for horizontal domain tick labels. |
titleOpt | string | "Range Area Chart" | No | Accessible heading announced to screen readers. |
descriptionOpt | string | undefined | No | Accessible descriptive summary announced to screen readers. |
Component Variants & Edge States
Production cookbooks showcasing configuration variants alongside verified handling of loading, empty data, and network error states.
API Latency Envelope with Median
Hourly observed min/max latency bounds with median signal line illustrating typical service operating conditions.
Tolerance Envelope Without Centerline
Pure lower/upper operating envelope demonstrating that a centerline is never midpoint-derived when valueKey is omitted.
Skeletons indicate runtime fetch or pending data queries.
Handles empty collections ([]) gracefully without crashing.
Graceful failure banner when data source or script fails.
Container-Driven Breakpoints
Range Area preserves full lower/upper envelope bounds, active inspection slice, and optional centerline across all device widths down to 320px.
Spacious envelope band, full domain ticks, and multi-line inspection tooltip displaying range span and centerline.
Adaptive domain tick thinning, preserved interval geometry, and synchronized nearest-X inspection.
Compact gutters, full interval band without dropping bounds, and compact locked tooltip preventing horizontal page overflow.
Accessibility & Navigation Standards
Single keyboard tab stop on root figure with ArrowLeft, ArrowRight, Home, End, Enter/Space, and Escape shortcuts.
Container mounts as region with explicit assistive label.
Envelope boundary strokes, distinct fill translucency, formatted tooltip readouts, and off-screen structured data table provide accessible non-color differentiation.
Embeds visually hidden summary (.sr-only) declaring: “Announces domain coordinate, range envelope bounds (lower to upper), and centerline value when present. Explicitly alerts if bounds are missing or invalid.”
All entrance animations immediately bypass when prefers-reduced-motion is detected in user system preferences.
| Key | Action |
|---|---|
| ArrowRight | Inspect next chronological observation across the domain. |
| ArrowLeft | Inspect previous chronological observation across the domain. |
| Home | Jump inspection directly to the first observation. |
| End | Jump inspection directly to the final observation. |
| Enter / Space | Lock or unlock persistent inspection at the active coordinate. |
| Escape | Release locked selection and dismiss active inspection tooltip. |
Data Safety Guarantees
- Supplied Bounds Only: Plotcn fills only between supplied
lowerKeyandupperKeyvalues. - No Midpoint Synthesis: Never invents a central line if
valueKeyis omitted. - No Bound Swapping: If , data is flagged invalid and omitted from the band; bounds are never reversed.
- No Zero Substitution: Missing bounds () result in a gap; zero is never substituted.
- No Clamping: Centerlines outside the envelope are displayed truthfully without artificial clamping.
- Caller Immutability: Original data records are never mutated or sorted in place.
- Accessibility Disclosure: Structured HTML data table disclosure provides full non-visual access to all interval coordinates.
Internal Architecture & File Dependencies
Source-first ownership model. Inspect the exact component call tree, dependencies, and full implementation below.
Handles container dimension measurement and SVG viewBox sizing
Coordinates coordinate scales, Cartesian grid, Area range envelope, and Line centerline