BoxAndWhiskerGraph

The code below is the source for this graph.

<?php
// BoxAndWhiskerGraph
require_once 'SVGGraph/autoloader.php';

$settings = [
  'auto_fit' => true,
  'back_colour' => '#eee',
  'back_stroke_width' => 0,
  'back_stroke_colour' => '#eee',
  'stroke_colour' => '#000',
  'axis_colour' => '#111',
  'axis_overlap' => 2,
  'grid_colour' => '#999',
  'label_colour' => '#000',
  'axis_font' => 'Arial',
  'axis_font_size' => 10,
  'pad_right' => 20,
  'pad_left' => 20,
  'link_base' => '/',
  'link_target' => '_top',
  'minimum_grid_spacing' => 20,
  'show_subdivisions' => true,
  'show_grid_subdivisions' => true,
  'grid_subdivision_colour' => '#ccc',
  'structured_data' => true,
  'structure' => [
    'key' => 0, 'value' => 1, 'outliers' => [7, 8],
    'top' => 3, 'bottom' => 4, 'wtop' => 5, 'wbottom' => 6
  ],
];

$width = 300;
$height = 200;
$type = 'BoxAndWhiskerGraph';
$values = [
  ['Dough', 30, 50, 40, 20, 49, 10],
  ['Ray', 50, 3, 55, 40, 60, 30, 7, 15],
  ['Me', 40, -60, 45, 30, 58, 10, 65],
  ['So', 25, 15, 40, 22, 45, 18],
  ['Far', 45, 25, 50, 35, 58, 28],
  ['Lard', 35, 25, 39, 31, 44, 22],
  ['Tea', -20, 45, 3, -28, 14, -32],
];

$colours = [ [ 'red','yellow' ], [ 'blue','white' ] ];
$graph = new Goat1000\SVGGraph\SVGGraph($width, $height, $settings);
$graph->colours($colours);
$graph->colourRangeHexHSL(1, '#f03', '#999966');
$graph->colourRangeHexHSL(2, '#f30', '#306630');
$graph->colourRangeHexHSL(3, '#f3f', '#006600');

$links = ['Dough' => 'jpegsaver.php', 'Ray' => 'crcdropper.php', 'Me' => 'svggraph.php'];
$graph->values($values);
$graph->links($links);
$graph->render($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.