GrowthChart
<co-growth-chart>GrowthChart plots a child’s measurements against WHO (birth to 24 months) or CDC (2 to 20 years) percentile lines and names the percentile band of every point.
import { GrowthChart } from 'health-components';
Examples
Cdc Bmi Above95th
Legacy Percentiles
Usage
<GrowthChart standard="cdc" measure="bmi" points={[[8, 17.2, "03/2022"], [10, 19.8, "03/2024"]]} curves={cdcBmiBoys} />
When to use
- Well-child visits, failure to thrive and obesity follow-up, endocrine and nutrition clinics.
When not to use
- Preterm infants before 2 years corrected: a Fenton chart.
- Adult weight trends: LineChart.
Variants and states
| Variant | What it is |
|---|---|
| WHO 0-2 | Weight-for-age in kg to 0.01, ages in months, 3rd to 97th lines. |
| CDC 2-20 | BMI-for-age in kg/m² to 0.1, ages in years, 5th to 95th lines. |
| edge lines | Outer percentiles in warning colour; 50th solid. |
| band badge | Latest point: "Between the 50th and 85th" (success) or above or below the outer lines (warning). |
| table | Every plotted point with date, age, value and band. |
Clinical values
Every number goes through the shared clinical value rules (CareOS.fmt and ClinicalValue from the clinical-values card): tabular digits, the unit always shown, a fixed precision per measure, the reference range in the tooltip, and H, L or critical flags. Medication amounts follow the ISMP dose style through fmt.doseNumber: rounded to the stated precision, then shown with no trailing zero (5 mg, never 5.0 mg) and a leading zero (0.5 mL). The specialty measures this card adds sit in CareOS.specialty.MEAS with their precision: infant weight 2 decimals kg, BMI 1 decimal kg/m². Ranges in the previews are sample values for the design system, not clinical guidance; a real deployment passes its own.
Accessibility
- The SVG label lists every point; each point also has a title.
- The band is stated in words in a badge and in the table.
- The 50th line is solid, others dashed, so they differ without colour.
Do and don't
- Do: Pick WHO under 2 years and CDC from 2 years.
- Do: Plot every measurement, not only the latest.
- Don't: State an exact percentile from the drawn lines.
- Don't: Ship the sample curves.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
standard | GrowthStandard | uncontrolled | Standard shown (controlled): 'who' | 'cdc' |
defaultStandard | GrowthStandard | 'who' | First standard shown (uncontrolled) |
measure | 'weight' | 'bmi' | (string & {}) | 'weight' | 'weight' | 'bmi' | string: picks the built-in curve |
sex | 'male' | 'female' | 'male' | 'male' | 'female': picks the built-in curve |
points | ReadonlyArray<GrowthPoint> | [] | Array<[age, value, date?]> |
curves | GrowthCurves | the built-in sample for standard, measure and sex | {unit, ages, ageUnit, lines, title} |
onStandardChange | (standard: GrowthStandard) => void | none | Called with the new standard; the parent passes the matching `curves`. Without it, custom curves hide the switch |
title | string | the curves' title | Card title |
subtitle | string | none | Line under the title |
note | ReactNode | how percentile bands are read | Note under the table |
rangeContext | RangeContextId | the global context, else 'outpatient' | Which shared reference range flags use; the lab range on a result still wins |
percentiles | Readonly<Record<string, ReadonlyArray<number>>> | — | Legacy (use `curves`): Record<percentile, value per age in `ages`>, ages in months |
ages | ReadonlyArray<number> | [0,6,12,18,24,36] | Legacy (use `curves`): ages in months of `percentiles` |
min | number | from the data | Legacy: bottom of the y axis |
max | number | from the data | Legacy: top of the y axis |
unit | string | — | Legacy (use `curves.unit`): unit label of the values ('kg') |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-growth-chart>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
<co-growth-chart standard="…" default-standard="…" [measure]="measure" (co-standard-change)="onStandardChange($event.detail)"></co-growth-chart>
| Kind | Name | Description |
|---|---|---|
| attribute | standard | Standard shown (controlled): 'who' | 'cdc'; default uncontrolled |
| attribute | default-standard / defaultStandard | First standard shown (uncontrolled); default 'who' |
| property / JSON attribute | measure | 'weight' | 'bmi' | string: picks the built-in curve; default 'weight' |
| attribute | sex | 'male' | 'female': picks the built-in curve; default 'male' |
| property / JSON attribute | points | Array<[age, value, date?]>; default [] |
| property / JSON attribute | curves | {unit, ages, ageUnit, lines, title}; default the built-in sample for standard, measure and sex |
| attribute | title | Card title; default the curves' title |
| attribute | subtitle | Line under the title; default none |
| attribute | range-context / rangeContext | Which shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient' |
| property / JSON attribute | percentiles | Legacy (use `curves`): Record<percentile, value per age in `ages`>, ages in months |
| property / JSON attribute | ages | Legacy (use `curves`): ages in months of `percentiles`; default [0,6,12,18,24,36] |
| attribute | min | Legacy: bottom of the y axis; default from the data |
| attribute | max | Legacy: top of the y axis; default from the data |
| attribute | unit | Legacy (use `curves.unit`): unit label of the values ('kg') |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-standard-change | Called with the new standard; the parent passes the matching `curves`. Without it, custom curves hide the switch; default none (React: onStandardChange) |
| slot | note | Note under the table; default how percentile bands are read Plain text also works as the `note` attribute. |