PAD Charts
All charts/Sparkline

Shares in a table

Word-sized lines in table cells, no axes.

1 The data sparkline/stocks.php php
<?php

  // Five shares and their closing price over the last fifteen days.

  $stocks = [
    'ASML'    => [ 640, 652, 648, 661, 670, 668, 684, 679, 692, 701, 698, 712, 709, 725, 731 ],
    'Philips' => [ 21.4, 21.1, 20.8, 21.0, 20.6, 20.2, 20.5, 19.9, 19.6, 19.8, 19.3, 19.5, 19.1, 18.8, 18.9 ],
    'Shell'   => [ 30.1, 30.4, 30.2, 30.9, 31.3, 30.8, 30.6, 31.1, 31.4, 31.0, 31.6, 31.9, 31.5, 31.8, 32.2 ],
    'Heineken'=> [ 88, 87, 89, 86, 88, 90, 87, 85, 88, 89, 86, 87, 90, 88, 89 ],
    'Adyen'   => [ 1210, 1185, 1240, 1302, 1276, 1330, 1295, 1361, 1408, 1372, 1440, 1415, 1478, 1452, 1499 ]
  ];

  $shares = [];

  foreach ( $stocks as $name => $closes )
    $shares [] = [ 'name'   => $name,
                   'closes' => $closes,
                   'last'   => end ( $closes ),
                   'change' => round ( ( end ( $closes ) / $closes [0] - 1 ) * 100, 1 ) ];

?>
2 The template sparkline/stocks.pad pad
<table class="quotes">
  <tr><th>Share</th><th>15 days</th><th>Last</th><th>Change</th></tr>
  {shares}
  <tr>
    <td>{$name}</td>
    <td>{sparkline data='closes', width=140, height=30, title=$name}</td>
    <td>{$last}</td>
    <td class="{echo $change ge 0 ? 'up' : 'down'}">{$change} %</td>
  </tr>
  {/shares}
</table>
3 The result inline SVG · no JavaScript
Share 15 days Last Change
ASML ASML 1: 640; 2: 652; 3: 648; 4: 661; 5: 670; 6: 668; 7: 684; 8: 679; 9: 692; 10: 701; 11: 698; 12: 712; 13: 709; 14: 725; 15: 731 731 14.2 %
Philips Philips 1: 21.4; 2: 21.1; 3: 20.8; 4: 21; 5: 20.6; 6: 20.2; 7: 20.5; 8: 19.9; 9: 19.6; 10: 19.8; 11: 19.3; 12: 19.5; 13: 19.1; 14: 18.8; 15: 18.9 18.9 -11.7 %
Shell Shell 1: 30.1; 2: 30.4; 3: 30.2; 4: 30.9; 5: 31.3; 6: 30.8; 7: 30.6; 8: 31.1; 9: 31.4; 10: 31; 11: 31.6; 12: 31.9; 13: 31.5; 14: 31.8; 15: 32.2 32.2 7 %
Heineken Heineken 1: 88; 2: 87; 3: 89; 4: 86; 5: 88; 6: 90; 7: 87; 8: 85; 9: 88; 10: 89; 11: 86; 12: 87; 13: 90; 14: 88; 15: 89 89 1.1 %
Adyen Adyen 1: 1,210; 2: 1,185; 3: 1,240; 4: 1,302; 5: 1,276; 6: 1,330; 7: 1,295; 8: 1,361; 9: 1,408; 10: 1,372; 11: 1,440; 12: 1,415; 13: 1,478; 14: 1,452; 15: 1,499 1499 23.9 %