Skip to main content

Business Finance

The money side of running a company: how revenue grew and where it came from, what the business spends and keeps, and where its cash went.

note

The company and every figure on this page are made up to show the charts. They are not financial advice.


Revenue​

Revenue Bridge​

A waterfall walks from last year's revenue to this year's, one step for each reason it changed, so the gains and the losses read in the order a finance team explains them. type="waterfall" starts each bar where the last one ended, and the rows marked standalone start from zero, for the two years' totals. Each step's own color key colors it by whether it added or took away.

function example() {
  const dollars = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'USD',
    notation: 'compact',
    maximumFractionDigits: 2,
  });
  const bridge = [
    { step: 'Last year', revenue: 4_200_000, standalone: true },
    { step: 'New customers', revenue: 1_150_000, color: 'success' },
    { step: 'Expansion', revenue: 620_000, color: 'success' },
    { step: 'Price rise', revenue: 280_000, color: 'success' },
    { step: 'Contraction', revenue: -190_000, color: 'danger' },
    { step: 'Churn', revenue: -540_000, color: 'danger' },
    { step: 'This year', revenue: 5_520_000, standalone: true },
  ];

  return (
    <BarChart
      label="Revenue bridge, last year to this year"
      type="waterfall"
      data={bridge}
      dataKey="step"
      series={[{ name: 'revenue', label: 'Revenue', color: 'link' }]}
      valueFormatter={value => dollars.format(value)}
      showLabels
    />
  );
}

Recurring Revenue Movements​

Each month, new customers add to monthly recurring revenue, existing ones expand it, and churn takes some away. A stacked bar per month shows the gains above zero and the churn below it, so how much of each month's growth churn took back shows at a glance. Recharts' own stackOffset="sign", passed through chartProps, is what stacks the negative values down from zero rather than onto the positive ones.

function example() {
  const months = [
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'Jun',
    'Jul',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec',
  ];
  // Thousands of dollars of monthly recurring revenue, by how it moved.
  const added = [14, 15, 13, 16, 15, 16, 15, 17, 18, 19, 18, 20];
  const expanded = [4, 5, 4, 5, 4, 5, 5, 4, 6, 5, 6, 6];
  const churned = [10, 11, 10, 12, 11, 12, 12, 12, 13, 13, 13, 15];
  const movements = months.map((month, index) => ({
    month,
    new: added[index] * 1000,
    expansion: expanded[index] * 1000,
    churn: -churned[index] * 1000,
  }));
  const dollars = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'USD',
    notation: 'compact',
  });

  return (
    <BarChart
      label="Monthly recurring revenue movements"
      type="stacked"
      data={movements}
      dataKey="month"
      series={[
        { name: 'new', label: 'New', color: 'success' },
        { name: 'expansion', label: 'Expansion', color: 'info' },
        { name: 'churn', label: 'Churn', color: 'danger' },
      ]}
      chartProps={{ stackOffset: 'sign' }}
      valueFormatter={value => dollars.format(value)}
      hasLegend
    />
  );
}

KPI Tiles with Sparklines​

A row of figures, each with the last twelve months drawn small beneath it, gives the number and its trend at a glance. Each tile is a Stat in a Stats row, and its sparkline is a LineChart with the axes, the grid and the dots turned off, passed as the Stat's description. The hidden value axis runs from the series' lowest value to its highest, so a small change still shows as a slope. A sparkline is there for its trend, so it has no tooltip and is no tab stop: hasTooltip={false}, and Recharts' own accessibilityLayer: false through chartProps. Its data table still reads each month's figure to a screen reader. A Recharts ReferenceDot, imported from recharts and passed as the chart's child, marks the last point, the month the figure above it gives. Fewer customers lost is good news, so that tile's changeColor turns its fall green.

import { ReferenceDot } from 'recharts';

