001 / RECHARTS / LINE
Signal Line
Focused single-series time-series visualization with restrained active-point emphasis, accessible keyboard exploration, and Plotcn semantic tokens.
- SPEC
- #001
- ENGINE
- Recharts
- FAMILY
- Line
- RENDERER
- svg
- STATUS
- preview
Installation
Checking public registry…
View local registry JSONCopied as source into your project (requires recharts).
Overview
Signal Line is Plotcn's reference single-series Cartesian visualization for continuous time-series and ordered metrics. Built on native Recharts primitives and styled with Plotcn's semantic color system, it delivers an uncluttered, high-density analytical surface.
Unlike standard charting defaults, Signal Line eliminates unnecessary marker clutter, replaces noisy grids with quiet horizontal reference rules, and emphasizes data through a crisp active-point dot and vertical nearest-X crosshair.
import { SignalLine } from "@/components/charts/recharts/line-signal"export function MetricCard() { return ( <SignalLine data={telemetryData} xKey="timestamp" seriesKey="latency" color="var(--chart-1)" /> )}Best Suited For
Signal Line is specifically calibrated for:
- Application Performance: Request latency, error rates, and throughput over time.
- Operational & Infrastructure Telemetry: CPU load, memory pressure, active worker threads, and queue depth.
- Product Growth & Usage: Daily active users (DAU), conversion rates, checkout velocity, and subscription changes.
- Financial & Revenue Trends: Monthly recurring revenue (MRR), cash flow runs, and gross merchandise volume (GMV).
When to Avoid
- Comparing Multiple Series: Use
MultiSeriesLineorStackedAreawhen comparing 3+ independent series simultaneously. - Part-to-Whole Ratios: Use
DonutorTreemapwhen the primary question is categorical share rather than temporal progression. - Network Topologies: Use
D3ForceNetworkfor non-Cartesian node and edge graphs.
Installation
Install Signal Line directly into your project via the shadcn CLI. The component source and its required dependencies (recharts and shared Plotcn primitives) will be copied directly into your repository under complete source ownership.
Checking public registry…
View local registry JSONCopied as source into your project (requires recharts).
Data Contract
Signal Line accepts a readonly array of objects. Each record must contain a horizontal domain key (time, date, or ordered category) and a numeric metric value.
export interface TelemetryPoint { date: string // ISO date string, formatted timestamp, or ordinal label latency: number // Numeric observation in milliseconds}Truthful Missing Values
When an observation is missing or disconnected in production, Signal Line respects the data's truth:
| Policy | Prop Configuration | Visual Behavior |
|---|---|---|
| Gap (Default) | missingValuePolicy="gap" | Produces an explicit break in the stroke. Missing values are never silently coerced to zero. |
| Connect | missingValuePolicy="connect" | Line draws across the gap to bridge adjacent valid observations. |
Component Props
Core Configuration
| Prop | Type | Default | Description |
|---|---|---|---|
data | readonly TData[] | [] | Readonly array of observation records. The caller's array is never mutated. |
xKey | keyof TData & string | required | Property name representing the horizontal X axis coordinate. |
seriesKey | keyof TData & string | "value" | Property name representing the numeric metric value. |
height | number | string | 320 | Container height in pixels or standard CSS string (e.g. 100%, 380px). |
curve | "monotone" | "linear" | "step" | "monotone" | Line interpolation. Use monotone for smooth trends, linear for raw points, step for discrete state changes. |
domain | [number, number] | ["auto", "auto"] | "auto" | Explicit Y-axis bounds. Single-value datasets automatically expand around the value to prevent zero-height scales. |
missingValuePolicy | "gap" | "connect" | "gap" | Handling of null or undefined observations. |
Visual & Appearance
| Prop | Type | Default | Description |
|---|---|---|---|
color | string | "var(--chart-1)" | Primary stroke color. Supports CSS custom properties, hex, and RGB tokens. |
showGrid | boolean | true | Renders subtle dashed horizontal reference dividers (var(--chart-grid)). |
showXAxis | boolean | true | Renders horizontal domain tick labels. |
showYAxis | boolean | true | Renders vertical metric values. |
showLegend | boolean | false | Toggles series legend. Disabled by default for single-series clarity. |
motion | boolean | { duration: number } | true | Line reveal animation (350ms). Automatically disabled under prefers-reduced-motion. |
Accessibility & States
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "Signal Line" | Accessible name announced by screen readers for the <figure> region. |
description | string | undefined | Extended description providing context on metric behavior and trends. |
loading | boolean | false | Displays neutral loading skeleton while preserving chart footprint. |
error | Error | string | null | null | Displays actionable error state banner with optional retry trigger. |
unavailable | boolean | string | null | false | Displays metric unavailability notice (e.g. tier restrictions or retention limits). |
onRetry | () => void | undefined | Callback invoked when user clicks the error retry button. |
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.
<SignalLine
data={data}
xKey="date"
seriesKey="value"
/>Interpolation strategy between points. Monotone is ideal for smooth rates; step for discrete state shifts.
curve="monotone"Default: "monotone"Primary line stroke color. Accepts any CSS variable token or hex string.
color="var(--chart-1, #10b981)"Default: "var(--chart-1, #10b981)"Container height in pixels or standard CSS dimension strings.
height={320}Default: 320Whether to render subtle horizontal background reference gridlines.
showGrid={true}Default: trueHandling of null or undefined observations. 'gap' preserves visual breaks; 'connect' bridges adjacent points.
missingValuePolicy="gap"Default: "gap"| Property | Type | Default | Required | Description |
|---|---|---|---|---|
dataReq | readonly TData[] | [] | Yes | Readonly array of observation records. Will not be mutated by the component. Best for: Primary dataset |
xKeyReq | keyof TData & string | — | Yes | Field name for the horizontal axis domain (e.g. date, timestamp, or step). Best for: Domain mapping |
seriesKeyOpt | keyof TData & string | "value" | No | Direct field name for the numeric value to plot. Best for: Single series lookup |
curveOpt | "monotone" | "linear" | "step" | "monotone" | No | Interpolation strategy between points. Monotone is ideal for smooth rates; step for discrete state shifts. Best for: Visual curve style |
colorOpt | string | "var(--chart-1, #10b981)" | No | Primary line stroke color. Accepts any CSS variable token or hex string. Best for: Theming & brand identity |
heightOpt | number | string | 320 | No | Container height in pixels or standard CSS dimension strings. Best for: Dashboard slot sizing |
showGridOpt | boolean | true | No | Whether to render subtle horizontal background reference gridlines. Best for: Grid density control |
"gap" | "connect" | "gap" | No | Handling of null or undefined observations. 'gap' preserves visual breaks; 'connect' bridges adjacent points. Best for: Data safety & truthful representation | |
tickStrategyOpt | "auto" | "all" | "preserve-start" | "preserve-end" | "preserve-both" | "auto" | No | X-axis tick density calculation to prevent label collision on narrow containers. |
showXAxisOpt | boolean | true | No | Whether to display the horizontal axis tick labels. |
showYAxisOpt | boolean | true | No | Whether to display the vertical axis metric values. |
showLegendOpt | boolean | false | No | Whether to display a chart legend. Hidden by default for focused single-series clarity. |
motionOpt | boolean | { duration?: number } | true | No | Initial line draw animation. Automatically disabled when prefers-reduced-motion is active. |
titleOpt | string | "Signal Line" | No | Accessible name announced to screen-readers for the chart region. |
descriptionOpt | string | undefined | No | Long-form context describing what the metric trend communicates. |
loadingOpt | boolean | false | No | Renders a neutral loading skeleton preserving container footprint without fake data. |
errorOpt | Error | string | null | null | No | Renders an actionable error state banner with optional retry trigger. |
unavailableOpt | boolean | string | null | false | No | Renders a metric unavailability notice (e.g. permission restriction or retention limit). |
Component Variants & Edge States
Production cookbooks showcasing configuration variants alongside verified handling of loading, empty data, and network error states.
Daily Server Latency
Standard single-series monitoring metric with monotone smoothing and active crosshair.
Truthful Data Gap
Missing telemetry observations rendered with explicit visual gaps instead of coercing to zero.
Concurrency Limit Changes
Discrete step curve illustrating instantaneous state transitions.
Compact Card Trend
Condensed 180px trend view without Y-axis clutter for dashboard overview tiles.
Skeletons indicate runtime fetch or pending data queries.
Handles empty collections ([]) gracefully without crashing.
Graceful failure banner when data source or script fails.
Responsive Behavior
Signal Line automatically adapts to its parent container via an internal ResizeObserver:
- Desktop (1024px+): Spacious margins, full tick intervals, and hover tooltip inspector.
- Tablet (640px – 1023px): Adaptive X-axis tick thinning to prevent label collision, compact margin offsets.
- Mobile (< 640px): Aggressive tick reduction (preserving start/end endpoints), full touch-scrub hit area, and edge-to-edge container expansion (
w-full px-4).
Container-Driven Breakpoints
Signal Line leverages container ResizeObserver measurements to dynamically reduce X-axis tick frequency, preserving legible typography down to 320px containers.
Full tick density, spacious margins, detailed tooltips
Thinned X-axis labels, preserved line continuity, compact margins
Aggressive tick thinning, touch scrub target, negative margin compensation
Accessibility & Keyboard Navigation
Signal Line is fully operable without a mouse:
- Focusable Region: Pressing Tab focuses the chart container with a prominent focus ring (
var(--chart-focus)). - Arrow Key Navigation:
- → Selects the next data observation.
- ← Selects the previous data observation.
- Home Jumps directly to the first observation.
- End Jumps to the final observation.
- Esc Clears active selection.
- Screen Reader Announcement: A live region announces the selected index and value without requiring pointer interaction.
- Factual Figure Summary: An invisible
<figcaption>provides an automated quantitative overview (total observation count, net change from start to finish, and min/max extremes).
Accessibility & Navigation Standards
Screen-reader figure region with programmatic title and automated factual metric summary (observation count, net delta, min/max bounds).
Container mounts as region with explicit assistive label.
Active point renders an enlarged concentric marker; tooltips provide explicit alphanumeric readout.
Embeds visually hidden summary (.sr-only) declaring: “VoiceOver and NVDA announce the chart region and summary without traversing dozens of raw SVG nodes.”
Automatically suppresses stroke draw animation when user requests reduced motion.
| Key | Action |
|---|---|
| Tab | Focus chart interaction surface with visible focus ring |
| ArrowLeft | Select previous data observation |
| ArrowRight | Select next data observation |
| Home | Jump to first data point |
| End | Jump to last data point |
| Escape | Clear active selection |
Data Safety Guarantee
- Zero Fabricated Fallback Data: Signal Line will never generate fake metrics when data is empty or missing.
- Finite Number Enforcement: Non-finite values (
NaN,Infinity,-Infinity) are cleanly caught before calculation, preventing brokend="M NaN..."SVG paths. - Safe Scale Expansion: If every datum contains the exact same value (e.g.
[42, 42, 42]), the Y-domain deterministically expands ([37, 47]) rather than collapsing into a zero-height division error. - Distinct State Precedence:
error,unavailable,loading, andemptyare mutually exclusive and strictly prioritized.
Internal Architecture & File Dependencies
Source-first ownership model. Inspect the exact component call tree, dependencies, and full implementation below.
Scoped CSS variables for axes, grid, and crosshairs without global pollution.