Lab results
Results against their reference ranges, flagged high or low, with the last value. Good for blood tests and patient portals.
The smallest code that works. change the code, then press Run
In your framework
import { Chart } from 'nervure/react';
const spec = {
type: 'labpanel',
data: [
{ name: 'Haemoglobin', value: 14.1, low: 12, high: 16, unit: 'g/dL', previous: 13.9 },
{ name: 'White cells', value: 6.9, low: 4, high: 10, unit: '10⁹/L' },
{ name: 'Platelets', value: 186, low: 150, high: 400, unit: '10⁹/L' },
{ name: 'Glucose (fasting)', value: 5.9, low: 3.9, high: 5.6, unit: 'mmol/L', previous: 5.4 },
{ name: 'Cholesterol', value: 4.2, low: 0, high: 5.2, unit: 'mmol/L', previous: 5.9 },
{ name: 'Creatinine', value: 62, low: 60, high: 110, unit: 'µmol/L' },
{ name: 'Vitamin D', value: 70, low: 50, high: 125, unit: 'nmol/L' },
],
};
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 labpanel takes:
/** Lab results against their reference ranges, flagged high or low. */
interface LabPanelSpec extends Base {
type: 'labpanel';
data: LabResult[];
}
interface LabResult {
name: 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