function example() {
  const months = [
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'Jun',
    'Jul',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec',
  ];
  const revenue = [
    352, 361, 368, 377, 385, 394, 402, 411, 422, 433, 444, 455,
  ].map(thousands => thousands * 1000);
  const customers = [
    1180, 1204, 1221, 1236, 1262, 1279, 1301, 1318, 1342, 1355, 1381, 1406,
  ];
  const lost = [37, 35, 37, 35, 34, 36, 34, 33, 35, 33, 32, 31];
  type Kpi = {
    label: string;
    history: number[];
    format: Intl.NumberFormatOptions;
    lowerIsBetter?: boolean;
  };
  const kpis: Kpi[] = [
    {
      label: 'Recurring revenue',
      history: revenue,
      format: {
        style: 'currency',
        currency: 'USD',
        notation: 'compact',
        maximumFractionDigits: 1,
      },
    },
    { label: 'Paying customers', history: customers, format: {} },
    {
      label: 'Revenue per customer',
      history: revenue.map((amount, index) => amount / customers[index]),
      format: { style: 'currency', currency: 'USD', maximumFractionDigits: 0 },
    },
    {
      label: 'Customers lost',
      history: lost,
      format: {},
      lowerIsBetter: true,
    },
  ];

  return (
    <>
      <Title as="h4" textSize="6" id="kpi-row">
        This month, against last month
      </Title>
      <Stats aria-labelledby="kpi-row" minCol={5} gap={4}>
        {kpis.map(kpi => {
          const latest = kpi.history[kpi.history.length - 1];
          const change = latest / kpi.history[kpi.history.length - 2] - 1;
          // Stat colors a rise green and a fall red. Where lower is better,
          // the two swap, and a month with no change keeps neither.
          let changeColor: 'success' | 'danger' | undefined;
          if (kpi.lowerIsBetter && change !== 0) {
            changeColor = change < 0 ? 'success' : 'danger';
          }
          const format = new Intl.NumberFormat('en-US', kpi.format);
          return (
            <Stat
              key={kpi.label}
              label={kpi.label}
              value={latest}
              format={kpi.format}
              locale="en-US"
              change={change}
              changeColor={changeColor}
              description={
                <LineChart
                  label={`${kpi.label}, last twelve months`}
                  data={kpi.history.map((value, index) => ({
                    month: months[index],
                    value,
                  }))}
                  dataKey="month"
                  series={[{ name: 'value', label: kpi.label, color: 'link' }]}
                  valueFormatter={value => format.format(value)}
                  hasXAxis={false}
                  hasYAxis={false}
                  yAxisProps={{ domain: ['dataMin', 'dataMax'] }}
                  grid="none"
                  hasDots={false}
                  hasTooltip={false}
                  chartProps={{ accessibilityLayer: false }}
                  height={48}
                >
                  <ReferenceDot
                    x={months[kpi.history.length - 1]}
                    y={latest}
                    r={3}
                    fill="var(--bulma-link)"
                    stroke="none"
                  />
                </LineChart>
              }
            />
          );
        })}
      </Stats>
    </>
  );
}


Costs, Profit and Cash​

Revenue Against Expenses​

Grouped bars put each month's revenue beside its expenses, and a line over them traces the net profit between the two, the figure the bars only imply. The profit runs on its own axis on the right, since it is a fraction of the size of the bars and would sit flat along their axis. Both axes start at zero here, so the line and the bars share a baseline. A year with a loss in it would want a domain in yAxisProps and in rightYAxisProps that put the two zeros at one height.

function example() {
  const months = [
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'Jun',
    'Jul',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec',
  ];
  // Thousands of dollars a month.
  const revenue = [399, 408, 422, 415, 438, 454, 463, 469, 487, 505, 518, 542];
  const expenses = [395, 403, 404, 403, 408, 412, 413, 408, 415, 410, 400, 417];
  const year = months.map((month, index) => ({
    month,
    revenue: revenue[index] * 1000,
    expenses: expenses[index] * 1000,
    profit: (revenue[index] - expenses[index]) * 1000,
  }));
  const dollars = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'USD',
    notation: 'compact',
  });

  return (
    <ComposedChart
      label="Revenue against expenses, with net profit"
      data={year}
      dataKey="month"
      series={[
        { name: 'revenue', label: 'Revenue', color: 'success', type: 'bar' },
        { name: 'expenses', label: 'Expenses', color: 'danger', type: 'bar' },
        {
          name: 'profit',
          label: 'Net profit',
          color: 'link',
          yAxisId: 'right',
        },
      ]}
      hasRightYAxis
      yAxisLabel="Revenue and expenses"
      rightYAxisLabel="Net profit"
      valueFormatter={value => dollars.format(value)}
      hasLegend
    />
  );
}

Budget Against Actual​

Each department's spending for the year as a share of its budget. The budgets differ in size, so the amounts are turned into shares, which puts every budget at 100%: one reference line marks them all, and what a department spent past it is stacked on in red. orientation="vertical" runs the bars across, which leaves room for the departments' names, and xAxisProps runs the value axis to 125%, which leaves room past the line for the overspend and the line's label.

function example() {
  const departments = [
    { department: 'Engineering', budget: 2_400_000, spent: 2_256_000 },
    { department: 'Sales', budget: 1_300_000, spent: 1_417_000 },
    { department: 'Marketing', budget: 900_000, spent: 1_008_000 },
    { department: 'Support', budget: 620_000, spent: 589_000 },
    { department: 'Finance', budget: 340_000, spent: 323_000 },
    { department: 'People', budget: 280_000, spent: 302_000 },
  ];
  const shares = departments.map(({ department, budget, spent }) => ({
    department,
    within: Math.min(spent, budget) / budget,
    over: Math.max(spent - budget, 0) / budget,
  }));
  const percent = new Intl.NumberFormat('en-US', {
    style: 'percent',
    maximumFractionDigits: 0,
  });

  return (
    <BarChart
      label="Spending against budget, by department"
      orientation="vertical"
      type="stacked"
      grid="vertical"
      data={shares}
      dataKey="department"
      series={[
        { name: 'within', label: 'Within budget', color: 'link' },
        { name: 'over', label: 'Over budget', color: 'danger' },
      ]}
      referenceLines={[{ y: 1, label: 'Budget' }]}
      valueFormatter={value => percent.format(value)}
      xAxisProps={{ domain: [0, 1.25], ticks: [0, 0.25, 0.5, 0.75, 1, 1.25] }}
      yAxisProps={{ width: 100 }}
      hasLegend
      height={320}
    />
  );
}

