Area Chart

Filled variation of the line chart that emphasises cumulative magnitude under the curve.

npm install @plocks/charts

Basics

Simple random data area chart with title.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { WEEKLY_SIGNUPS } from './data'; export function Demo() { return ( <AreaChart title="Weekly signups" subtitle="Organic vs virality" h={240} data={WEEKLY_SIGNUPS} xAxis={{ show: true, labelFormatter: (value: number) => `Week ${value + 1}`, }} yAxis={{ show: true, labelFormatter: (value: number) => `${value} users`, }} grid={{ show: true, style: 'dashed' }} tooltip={{ show: true }} enableCrosshair liveTooltip /> ); }

Reference marks

Areas, lines and dots placed in data coordinates; AreaChart accepts the same reference props as LineChart.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { ACTIVE_USERS } from './data'; export function Demo() { return ( <AreaChart title="Daily active users" h={300} data={ACTIVE_USERS} showPoints={false} referenceAreas={[{ x1: 5, x2: 7, color: '#8b5cf6', label: 'Launch week' }]} referenceLines={[{ y: 4, label: 'Goal 4M', color: '#f59e0b', dashed: true }]} referenceDots={[{ x: 11, y: 4.4, r: 6, color: '#8b5cf6', label: 'Record' }]} xAxis={{ show: true, labelFormatter: (value) => `W${Math.round(value) + 1}` }} yAxis={{ show: true, labelFormatter: (value) => `${value}M` }} grid={{ show: true }} /> ); }

Stacked reference marks

Reference areas, lines and dots on a stacked layout, placed against the stack totals.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { SIGNUP_SERIES } from './data'; export function Demo() { return ( <AreaChart title="Signups by channel" h={320} series={SIGNUP_SERIES} layout="stacked" referenceAreas={[{ x1: 5, x2: 7, color: '#8b5cf6', label: 'Campaign' }]} referenceLines={[{ y: 40, label: 'Target 40k', color: '#ef4444', dashed: true }]} referenceDots={[{ x: 11, y: 50, r: 6, color: '#8b5cf6', label: 'Peak' }]} xAxis={{ show: true, labelFormatter: (value) => `W${Math.round(value) + 1}` }} yAxis={{ show: true, labelFormatter: (value) => `${value}k` }} grid={{ show: true }} legend={{ show: true, position: 'bottom' }} /> ); }

Streamgraph

layout="stream" centers the stack on a moving baseline. The y axis is hidden by default; tooltips show each series' own value.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { LISTENING_SERIES, MONTHS } from './data'; export function Demo() { return ( <AreaChart title="Listening hours by genre" h={320} series={LISTENING_SERIES} layout="stream" areaOpacity={0.8} xAxis={{ show: true, labelFormatter: (value) => MONTHS[Math.round(value)] ?? '' }} legend={{ show: true, position: 'bottom' }} enableCrosshair multiTooltip liveTooltip /> ); }

Brush

withBrush works in every layout; here the stacked layers follow the selected window.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { SERIES } from './data'; export function Demo() { return ( <AreaChart h={340} layout="stacked" series={SERIES} withBrush brushProps={{ start: 360, end: 539 }} xAxis={{ show: true, labelFormatter: (value) => `D${value}` }} yAxis={{ show: true }} /> ); }

Inventory Levels Warehouses

Loading demo…

import { AreaChart } from '@plocks/charts'; import { INVENTORY_SERIES, formatMonth } from './data'; export function Demo() { return ( <AreaChart title="Inventory Levels by Warehouse" subtitle="Safety stock adjustments across the first half" h={420} series={INVENTORY_SERIES} smooth={false} grid={{ show: true, style: 'solid' }} legend={{ show: true, position: 'bottom', align: 'center' }} tooltip={{ show: true, formatter: (point) => { const label = formatMonth(Math.round(point.x)); return `${label} • ${point.data?.warehouse ?? 'Warehouse'}: ${Math.round(point.y)}k units`; }, }} xAxis={{ show: true, title: '2025 timeline', labelFormatter: (value: number) => formatMonth(Math.round(value)), }} yAxis={{ show: true, title: 'Inventory on hand (thousands)', labelFormatter: (value: number) => `${Math.round(value)}k`, }} enableCrosshair liveTooltip /> ); }

Mobile Device Sessions

Loading demo…

