Growth chart
The height or weight of a child among percentile curves. Good for paediatric visits and child health records.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'growth',
unit: 'cm',
yLabel: 'Height (cm)',
ages: [0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60],
curves: [
{ name: 'P3', data: [45.5, 61.4, 69.1, 75.2, 80.4, 84.1, 88, 91.5, 94.6, 97.7, 100.6] },
{ name: 'P15', data: [47.1, 63.3, 71.3, 77.7, 83.1, 87.1, 91.1, 94.8, 98.2, 101.5, 104.5] },
{ name: 'P50', data: [49.1, 65.7, 74, 80.7, 86.4, 90.7, 95.1, 99, 102.7, 106.2, 109.4] },
{ name: 'P85', data: [51.1, 68.1, 76.7, 83.7, 89.7, 94.3, 99.1, 103.2, 107.2, 110.9, 114.3] },
{ name: 'P97', data: [52.7, 70, 78.9, 86.2, 92.4, 97.3, 102.2, 106.5, 110.8, 114.7, 118.2] },
],
child: [
{ age: 0, value: 49.5 },
{ age: 2, value: 55.1 },
{ age: 4, value: 60.8 },
{ age: 6, value: 66.4 },
{ age: 9, value: 70.7 },
{ age: 12, value: 75 },
{ age: 15, value: 78.6 },
{ age: 18, value: 82.1 },
{ age: 24, value: 88.1 },
{ age: 30, value: 92.7 },
{ age: 36, value: 97.4 },
],
};
export default function Example() {
return <Chart spec={spec} style={{ height: 340 }} />;
}Or import this chart alone: what each import weighs.
Options
Beside the fields shared by every chart (title, format, heading, export…), type growth takes:
/** Growth of a child among percentile curves. */
interface GrowthSpec extends Base {
type: 'growth';
/** Ages of the curve points, in months. */
ages: number[];
/** From the lowest curve to the highest: P3, P15, P50, P85, P97. */
curves: { name: string; data: number[] }[];
/** The measures of the child. */
child: { age: number; value: number }[];
unit?: string;
xLabel?: string;
yLabel?: string;
}Style it
- Colours:
theme.palette,chart.setColor(name, colour), or--nervure-palettein your CSS. More - Marks:
[data-series="name"], parts:[data-part="axes"],legend,series. What you change is kept in exports. - Movement:
animation: falsedraws at once. More - Files:
chart.download('png'),svg,csv. More