002 / RECHARTS / LINE

Pulse Line

Recharts

High-frequency operational trend visualization for rapidly changing metrics, rolling windows, and live telemetry surfaces.

SPEC
#002
ENGINE
Recharts
FAMILY
Line
RENDERER
svg
STATUS
preview

Installation

PLOTCN/REGISTRY/LINE-PULSE/SOURCE
pnpm dlx shadcn@latest add @plotcn/line-pulse

Checking public registry…

View local registry JSON
REGISTRY direct URL·ENGINE Recharts·FILES 1·DEPENDENCIES 6

Copied as source into your project (requires recharts).

× 340Container width
Measuring preview...
RECHARTS · SVG · 0 × 340pxMotion enabled · ResizeObserver

Overview

Pulse Line is Plotcn's reference operational visualization designed for rapidly updating metrics, real-time dashboards, infrastructure monitoring, and streaming telemetry surfaces.

While Signal Line is calibrated for analytical trends and deliberate historical inspection, Pulse Line keeps watch over a live signal. It introduces an active terminal marker for the latest observation, built-in rolling window slicing (windowSize), direct geometry updates that prevent animation queue lag, and a restrained visual hierarchy that stays quiet in dense multi-metric dashboards.

TSX
import { PulseLine } from "@/components/charts/recharts/line-pulse"export function RequestLatencyCard() {  return (    <PulseLine      data={telemetryStream}      xKey="timestamp"      seriesKey="latency"      windowSize={30}      showLatestPoint      showLatestValue      color="var(--chart-1)"    />  )}

Best Suited For

Pulse Line is optimized for continuous operational metrics where immediate awareness of the current value and recent trajectory is paramount:

  • API & Service Telemetry: Request throughput (QPS), P50/P95/P99 latency, error rates, and connection pools.
  • Infrastructure Health: CPU load %, memory pressure, disk I/O velocity, active worker threads, and queue depth.
  • Live Business Operations: Payment processing velocity, streaming conversions, checkout queue volume, and concurrent connected clients.
  • IoT & Sensor Feeds: Temperature delta, battery voltage drain, and network packet loss.

When to Avoid

  • Historical Reporting: Use SignalLine when inspecting multi-month business trends with deliberate reporting annotations.
  • Comparing Independent Series: Use MultiSeriesLine or StackedArea when comparing 3+ separate metrics simultaneously.
  • Part-to-Whole Relationships: Use Donut or Treemap when evaluating categorical share rather than sequential rate of change.

Installation

Install Pulse 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 codebase under full source ownership.

PLOTCN/REGISTRY/LINE-PULSE/SOURCE
pnpm dlx shadcn@latest add @plotcn/line-pulse

Checking public registry…

View local registry JSON
REGISTRY direct URL·ENGINE Recharts·FILES 1·DEPENDENCIES 6

Copied as source into your project (requires recharts).

Data Contract

Pulse Line accepts a readonly array of chronological records. Each observation contains a domain coordinate (timestamp or sequential interval) and a numeric metric value.