import { AreaChart } from '@plocks/charts'; import { PHASE_LABELS, SESSION_SERIES } from './data'; const formatPhase = (index: number) => PHASE_LABELS[index] ?? `Week ${index + 1}`; export function Demo() { return ( <AreaChart title="Active Sessions During Launch" subtitle="Layered by device platform" h={420} series={SESSION_SERIES} smooth grid={{ show: true, style: 'solid' }} legend={{ show: true, position: 'bottom', align: 'center' }} enableSeriesToggle tooltip={{ show: true, formatter: (point) => { const label = formatPhase(Math.round(point.x)); const channel = point.data?.label ?? 'Sessions'; return `${label} • ${channel}: ${Math.round(point.y)}k`; }, }} xAxis={{ show: true, title: 'Launch timeline', labelFormatter: (value: number) => formatPhase(Math.round(value)), }} yAxis={{ show: true, title: 'Daily sessions (thousands)', labelFormatter: (value: number) => `${Math.round(value)}k`, }} enableCrosshair liveTooltip /> ); }

Renewable Energy Mix

Stacks monthly solar, wind, and hydro production to highlight how policy shifts increase clean generation share over the first half of 2025.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { MONTH_LABELS, RENEWABLE_SERIES } from './data'; const formatMonth = (index: number) => MONTH_LABELS[index] ?? `M${index + 1}`; export function Demo() { return ( <AreaChart layout="stacked" title="Renewable Energy Generation" subtitle="Utility-scale output by source" h={420} series={RENEWABLE_SERIES} smooth grid={{ show: true, style: 'dashed' }} legend={{ show: true, position: 'bottom', align: 'center' }} xAxis={{ show: true, title: 'Month of 2025', labelFormatter: (value: number) => formatMonth(Math.round(value)), }} yAxis={{ show: true, title: 'Generation (GWh)', labelFormatter: (value: number) => `${Math.round(value)} GWh`, }} enableCrosshair liveTooltip /> ); }

Streaming Minutes Campaign

Story focus
  • Tracks how a marketing push shifts audience attention across Originals, TV, film, and live sports week-by-week.

  • Highlights the share-based stack so teams can see when new content overtakes legacy catalog minutes.

  • Surfaces total minute contribution per category inside the tooltip for quick campaign readouts.

Key settings
  • Uses layout="stackedPercentage" to normalize each week to 100% share.
  • Keeps dashed gridlines and a centered legend for comparative scanning.

  • Custom tooltip blends absolute minutes with share-of-week for richer context.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { STREAMING_SERIES, WEEK_TOTALS, formatWeek } from './data'; export function Demo() { return ( <AreaChart title="Streaming Minutes During Campaign" subtitle="Share of viewing time by content category" h={420} series={STREAMING_SERIES} layout="stackedPercentage" stackOrder="normal" areaOpacity={0.6} smooth grid={{ show: true, style: 'dashed' }} legend={{ show: true, position: 'bottom', align: 'center' }} tooltip={{ show: true, formatter: (point) => { const index = Math.round(point.x); const label = formatWeek(index); const minutes = point.data?.minutes ?? 0; const total = WEEK_TOTALS[index] ?? 0; const share = total > 0 ? (minutes / total) * 100 : 0; return `${label} • ${point.data?.category ?? 'Content'}: ${minutes}M min (${share.toFixed(1)}%)`; }, }} xAxis={{ show: true, title: 'Campaign cadence', labelFormatter: (value: number) => formatWeek(Math.round(value)), }} yAxis={{ show: true, title: 'Share of weekly minutes', labelFormatter: (value: number) => `${Math.round(value * 100)}%`, }} enableCrosshair liveTooltip /> ); }

Support Severity Over Time

Story focus
  • Demonstrates how stacked areas surface the composition of weekly ticket inflow by severity level.

  • Highlights declining critical volume while medium issues remain the majority of support demand.

  • Emphasizes stability gains after mid-quarter improvements.

Key settings
  • Uses the AreaChart layout="stacked" mode to visually sum severities per week.
  • Enables dashed grid lines and a bottom legend for quick reference.

  • Applies a week-aware xAxis.labelFormatter that translates series indices into friendly timeline labels.

Loading demo…

import { AreaChart } from '@plocks/charts'; import { SEVERITY_SERIES, WEEKS } from './data'; const formatWeek = (index: number) => WEEKS[index] ?? `Week ${index + 1}`; export function Demo() { return ( <AreaChart title="Quarterly Support Ticket Mix" subtitle="Stacked by severity level" h={420} series={SEVERITY_SERIES} layout="stacked" smooth grid={{ show: true, style: 'dashed' }} legend={{ show: true, position: 'bottom', align: 'center' }} xAxis={{ show: true, title: 'Quarter timeline', labelFormatter: (value: number) => formatWeek(Math.round(value)), }} yAxis={{ show: true, title: 'Tickets created', labelFormatter: (value: number) => `${Math.round(value)}`, }} enableCrosshair liveTooltip /> ); }
Scan to open this page on your phoneplocks.dev/charts/AreaChart