2. Dual axis enabled
The code below is the source for this graph.
<?php
// 2. Dual axis enabled
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],
],
'axis_space' => 10,
'dataset_axis' => [0,1],
];
$graph_type = 'GroupedBarGraph';
$width = 300;
$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.