# AreaChart Show how one or more quantities change across ordered categories. Each series draws a line with a filled area underneath. [Interactive guide](/docs/components/areachart) · Forge 3.2.0 Use the API for your installed version. Run `npx --no-install wss3-forge api --json` inside the project. ## Implementation guidance ### When to use it Use AreaChart for an ordered trend whose filled area communicates magnitude. ### How to compose it Keep categories ordered and use matching row and series keys. Use a zero baseline for magnitude and preserve missing readings as null. ### What to verify Verify the plot and tooltip distinguish a measured zero from a gap. Add an exact-value table if the user needs to compare individual readings. ## Usage ```tsx import { AreaChart } from 'wss3-forge' import type { AreaChartProps, ChartDatum } from 'wss3-forge' ``` - Keep category rows in reading order. Each series uses the same category axis and its own value key. - Include a row with null for a missing reading so the affected area breaks at that category. A measured zero stays in the series. - Use a baseline of zero when the filled area conveys magnitude. Supply an explicit domain when comparing charts with the same scale. - Include a useful summary. Use the arrow keys or tap a category to inspect both series. Add showTable when readers need a structured list of values. ```tsx ``` ## Runnable examples ### Reservoir levels with a missing reading ```tsx import { AreaChart } from 'wss3-forge' import type { ChartDatum } from 'wss3-forge' const waterLevels: ChartDatum[] = [ { label: 'Monday', values: { north: 53, south: 47 } }, { label: 'Tuesday', values: { north: 62, south: 51 } }, { label: 'Wednesday', values: { north: null, south: 54 } }, { label: 'Thursday', values: { north: 70, south: 60 } }, { label: 'Friday', values: { north: 66, south: 64 } }, ] export default function Example() { return ( `${value}%` }} />) } ``` ## Root package API ### AreaChart Show how one or more quantities change across ordered categories. Each series draws a line with a filled area underneath. Props type: `AreaChartProps` - `series` — `readonly Omit[]` Each item supplies the key, label, color, unit or formatter for an area. - `className?` — `string` - `style?` — `CSSProperties` - `title` — `string` - `width?` — `number | string` - `data` — `readonly ChartDatum[]` Ordered categories with values keyed by series. - `summary?` — `string` - `headerAction?` — `ReactNode` Place a control beside the caption; it wraps beneath the caption on narrow surfaces. - `domain?` — `ChartDomain` Use a shared minimum and maximum when comparing charts. - `barLayout?` — `ChartBarLayout` Options `"grouped"`, `"stacked"`, `"percent"`. Place bars side by side, stack values by sign, or normalize each side to 100%. - `interpolation?` — `'linear' | 'step'` Default `'linear'`. Options `"linear"`, `"step"`. Connect line and area points directly or step halfway between categories. - `areaFill?` — `'solid' | 'gradient'` Default `'solid'`. Options `"solid"`, `"gradient"`. Fill area marks with a constant tint or a vertical fade. - `thresholds?` — `readonly ChartThreshold[]` - `xAxis?` — `ChartCategoryAxisOptions` - `yAxis?` — `ChartValueAxisOptions` - `height?` — `number` - `showLegend?` — `boolean` - `showTooltip?` — `boolean` - `showTable?` — `boolean` Default `false`. Offer a disclosure with the source values. - `emptyLabel?` — `string` - `categoryLabel?` — `string` ## Related types ```ts export interface ChartSeries { key: string label?: string kind?: 'bar' | 'line' | 'area' color?: string unit?: string formatValue?: (value: number) => string } export interface ChartDatum { label: string values: Readonly> } export type ChartDomain = readonly [min: number, max: number] export type ChartBarLayout = 'grouped' | 'stacked' | 'percent' export interface ChartThreshold { value: number label: string color?: string } export interface ChartCategoryAxisOptions { label?: string showLabels?: boolean formatLabel?: (label: string) => string } export interface ChartValueAxisOptions { label?: string showLabels?: boolean showGrid?: boolean tickCount?: number formatValue?: (value: number) => string } export interface AreaChartProps extends Omit { series: readonly Omit[] } export interface CartesianChartProps { data: readonly ChartDatum[] series: readonly ChartSeries[] title: string summary?: string /** Place a control beside the caption; it wraps beneath the caption on narrow surfaces. */ headerAction?: ReactNode domain?: ChartDomain /** Place bars side by side, stack values by sign, or normalize each side to 100%. */ barLayout?: ChartBarLayout /** Connect line and area points directly or step halfway between categories. @default 'linear' */ interpolation?: 'linear' | 'step' /** Fill area marks with a constant tint or a vertical fade. @default 'solid' */ areaFill?: 'solid' | 'gradient' thresholds?: readonly ChartThreshold[] xAxis?: ChartCategoryAxisOptions yAxis?: ChartValueAxisOptions width?: number | string height?: number showLegend?: boolean showTooltip?: boolean /** Offer a disclosure with the source values. @default false */ showTable?: boolean emptyLabel?: string categoryLabel?: string className?: string style?: CSSProperties } ```