Skip to content

Debt ratio gauge ​

Monthly charges against income on a dial with an example limit, and the income cut into its parts. Good for loan applications and budget advice.

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

In your framework

import { Chart } from 'nervure/react';
import 'nervure/themes';

const spec = {
  type: 'debtratio',
  format: { currency: 'EUR' },
  income: 4900,
  charges: [
    { name: 'Home loan', value: 1225 },
    { name: 'Car loan', value: 200 },
    { name: 'Student loan', value: 120 },
  ],
};

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

/** Debt ratio: monthly charges against income, on a dial with the usual limit. */
interface DebtRatioSpec extends Base {
  type: 'debtratio';
  /** Monthly income. */
  income: number;
  /** Monthly loan payments and other charges. */
  charges: { name: string; value: number; color?: string }[];
  /** Highest ratio, in %: 35 by default (a common French rule, shown as an example). */
  limit?: number;
  /** Where the dial turns amber: 33 by default. */
  warn?: number;
}

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