PAD Charts
All charts/Sankey

A salary, spent

One income split over posts, then over sub-posts.

1 The data sankey/salary.php php
<?php

  // A net salary of 3,200 a month: the posts, and what they are made of.

  $spending = [
    'Housing'   => [ 'Rent' => 1150, 'Insurance' => 120 ],
    'Living'    => [ 'Groceries' => 450, 'Energy' => 160, 'Phone' => 40 ],
    'Transport' => [ 'Car' => 260, 'Train' => 90 ],
    'Saving'    => [ 'Pension' => 250, 'Holiday' => 180 ],
    'Fun'       => [ 'Dining out' => 220, 'Sport' => 80, 'Streaming' => 30 ]
  ];

  $salary = [];

  foreach ( $spending as $post => $parts )
    foreach ( $parts as $part => $amount ) {
      $salary [] = [ 'from' => 'Salary', 'to' => $post, 'amount' => $amount ];
      $salary [] = [ 'from' => $post,    'to' => $part, 'amount' => $amount ];
    }

?>
2 The chart tag sankey/salary.pad pad
{chart 'sankey', data='salary', source='from', target='to', value='amount', title='A salary of 3,200, spent', width=640, height=420}
3 The result inline SVG · no JavaScript
A salary of 3,200, spent Salary → Housing: 1,270; Housing → Rent: 1,150; Housing → Insurance: 120; Salary → Living: 650; Living → Groceries: 450; Living → Energy: 160; Living → Phone: 40; Salary → Transport: 350; Transport → Car: 260; Transport → Train: 90; Salary → Saving: 430; Saving → Pension: 250; Saving → Holiday: 180; Salary → Fun: 330; Fun → Dining out: 220; Fun → Sport: 80; Fun → Streaming: 30 Housing → Rent: 1,150 Housing → Insurance: 120 Salary → Housing: 1,270 Salary → Living: 650 Salary → Transport: 350 Salary → Saving: 430 Salary → Fun: 330 Living → Groceries: 450 Living → Energy: 160 Living → Phone: 40 Transport → Car: 260 Transport → Train: 90 Saving → Pension: 250 Saving → Holiday: 180 Fun → Dining out: 220 Fun → Sport: 80 Fun → Streaming: 30 Salary: 3,030 Salary Housing: 1,270 Housing Rent: 1,150 Rent Insurance: 120 Insurance Living: 650 Living Groceries: 450 Groceries Energy: 160 Energy Phone: 40 Phone Transport: 350 Transport Car: 260 Car Train: 90 Train Saving: 430 Saving Pension: 250 Pension Holiday: 180 Holiday Fun: 330 Fun Dining out: 220 Dining out Sport: 80 Sport Streaming: 30 Streaming