Skip to content

Pain scale ​

A score from 0 to 10 on a row of faces. Good for consultations, nursing notes and recovery diaries.

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

In your framework

import { Chart } from 'nervure/react';

const spec = { type: 'painscale', value: 6, previous: 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 painscale takes:

/** Pain from 0 to 10, on the faces of a scale. */
interface PainScaleSpec extends Base {
  type: 'painscale';
  value: number;
  previous?: number;
  /** Words under the faces 0, 2, 4, 6, 8 and 10. */
  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