Income Statement Flow​

A Sankey diagram draws the year's income statement as flows: the revenue, the cost of sales and the gross profit it leaves, the operating costs that gross profit pays, then tax and the net profit at the end. Each flow is as wide as the money in it, so the size of each cost against the revenue shows without a calculation. Recharts' own align: 'left' and sort: false, passed through chartProps, set each cost in the column after the figure it comes out of, in the order nodes lists them, so the statement reads from left to right and top to bottom. A small flow helper finds each node by its name, so the links read like the statement's lines.

function example() {
  const nodes = [
    { name: 'Revenue', color: 'success' },
    { name: 'Cost of sales', color: 'danger' },
    { name: 'Gross profit', color: 'link' },
    { name: 'Research', color: 'danger' },
    { name: 'Sales and marketing', color: 'danger' },
    { name: 'Administration', color: 'danger' },
    { name: 'Operating profit', color: 'link' },
    { name: 'Tax', color: 'danger' },
    { name: 'Net profit', color: 'primary' },
  ];
  const flow = (from: string, to: string, value: number) => ({
    source: nodes.findIndex(node => node.name === from),
    target: nodes.findIndex(node => node.name === to),
    value,
  });
  const dollars = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'USD',
    notation: 'compact',
    maximumFractionDigits: 2,
  });

  return (
    <Sankey
      label="Income statement, this year"
      data={{
        nodes,
        links: [
          flow('Revenue', 'Cost of sales', 1_490_000),
          flow('Revenue', 'Gross profit', 4_030_000),
          flow('Gross profit', 'Research', 1_380_000),
          flow('Gross profit', 'Sales and marketing', 1_240_000),
          flow('Gross profit', 'Administration', 610_000),
          flow('Gross profit', 'Operating profit', 800_000),
          flow('Operating profit', 'Tax', 168_000),
          flow('Operating profit', 'Net profit', 632_000),
        ],
      }}
      valueFormatter={value => dollars.format(value)}
      chartProps={{ align: 'left', sort: false }}
      height={400}
    />
  );
}

Cash Flow​

The waterfall again, over one quarter's bank balance: the opening balance, the money that came in and went out, and the closing balance. Here each step's color comes from its amount's sign, and the closing balance is summed from the steps, as an app drawing from its ledger would do it. A Recharts ReferenceLine, imported from recharts and passed as the chart's child, marks the least cash the company keeps on hand. The chart's own referenceLines draws such a line too, but writes its label at the line's end, over the closing balance's bar; the child's label sits in the middle, where the bars leave room. The description gives the figure to a screen reader, since the data table lists the bars alone.

import { ReferenceLine } from 'recharts';

function example() {
  const opening = 1_850_000;
  const movements = [
    { item: 'Customers', amount: 2_640_000 },
    { item: 'Interest', amount: 18_000 },
    { item: 'Payroll', amount: -1_520_000 },
    { item: 'Suppliers', amount: -610_000 },
    { item: 'Rent', amount: -180_000 },
    { item: 'Tax', amount: -240_000 },
  ].map(movement => ({
    ...movement,
    color: movement.amount < 0 ? 'danger' : 'success',
  }));
  const closing = movements.reduce(
    (balance, movement) => balance + movement.amount,
    opening
  );
  const minimum = 1_500_000;
  const dollars = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'USD',
    notation: 'compact',
    maximumFractionDigits: 2,
  });

  return (
    <BarChart
      label="Cash flow, third quarter"
      description={`The company keeps at least ${dollars.format(minimum)} in cash.`}
      type="waterfall"
      data={[
        { item: 'Opening', amount: opening, standalone: true },
        ...movements,
        { item: 'Closing', amount: closing, standalone: true },
      ]}
      dataKey="item"
      series={[{ name: 'amount', label: 'Cash', color: 'link' }]}
      valueFormatter={value => dollars.format(value)}
      showLabels
    >
      <ReferenceLine
        y={minimum}
        stroke="var(--bulma-chart-reference-color, var(--bulma-text))"
        strokeDasharray="4 4"
        label={{
          value: 'Minimum cash',
          position: 'insideTop',
          fill: 'var(--bulma-chart-reference-color, var(--bulma-text))',
          fontSize: 12,
        }}
      />
    </BarChart>
  );
}