5. Multiple axes

The code below is the source for this graph.

<?php
// 5. Multiple axes
require_once 'SVGGraph/autoloader.php';

$settings = [
  'back_stroke_width' => 0,
  'auto_fit' => true,
  'bar_space' => 6,
  'group_space' => 0,
  'label_space' => 5,
  'label_font' => 'Courier New',
  'label_font_size' => 12,
  'label_font_weight' => 'bold',
  'minimum_units_y' => 1,
  'structure' => [
    'key' => 0,
    'value' => [1, 2, 3, 4],
  ],
  'axis_space' => 10,
  'dataset_axis' => [0, 1, 2, 3],
  'label_v' => ['Sales', 'Age', 'Height', 'Weight'],
  'label_colour_v' => ['#930','#390', '#039', '#990'],
  'units_y' => [null, null, 'cm', 'kg'],
  'units_before_y' => ['$', null, null, null],
];

$graph_type = 'GroupedBarGraph';
$width = 600;

$graph = new Goat1000\SVGGraph\SVGGraph($width, 200, $settings);

$graph->colours(['#c60','#6c0', '#06c', '#cc6']);
$values = [
  ['Bob', 15000, 42, 175, 65],
  ['Eve', 14000, 38, 178, 63],
  ['Sue', 16000, 45, 173, 61],
  ['Joe', 12500, 25, 179, 69],
  ['Pam', 19000, 28, 164, 60],
  ['Tim', 18000, 33, 181, 85],
];
$graph->values($values);
$graph->render($graph_type);

Please note: the source code above comes from a script used to generate one of the example graphs on the site. This is simply a wrapper page to apply highlighting and make the source code easier to read, so there is no content here to describe what the source code is doing.