Vaccination schedule
Doses by age, given, late or to come, and today. Good for child health records and clinics.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'vaccines',
today: 15,
ages: [
{ label: 'Birth', month: 0 },
{ label: '2 m', month: 2 },
{ label: '4 m', month: 4 },
{ label: '6 m', month: 6 },
{ label: '12 m', month: 12 },
{ label: '16 m', month: 16 },
{ label: '6 y', month: 72 },
{ label: '11 y', month: 132 },
],
data: [
{ name: 'Hepatitis B', doses: [{ month: 0, given: true }, { month: 2, given: true }, { month: 6, given: true }] },
{
name: 'Diphtheria, tetanus',
doses: [
{ month: 2, given: true },
{ month: 4, given: true },
{ month: 12, given: true },
{ month: 72, given: false },
{ month: 132, given: false },
],
},
{
name: 'Polio',
doses: [
{ month: 2, given: true },
{ month: 4, given: true },
{ month: 12, given: true },
{ month: 72, given: false },
],
},
{ name: 'Pneumococcal', doses: [{ month: 2, given: true }, { month: 4, given: true }, { month: 12, given: true }] },
{ name: 'Measles, mumps', doses: [{ month: 12, given: true }, { month: 16, given: false }] },
{ name: 'Meningococcal', doses: [{ month: 6, given: true }, { month: 12, given: false }] },
],
};
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 vaccines takes:
/** Vaccination schedule: doses by age, given, late or to come. */
interface VaccinesSpec extends Base {
type: 'vaccines';
data: { name: string; doses: VaccineDose[] }[];
/** Columns of the calendar; each dose goes to the column of its month. */
ages: { label: string; month: number }[];
/** Age of the child now, in months: doses before it and not given are late. */
today?: number;
}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