031 / GOOGLE CHARTS / LINE
Google Core Line Chart
Google Visualization corechart line with dark theme styling, smooth spline interpolation, and singleton loader deduplication.
- SPEC
- #031
- ENGINE
- Google Charts
- FAMILY
- Line
- RENDERER
- google-runtime
- STATUS
- stable
Installation
Checking public registry…
View local registry JSONCopied as source. No Plotcn runtime required.
- BEST FOR
- Time-series continuous trends, financial telemetry, and Google ecosystem dashboards
- DATA MODEL
- Categorical / Temporal X-axis label + Numeric continuous Y value
- INTERACTION
- Hover datum focus crosshair, automatic dark glass tooltip
- RESPONSIVE
- Container-driven via ResizeObserver with frame-synced redraw
- ANIMATION
- Google native easing transition on initial mount and update
- RUNTIME
- Google Visualization corechart (cdn.gstatic.com, lazy-loaded)
Basic & Interactive Integration
Import GoogleLine directly into your React client component. Provide an array of observations conforming to the data shape.
Requires a client context ('use client') for DOM lifecycle and container measurement.
Input Schema & Coordinates
Expects an array of objects. By default, records require a label (string/date) and a value (number). Keys are fully customizable via labelKey and valueKey.
| Field | Type | Required | Meaning |
|---|---|---|---|
label | string | number | Date | Yes | Domain coordinate for the horizontal axis. Formatted as category or timestamp. |
value | number | Yes | Metric magnitude mapped to vertical coordinate. Finite positive or negative numbers. |
[key: string] | any | No | Additional metadata keys (e.g. metadata tooltip, category tag) passed safely without interfering. |
Null or undefined values produce a line gap. Missing points do not crash the visualization.
Records should be ordered monotonically by X-axis coordinate to ensure contiguous left-to-right drawing.
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.
<GoogleLine
data={data}
xKey="date"
seriesKey="value"
/>Controls curve interpolation geometry. 'function' produces a smooth spline; 'none' draws straight linear segments.
curveType="function"Default: "function"Radius in pixels of individual data point markers along the line. Set to 0 to show line only.
pointSize={0}Default: 0Toggles visibility of horizontal background gridlines on the vertical numeric axis.
showGrid={true}Default: truePrimary theme stroke color. Accepts CSS variables (e.g. var(--chart-2)) or valid hex/rgb strings.
color="#10b981"Default: "var(--chart-1, #10b981)"| Property | Type | Default | Required | Description |
|---|---|---|---|---|
dataReq | GoogleLineDatum[] | — | Yes | Array of structured data records to bind to the Google Visualization DataTable. Best for: Primary dataset source |
curveTypeOpt | "function" | "none" | "function" | No | Controls curve interpolation geometry. 'function' produces a smooth spline; 'none' draws straight linear segments. Best for: Continuous smooth metric trends (function) or discrete financial step trends (none) |
pointSizeOpt | number | 0 | No | Radius in pixels of individual data point markers along the line. Set to 0 to show line only. Best for: Highlighting individual discrete observations (e.g. 5) vs clean minimalist lines (0) |
showGridOpt | boolean | true | No | Toggles visibility of horizontal background gridlines on the vertical numeric axis. Best for: Aiding value readability across wide containers |
colorOpt | string | "var(--chart-1, #10b981)" | No | Primary theme stroke color. Accepts CSS variables (e.g. var(--chart-2)) or valid hex/rgb strings. Best for: Brand color harmonization and multi-chart dashboards |
heightOpt | number | string | 320 | No | Total height of the chart container in pixels or CSS units. Best for: Dashboard cards and full-width analytics rows |
labelKeyOpt | string | "label" | No | Key name in data objects corresponding to the horizontal axis category or date. Best for: Mapping custom API payloads without client-side reshaping |
valueKeyOpt | string | "value" | No | Key name in data objects corresponding to the vertical numeric value. Best for: Selecting specific metric columns from normalized records |
classNameOpt | string | undefined | No | Tailwind CSS classes or custom stylesheet class applied to the outer figure container. |
Component Variants & Edge States
Production cookbooks showcasing configuration variants alongside verified handling of loading, empty data, and network error states.
Smooth Spline (Default)
Continuous metric visualization using Google's function spline interpolation.
Linear Line with Point Markers
Straight line interpolation with highlighted 5px circular markers at each observation.
Clean Gridless Sparkline
Minimalist presentation with gridlines suppressed for clean telemetry cards.
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
Uses a ResizeObserver on the container element. When dimensions change, Google Line recalculates SVG coordinate paths to match parent bounds.
Full horizontal grid span, 85% width chart area, all categorical X-axis labels rendered.
Chart area automatically adjusts; axis labels rotate or decimate if space constraints require.
Tightened margins, touch-friendly tap targets, single-column dashboard layout compatibility.
Accessibility & Navigation Standards
Encapsulated within semantic HTML5 <figure> with explicit region landmark, assistive screen-reader summary paragraph, and color-contrast verified typography.
Container mounts as figure[role="region"] with aria-label with explicit assistive label.
Line geometry is complemented by coordinate axis baseline and optional distinct point markers to avoid reliance on color hue alone.
Embeds visually hidden summary (.sr-only) declaring: “Line chart rendered with Google Charts corechart package displaying trend values.”
Honors prefers-reduced-motion by suppressing transition duration.
| Key | Action |
|---|---|
| Tab | Focus chart container and navigate through interactive regions. |
| Escape | Dismiss active tooltip overlay or popover inspector. |
Internal Architecture & File Dependencies
Source-first ownership model. Inspect the exact component call tree, dependencies, and full implementation below.
Semantic <figure> providing glassmorphic loading spinner, error fallback, and accessibility tags.
Async loader ensuring https://www.gstatic.com/charts/loader.js is fetched at most once across the application.
Google's LineChart class drawing vector paths onto the measured container div.