Compound savings
What was put in and what the interest added, year by year, with a goal. Good for savings plans, pension and education funds.
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: 'compound', format: { currency: 'EUR' }, initial: 3000, monthly: 180, rate: 3.5, years: 30, goal: 110000 };
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 compound takes:
/** Savings that grow with interest: what was put in and what the interest added, year by year. */
interface CompoundSpec extends Base {
type: 'compound';
/** Saved at the start. */
initial?: number;
/** Saved each month. */
monthly: number;
/** Yearly rate, in %. */
rate: number;
years: number;
/** An amount to reach: the year it is reached is marked. */
goal?: number;
legend?: boolean | LegendOptions;
}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