TypeScript
export interface OperationalSample {  timestamp: string  // ISO time string or sequential tick (e.g. "14:20:05")  latency: number    // Numeric operational observation (e.g. milliseconds)}

Rolling Window (windowSize)

In streaming applications, observations arrive continuously. Rather than requiring caller-side array truncation, Pulse Line accepts a windowSize prop. It deterministically slices the latest NN observations without mutating the original dataset:

TSX
// Incoming buffer contains 120 observations; only the latest 30 are rendered<PulseLine data={buffer} xKey="time" seriesKey="qps" windowSize={30} />

Truthful Missing Telemetry

In operational environments, a missing sample represents a telemetry drop or sensor outage—never a value of zero. Pulse Line adheres to strict data truthfulness:

Policy Configuration Visual & Semantic Behavior
PolicyConfigurationVisual & Semantic Behavior
Gap (Default)missingValuePolicy="gap"Stroke breaks across missing observations. Prevents misleading drops to zero.
ConnectmissingValuePolicy="connect"Line bridges across the missing interval to connect adjacent valid samples.

Component Props

Core Configuration

Prop Type Default Description
PropTypeDefaultDescription
datareadonly TData[][]Readonly array of observation records. The caller's array is never mutated.
xKeykeyof TData & stringrequiredProperty name representing the horizontal X axis coordinate.
seriesKeykeyof TData & string"value"Property name representing the numeric metric value.
windowSizenumberundefinedRolling window size. When specified, only the latest N observations are rendered.
showLatestPointbooleantrueRenders a terminal marker dot with subtle outer ring at the latest observation.
showLatestValuebooleanfalseDisplays a compact header pill showing the latest formatted metric value.
latestValueFormatter(value: number) => stringundefinedDedicated formatter for the latest-value pill. Falls back to series.valueFormatter.
curve"linear" | "monotone" | "step""monotone"Interpolation method. Use linear for discrete sensor ticks, monotone for continuous flow.
heightnumber | string280Container height in pixels or standard CSS string (e.g. 100%, 320px).
domain[number, number] | ["auto", "auto"]"auto"Explicit Y-axis bounds. Single-value signals automatically expand to prevent zero-height scales.
tickStrategy"auto" | "all" | "preserve-start" | "preserve-end" | "preserve-both""auto"Horizontal tick thinning policy.

Operational & Visual

Prop Type Default Description
PropTypeDefaultDescription
updateMode"direct" | "transition""direct"High-frequency update mode. direct applies updates immediately with zero animation lag.
colorstring"var(--chart-1, #10b981)"Primary stroke and terminal marker color. Supports CSS custom properties and hex codes.
showGridbooleantrueRenders subtle horizontal dashed background reference rules (var(--chart-grid)).
showXAxisbooleantrueRenders horizontal domain tick labels.
showYAxisbooleantrueRenders vertical metric values.
showLegendbooleanfalseToggles series legend. Disabled by default to preserve dashboard surface area.
referenceLinesreadonly PulseReferenceLine[]undefinedArray of horizontal threshold rules (e.g. SLO, SLA, capacity limit).
missingValuePolicy"gap" | "connect""gap"Handling of null or undefined observations.
motionboolean | { duration: number }trueLine reveal animation. Automatically disabled under prefers-reduced-motion.

Accessibility & States

Prop Type Default Description
PropTypeDefaultDescription
titlestring"Pulse Line"Accessible name announced by screen readers for the <figure> region.
descriptionstringundefinedExtended description providing context on telemetry behavior.
loadingbooleanfalseDisplays neutral loading skeleton while preserving chart layout footprint.
errorError | string | nullnullDisplays actionable error state banner with optional retry trigger.
unavailableboolean | string | nullnullDisplays metric stream unavailability notice (e.g. retention cutoff).
onRetry() => voidundefinedCallback invoked when user clicks the error retry trigger.
03 / Component API & Styling

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.

Generated Usage Code (Live Props):
<PulseLine
  data={data}
  xKey="date"
  seriesKey="value"
/>
Interactive Prop Preview Lab
windowSizenumber

Rolling window size. When specified, only the latest N observations are rendered.

Select value to preview live:
Active: windowSize={6}Default: undefined
showLatestPointboolean

Renders an active terminal marker dot with subtle concentric ring at the latest observation.

Select value to preview live:
Active: showLatestPoint={true}Default: true
showLatestValueboolean

Renders a compact header pill showing the latest formatted metric value.

Select value to preview live:
Active: showLatestValue={false}Default: false
curve"linear" | "monotone" | "step"

Line interpolation method. Use linear for discrete samples, monotone for smooth trajectories.

Select value to preview live:
Active: curve="monotone"Default: "monotone"
heightnumber | string

Container height in pixels or standard CSS string (e.g. 100%, 320px).

Select value to preview live:
Active: height={280}Default: 280
colorstring

Primary stroke and terminal dot color. Supports CSS custom properties or hex codes.

Select value to preview live:var(--chart-1, #10b981)
Active: color="var(--chart-1, #10b981)"Default: "var(--chart-1, #10b981)"
showGridboolean

Displays subtle horizontal dashed background reference rules.

Select value to preview live:
Active: showGrid={true}Default: true
missingValuePolicy"gap" | "connect"

Handling of null or disconnected observations. Gap avoids false interpolation.

Select value to preview live:
Active: missingValuePolicy="gap"Default: "gap"
All Properties (18)
Component properties
PropertyTypeDefaultRequiredDescription
dataReq
readonly TData[][]Yes

Readonly array of operational telemetry records. Caller array is never mutated.

Best for: Incoming telemetry stream or rolling buffer

xKeyReq
keyof TData & string-Yes

Property name for horizontal time coordinates (e.g. timestamp, time, tick).

Best for: Domain accessor

keyof TData & string"value"No

Property name for numeric metric value.

Best for: Metric accessor

numberundefinedNo

Rolling window size. When specified, only the latest N observations are rendered.

Best for: Keeping chart uncluttered in live streaming dashboards

booleantrueNo

Renders an active terminal marker dot with subtle concentric ring at the latest observation.

Best for: Immediate visual awareness of current signal state

booleanfalseNo

Renders a compact header pill showing the latest formatted metric value.

Best for: High-density monitoring panels

"linear" | "monotone" | "step""monotone"No

Line interpolation method. Use linear for discrete samples, monotone for smooth trajectories.

Best for: Matching telemetry physics and sampling rate

number | string280No

Container height in pixels or standard CSS string (e.g. 100%, 320px).

Best for: Dashboard panel height alignment

string"var(--chart-1, #10b981)"No

Primary stroke and terminal dot color. Supports CSS custom properties or hex codes.

Best for: Semantic operational status (emerald for normal, amber for warn)

booleantrueNo

Displays subtle horizontal dashed background reference rules.

Best for: Quiet structural reference

"gap" | "connect""gap"No

Handling of null or disconnected observations. Gap avoids false interpolation.

Best for: Truthful reporting of telemetry outages

"direct" | "transition""direct"No

Direct applies geometry instantly without animation lag; transition interpolates over 150ms.

Best for: High-frequency streaming where animation queues must be avoided

[number, number] | ["auto", "auto"]"auto"No

Explicit Y-axis bounds. Single-value signals automatically expand to prevent zero-height scales.

Best for: Fixing scale bounds across multiple metric panels

readonly PulseReferenceLine[]undefinedNo

Array of horizontal threshold rules (e.g. SLO, SLA, capacity limit).

Best for: Operational threshold monitoring

booleanfalseNo

Toggles series legend. Disabled by default to save dashboard surface space.

Best for: Multi-panel consistency when required

booleanfalseNo

Displays neutral loading skeleton while preserving chart layout footprint.

Best for: Initial stream connection

Error | string | nullnullNo

Displays actionable error state banner with optional retry trigger.

Best for: WebSocket or telemetry stream failure

boolean | string | nullnullNo

Displays metric stream unavailability notice (e.g. tier limits or retention cutoffs).

Best for: Permission or stream retention boundaries

04 / Cookbook & States

Component Variants & Edge States

Production cookbooks showcasing configuration variants alongside verified handling of loading, empty data, and network error states.

API Request Throughput

High-frequency operational throughput signal in QPS with rolling window and active terminal dot.

<PulseLine
  data={throughputData}
  xKey="timestamp"
  seriesKey="qps"
  windowSize={30}
  showLatestPoint
  showLatestValue
  color="var(--chart-1, #10b981)"
/>

P99 Latency with SLO Threshold

Telemetry latency signal with reference threshold rule at 100ms SLO target.

<PulseLine
  data={latencyData}
  xKey="timestamp"
  seriesKey="latency"
  curve="linear"
  color="#3b82f6"
  referenceLines={[{ y: 100, label: "SLO 100ms" }]}
/>

Telemetry Outage (Truthful Gap)

Demonstrating truthful missing-value handling when telemetry drops between sensors.

<PulseLine
  data={sensorData}
  xKey="time"
  seriesKey="temp"
  missingValuePolicy="gap"
  color="#f59e0b"
/>

Signed Net Queue Delta

Operational metric with positive and negative fluctuations around a zero baseline.

<PulseLine
  data={queueDeltaData}
  xKey="minute"
  seriesKey="delta"
  color="var(--chart-1, #10b981)"
/>
Lifecycle & Exception States
01. Loading State

Skeletons indicate runtime fetch or pending data queries.

02. Empty Data State

Handles empty collections ([]) gracefully without crashing.

03. Error State

Graceful failure banner when data source or script fails.

Responsive Behavior

Pulse Line dynamically adjusts its tick density, terminal marker offsets, and hit target padding via an internal ResizeObserver:

  • Desktop (1024px+): Full horizontal interval resolution, spacious margins, prominent latest-value badge, and hover crosshair.
  • Tablet (640px – 1023px): Adaptive tick thinning (preserving endpoints), compact latest pill, and balanced axis footprint.
  • Mobile (< 640px): Aggressive tick reduction (preserving start and end ticks), inline latest-value rail, and edge-to-edge touch scrub.
05 / Responsive Lab

Container-Driven Breakpoints

Pulse Line adapts its tick intervals, latest value badge, and hit target padding dynamically based on available container width.

Desktop
>= 1024px

Full horizontal interval resolution, prominent latest-value pill, spacious margin offsets.

Tablet
640px - 1023px

Adaptive tick thinning (preserving endpoints), compact latest pill, balanced axis footprint.

Mobile
< 640px

Aggressive tick reduction (start and end ticks preserved), latest value inline rail, full touch scrub.

Tablet Preview (768px Container Constraint)
Mobile Preview (390px Container Constraint)

Accessibility & Keyboard Navigation

Pulse Line is fully operable without a mouse:

  1. Focusable Container: Pressing Tab focuses the chart container with a prominent focus ring (var(--chart-focus)).
  2. Keyboard Controls:
    • Advances to the next observation.
    • Moves to the previous observation.
    • Home Jumps to the first visible observation in the current window.
    • End Jumps directly to the latest live observation.
    • Esc Clears active inspection selection.
  3. Controlled Audio Output: Pulse Line intentionally does not announce every incoming stream tick via aria-live, preventing screen-reader audio flooding. Announcements occur only upon explicit user keyboard navigation.
  4. Factual Figure Summary: An invisible <figcaption> provides an automated quantitative overview (observation count, current value, and min/max extremes).
06 / Assistive Technology

Accessibility & Navigation Standards

Screen-reader figure region with programmatic title, quantitative summary, and keyboard inspection.

Semantic Role & Landmark

Container mounts as region with explicit assistive label.

Color-Independent Legibility

Latest terminal dot renders distinct concentric outer ring; tooltips provide explicit numeric values.

Screen Reader Summary

Embeds visually hidden summary (.sr-only) declaring: “VoiceOver and NVDA announce current value, sample count, and min/max extremes without flooding audio on every stream tick.

Reduced Motion Support

Suppresses transitions and renders direct geometric positions when user requests reduced motion.

Keyboard Interaction Model
Keyboard interaction model
KeyAction
TabFocus chart interaction surface with visible focus ring
ArrowLeftSelect previous data observation
ArrowRightSelect next data observation
HomeJump to first data point in visible window
EndJump directly to latest live observation
EscapeClear active selection

Data Safety Guarantee

  1. Zero Fabricated Operational Data: Pulse Line will never generate fake metrics when data is empty or disconnected.
  2. Zero Animation Queue Buildup: In updateMode="direct" (default), rapid telemetry updates apply immediately without queuing transitions that lag behind real-time streams.
  3. Historical Dot Elimination: Historical observation markers remain hidden by default, rendering only the single latest terminal marker to minimize SVG DOM nodes during high-frequency refreshes.
  4. Deterministic Window Slicing: Invalid or non-finite windowSize values fall back safely to rendering all available data without throwing runtime exceptions.
07 / Source Anatomy

Internal Architecture & File Dependencies

Source-first ownership model. Inspect the exact component call tree, dependencies, and full implementation below.

Component Architecture Call Tree
PulseLine(Root figure wrapper)
└──ChartContainer[CSS token bridge]

Scoped CSS variables for axes, grid, and crosshairs without global pollution.

Involved Source Files & Registry Assets
components/charts/recharts/line-pulse.tsx
Primary PulseLine React component implementation
components/charts/shared/chart-container.tsx
CSS variable token bridge and container wrapper
components/charts/shared/chart-tooltip.tsx
Tabular numerical inspection card
components/charts/shared/chart-state.tsx
Loading, empty, and error fallback states
components/charts/shared/use-chart-reduced-motion.ts
prefers-reduced-motion media query hook
registry/recharts/line-pulse.tsx
"use client"import * as React from "react"import {  ResponsiveContainer,  LineChart,  Line,  XAxis,  YAxis,  Tooltip,  CartesianGrid,  Legend,  ReferenceLine,} from "recharts"import { useChartReducedMotion } from "../shared/use-chart-reduced-motion"import { ChartLegend } from "../shared/chart-legend"import { ChartContainer } from "../shared/chart-container"import { ChartTooltip } from "../shared/chart-tooltip"import {  ChartLoadingState,  ChartEmptyState,  ChartErrorState,  ChartUnavailableState,} from "../shared/chart-state"import { cn } from "@/lib/utils"/* -------------------------------------------------------------------------- *//*  Type Definitions                                                          *//* -------------------------------------------------------------------------- */export interface PulseSeriesConfig<TData extends Record<string, unknown> = Record<string, unknown>> {  key: keyof TData & string  label?: string  valueFormatter?: (value: number) => string}export interface PulseReferenceLine {  y: number  label?: string  stroke?: string  strokeDasharray?: string}export interface PulseLineProps<TData extends Record<string, unknown> = Record<string, unknown>> {  /**   * The array of operational data observations to visualize.   * Accepts a readonly array and will never mutate caller data.   */  data: readonly TData[]  /**   * Key for the horizontal axis domain (e.g. timestamp, second, or ordered category).   */  xKey: keyof TData & string  /**   * Key for the numeric metric value to plot.   * Mutually exclusive or fallback to series.key.   */  seriesKey?: keyof TData & string  /**   * Optional semantic series descriptor containing key, label, and formatter.   */  series?: PulseSeriesConfig<TData>  /**   * Rolling window size. When specified, only the latest N observations are rendered.   * Must be a positive finite integer. If omitted, all provided data is displayed.   */  windowSize?: number  /**   * Height of the chart container in pixels or standard CSS string.   * Default: 280   */  height?: number | string  /**   * Curve interpolation for the operational signal line.   * Default: "monotone"   */  curve?: "linear" | "monotone" | "step"  /**   * Explicit Y-axis numeric domain, or "auto" calculation with safe padding.   */  domain?: [number, number] | ["auto", "auto"]  /**   * Tick thinning policy for the horizontal X axis.   * Default: "auto"   */  tickStrategy?: "auto" | "all" | "preserve-start" | "preserve-end" | "preserve-both"  /**   * Whether to display a dedicated terminal marker dot at the latest observation.   * Default: true   */  showLatestPoint?: boolean  /**   * Whether to display a compact numeric pill showing the latest formatted value.   * Default: false   */  showLatestValue?: boolean  /**   * Custom formatter specifically for the latest observation display.   * Falls back to series.valueFormatter or standard locale string.   */  latestValueFormatter?: (value: number) => string  /**   * High-frequency update mode:   * - "direct": Instant geometry updates without animation queue lag (ideal for streaming/rapid telemetry).   * - "transition": Restrained 150ms interpolation for moderate update rates.   * Default: "direct"   */  updateMode?: "direct" | "transition"  /**   * Primary series stroke color.   * Default: "var(--chart-1)"   */  color?: string  /**   * Whether to display subtle horizontal background gridlines.   * Default: true   */  showGrid?: boolean  /**   * Whether to display horizontal X axis tick labels.   * Default: true   */  showXAxis?: boolean  /**   * Whether to display vertical Y axis metric labels.   * Default: true   */  showYAxis?: boolean  /**   * Whether to display the series legend.   * Default: false   */  showLegend?: boolean  /**   * Optional reference threshold rules (e.g. SLO, SLA, target capacity).   */  referenceLines?: readonly PulseReferenceLine[]  /**   * Truthful missing value policy:   * - "gap": Breaks the stroke across null/undefined observations without fabricating zero.   * - "connect": Line draws across the gap to bridge adjacent valid observations.   * Default: "gap"   */  missingValuePolicy?: "gap" | "connect"  /**   * Animation toggle or custom duration.   * Automatically disabled under prefers-reduced-motion.   * Default: true   */  motion?: boolean | { duration?: number }  /**   * Accessible title for screen-reader regions and figures.   * Default: "Pulse Line"   */  title?: string  /**   * Accessible description of the operational signal and frequency.   */  description?: string  /**   * Loading state flag. Renders neutral skeleton preserving layout footprint.   */  loading?: boolean  /**   * Error state or message. Renders actionable error state with retry.   */  error?: Error | string | null  /**   * Unavailable state notice (e.g. stream disconnected or retention limit reached).   */  unavailable?: boolean | string | null  /**   * Custom empty state component override.   */  emptyContent?: React.ReactNode  /**   * Custom loading state component override.   */  loadingContent?: React.ReactNode  /**   * Custom error state component override.   */  errorContent?: React.ReactNode  /**   * Callback invoked when user clicks the error retry trigger.   */  onRetry?: () => void  /**   * Additional CSS class names applied to the root figure wrapper.   */  className?: string}/* -------------------------------------------------------------------------- *//*  Helper Functions                                                          *//* -------------------------------------------------------------------------- */function isFiniteNumber(val: unknown): val is number {  return typeof val === "number" && Number.isFinite(val) && !Number.isNaN(val)}/** * Applies rolling-window slicing on ordered data without mutating caller data. */function applyRollingWindow<TData>(  data: readonly TData[],  windowSize?: number): readonly TData[] {  if (typeof windowSize !== "number" || !Number.isFinite(windowSize) || windowSize <= 0) {    return data  }  const size = Math.floor(windowSize)  if (data.length <= size) {    return data  }  return data.slice(-size)}/** * Normalizes dataset without mutating caller data: * - Drops invalid non-finite numbers (NaN, Infinity) * - Converts missing points to null for truthful gap rendering */function normalizePulseData<TData extends Record<string, unknown>>(  data: readonly TData[],  xKey: string,  valueKey: string,  missingPolicy: "gap" | "connect"): Record<string, unknown>[] {  const normalized: Record<string, unknown>[] = []  for (let i = 0; i < data.length; i++) {    const raw = data[i]    const rawVal = raw[valueKey]    const xVal = raw[xKey] ?? `Sample ${i + 1}`    let cleanVal: number | null = null    if (isFiniteNumber(rawVal)) {      cleanVal = rawVal    } else if (rawVal === null || rawVal === undefined) {      cleanVal = null    } else {      cleanVal = null    }    normalized.push({      ...raw,      [xKey]: xVal,      [valueKey]: cleanVal,    })  }  return normalized}/** * Calculates a safe numeric Y-domain preventing zero-height division errors * and handling single-value or zero-only signals deterministically. */function calculateSafeDomain(  data: readonly Record<string, unknown>[],  valueKey: string,  explicitDomain?: [number, number] | ["auto", "auto"]): [number, number] | ["auto", "auto"] {  if (explicitDomain) {    return explicitDomain  }  const validValues: number[] = []  for (const item of data) {    const v = item[valueKey]    if (isFiniteNumber(v)) {      validValues.push(v)    }  }  if (validValues.length === 0) {    return [0, 100]  }  const min = Math.min(...validValues)  const max = Math.max(...validValues)  // Single-value domain expansion (Section 28, 29)  if (min === max) {    if (min === 0) {      return [-1, 1]    }    if (min > 0) {      return [Math.floor(min * 0.9), Math.ceil(min * 1.1)]    }    return [Math.floor(min * 1.1), Math.ceil(min * 0.9)]  }  // Padding extent by 5%  const span = max - min  const pad = span * 0.05  return [min >= 0 ? Math.max(0, Math.floor(min - pad)) : Math.floor(min - pad), Math.ceil(max + pad)]}/* -------------------------------------------------------------------------- *//*  Main Component                                                            *//* -------------------------------------------------------------------------- */export function PulseLine<TData extends Record<string, unknown> = Record<string, unknown>>({  data = [],  xKey,  seriesKey,  series,  windowSize,  height = 280,  curve = "monotone",  domain,  tickStrategy = "auto",  showLatestPoint = true,  showLatestValue = false,  latestValueFormatter,  updateMode = "direct",  color = "var(--chart-1)",  showGrid = true,  showXAxis = true,  showYAxis = true,  showLegend = false,  referenceLines,  missingValuePolicy = "gap",  motion = true,  title = "Pulse Line",  description,  loading = false,  error = null,  unavailable = null,  emptyContent,  loadingContent,  errorContent,  onRetry,  className,}: PulseLineProps<TData>) {  const activeSeriesKey = (series?.key ?? seriesKey ?? "value") as string  const activeSeriesLabel = series?.label ?? "Signal"  const valueFormatter = series?.valueFormatter  const reducedMotion = useChartReducedMotion()  const instanceId = React.useId()  const titleId = `pulse-title-${instanceId}`  const summaryId = `pulse-summary-${instanceId}`  // Keyboard navigation active index  const [activeIndex, setActiveIndex] = React.useState<number | null>(null)  // Sliced rolling window  const windowedData = applyRollingWindow(data, windowSize)  // Normalized safe data  const safeData = normalizePulseData(windowedData, xKey, activeSeriesKey, missingValuePolicy)  const safeDomain = calculateSafeDomain(safeData, activeSeriesKey, domain)  // Find last valid observation index for latest terminal marker  let lastValidIndex = -1  let latestNumericValue: number | null = null  for (let i = safeData.length - 1; i >= 0; i--) {    const val = safeData[i][activeSeriesKey]    if (isFiniteNumber(val)) {      lastValidIndex = i      latestNumericValue = val      break    }  }  // Format latest value  const latestFormattedValue = React.useMemo(() => {    if (latestNumericValue === null) return null    if (latestValueFormatter) return latestValueFormatter(latestNumericValue)    if (valueFormatter) return valueFormatter(latestNumericValue)    return latestNumericValue.toLocaleString()  }, [latestNumericValue, latestValueFormatter, valueFormatter])  // Factual screen-reader summary (Section 55: factual statements only, no business conclusions)  const validValues = safeData    .map((d) => d[activeSeriesKey])    .filter((v): v is number => isFiniteNumber(v))  const factualSummary = React.useMemo(() => {    if (validValues.length === 0) return "No valid numeric observations recorded."    const count = validValues.length    const min = Math.min(...validValues)    const max = Math.max(...validValues)    const current = validValues[validValues.length - 1]    const fmt = valueFormatter ?? ((n: number) => n.toLocaleString())    const curStr = fmt(current)    const minStr = fmt(min)    const maxStr = fmt(max)    return `${count} observations. Current value ${curStr}. Minimum ${minStr}. Maximum ${maxStr}.`  }, [validValues, valueFormatter])  // Motion config: In direct updateMode, no animation queue lag  const isAnimated = motion !== false && !reducedMotion && updateMode === "transition"  const animationDuration =    typeof motion === "object" && motion?.duration !== undefined ? motion.duration * 1000 : 150  // Tick interval calculation based on strategy  const tickInterval = React.useMemo(() => {    if (tickStrategy === "all") return 0    if (tickStrategy === "preserve-start") return "preserveStart"    if (tickStrategy === "preserve-end") return "preserveEnd"    if (tickStrategy === "preserve-both") return "preserveStartEnd"    // "auto": compact operational spacing    if (safeData.length > 40) return Math.ceil(safeData.length / 6)    if (safeData.length > 20) return Math.ceil(safeData.length / 4)    return "preserveStartEnd"  }, [tickStrategy, safeData.length])  if (error) {    const message = typeof error === "string" ? error : error.message || "Failed to load signal"    if (errorContent) return <div className={cn("w-full", className)} style={{ height }}>{errorContent}</div>    return <div className={cn("w-full", className)} style={{ height }}><ChartErrorState title="Unable to load signal" description={message} onRetry={onRetry} /></div>  }  if (unavailable) {    const message = typeof unavailable === "string" ? unavailable : "This metric stream is currently unavailable."    return <div className={cn("w-full", className)} style={{ height }}><ChartUnavailableState title="Signal stream unavailable" description={message} /></div>  }  if (loading) {    if (loadingContent) return <div className={cn("w-full", className)} style={{ height }}>{loadingContent}</div>    return <div className={cn("w-full", className)} style={{ height }}><ChartLoadingState title="Connecting to telemetry stream..." description="Preparing rolling window and scaling signal axes" /></div>  }  if (data.length === 0) {    if (emptyContent) return <div className={cn("w-full", className)} style={{ height }}>{emptyContent}</div>    return <div className={cn("w-full", className)} style={{ height }}><ChartEmptyState title="No telemetry yet" description="Signal values will appear when observations are recorded." /></div>  }  // Keyboard navigation across observations (Section 51, 52: End returns to latest signal)  const handleKeyDown = (e: React.KeyboardEvent) => {    if (safeData.length === 0) return    if (e.key === "ArrowRight") {      e.preventDefault()      setActiveIndex((prev) => (prev === null ? 0 : Math.min(safeData.length - 1, prev + 1)))    } else if (e.key === "ArrowLeft") {      e.preventDefault()      setActiveIndex((prev) => (prev === null ? safeData.length - 1 : Math.max(0, prev - 1)))    } else if (e.key === "Home") {      e.preventDefault()      setActiveIndex(0)    } else if (e.key === "End") {      e.preventDefault()      setActiveIndex(safeData.length - 1)    } else if (e.key === "Escape") {      e.preventDefault()      setActiveIndex(null)    }  }  const defaultFormatter = (val: number | string) => {    if (typeof val === "number" && isFiniteNumber(val)) {      return valueFormatter ? valueFormatter(val) : val.toLocaleString()    }    return String(val ?? "—")  }  // Custom dot renderer: renders terminal marker for latest point only (Section 6, 7)  const renderTerminalDot = (dotProps: any) => {    const { cx, cy, index } = dotProps    if (index === lastValidIndex && showLatestPoint && isFiniteNumber(cx) && isFiniteNumber(cy)) {      return (        <g key={`pulse-terminal-${index}`} className="pointer-events-none">          {/* Subtle outer halo */}          <circle            cx={cx}            cy={cy}            r={7}            fill="none"            stroke={color}            strokeOpacity={0.35}            strokeWidth={1.5}          />          {/* Core terminal dot */}          <circle            cx={cx}            cy={cy}            r={3.5}            fill={color}            stroke="var(--chart-background)"            strokeWidth={1.5}          />        </g>      )    }    return <React.Fragment key={`dot-${index}`} />  }  return (    <figure      role="region"      aria-labelledby={titleId}      aria-describedby={summaryId}      tabIndex={0}      onKeyDown={handleKeyDown}      className={cn(        "group relative flex flex-col w-full outline-none focus-visible:ring-2 focus-visible:ring-[var(--chart-focus)] rounded-xl transition-all",        className      )}      style={{ height, minHeight: typeof height === "number" ? height : 300 }}    >      {/* Optional Latest Value Header Rail */}      {showLatestValue && latestFormattedValue && (        <div className="flex items-center justify-between px-1 pb-2 text-xs font-mono select-none">          <span className="text-muted-foreground uppercase tracking-widest text-[10px] font-semibold">            {activeSeriesLabel} · LATEST          </span>          <span className="font-semibold text-foreground bg-muted border border-border px-2 py-0.5 rounded text-[11px]">            {latestFormattedValue}          </span>        </div>      )}      {/* Screen Reader Accessible Descriptions */}      <figcaption className="sr-only">        <h3 id={titleId}>{title}</h3>        {description && <p>{description}</p>}        <p id={summaryId}>{factualSummary}</p>      </figcaption>      {/* Chart Canvas */}      <ChartContainer        config={{          [activeSeriesKey]: {            label: activeSeriesLabel,            color,          },        }}        className="w-full h-full flex-1"      >        <ResponsiveContainer          width="100%"          height="100%"          minWidth={0}          minHeight={0}          initialDimension={{ width: 320, height: typeof height === "number" ? height : 300 }}        >          <LineChart            data={safeData}            margin={{ top: 8, right: 12, left: -16, bottom: 4 }}          >            {showGrid && (              <CartesianGrid                strokeDasharray="3 3"                vertical={false}                stroke="var(--chart-grid)"              />            )}            <XAxis              hide={!showXAxis}              dataKey={xKey as any}              tickLine={false}              axisLine={false}              interval={tickInterval}              tick={{ fontSize: 11, fill: "var(--chart-axis)" }}              dy={6}            />            <YAxis              hide={!showYAxis}              domain={safeDomain as any}              tickLine={false}              axisLine={false}              tick={{ fontSize: 11, fill: "var(--chart-axis)" }}              tickFormatter={valueFormatter ? (v) => valueFormatter(Number(v)) : undefined}              dx={-4}            />            <Tooltip              content={                <ChartTooltip                  indicator="line"                  formatter={(val) => defaultFormatter(val)}                  labelFormatter={(label) => label}                  compact={typeof height === "number" ? height <= 260 : false}                />              }              cursor={{                stroke: "var(--chart-crosshair)",                strokeDasharray: "3 3",                strokeWidth: 1.2,              }}            />            {/* Optional Reference Threshold Lines */}            {referenceLines?.map((ref, idx) => (              <ReferenceLine                key={`ref-line-${idx}`}                y={ref.y}                label={                  ref.label                    ? {                        value: ref.label,                        position: "insideTopRight",                        fill: "var(--chart-muted-foreground)",                        fontSize: 10,                      }                    : undefined                }                stroke={ref.stroke ?? "var(--chart-muted-foreground)"}                strokeDasharray={ref.strokeDasharray ?? "4 4"}                strokeOpacity={0.6}              />            ))}            {showLegend && (              <Legend                verticalAlign="top"                align="right"                iconType="circle"                wrapperStyle={{ paddingBottom: 8, fontSize: 12 }}              />            )}            <Line              type={curve}              dataKey={activeSeriesKey as any}              stroke={color}              strokeWidth={1.75}              connectNulls={missingValuePolicy === "connect"}              isAnimationActive={isAnimated}              animationDuration={animationDuration}              dot={renderTerminalDot}              activeDot={{                r: 4.5,                fill: color,                stroke: "var(--chart-background)",                strokeWidth: 2,              }}            />          </LineChart>        </ResponsiveContainer>      </ChartContainer>      {/* Screen reader notification only on explicit keyboard navigation */}      <div className="sr-only" aria-live="polite">        {activeIndex !== null && safeData[activeIndex] && (          <span>            Selected observation {activeIndex + 1} of {safeData.length}: {String(safeData[activeIndex][xKey])},{" "}            {defaultFormatter(safeData[activeIndex][activeSeriesKey] as number)}          </span>        )}      </div>    </figure>  )}