Skip to content

BMI scale ​

Body mass index on the scale of its categories, with the change since last time. Good for check-ups, weight programmes and wellness apps.

The smallest code that works. change the code, then press Run

In your framework

import { Chart } from 'nervure/react';

const spec = { type: 'bmi', weight: 78, height: 172, previous: 25.7 };

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 bmi takes:

/** Body mass index on the scale of its categories. */
interface BmiSpec extends Base {
  type: 'bmi';
  /** The index; computed from `weight` (kg) and `height` (cm) when missing. */
  value?: number;
  weight?: number;
  height?: number;
  /** An earlier index: a faint mark and the change. */
  previous?: number;
  /** Name of each category in another language, from underweight to obese class III. */
  labels?: string[];
}

Style it

  • Colours: theme.palette, chart.setColor(name, colour), or --nervure-palette in your CSS. More
  • Marks: [data-series="name"], parts: [data-part="axes"], legend, series. What you change is kept in exports.
  • Movement: animation: false draws at once. More
  • Files: chart.download('png'), svg, csv. More

Close to it