User-defined pattern example

The code below is the source for this graph.

<?php
// User-defined pattern example
require_once 'SVGGraph/autoloader.php';

$settings = [
  'auto_fit' => true,
  'pad_bottom' => 1,
  'back_stroke_width' => 0,
  'grid_colour' => '#ccc',
  'axis_font_h' => 'Arial',
  'axis_font_size_h' => 13,
  'show_tooltips' => false,
  'grid_division_v' => 5,
  'figure' => [
    ['round',
    [ 'circle', 'cx' => 4, 'cy' => 4, 'r' => 3, 'stroke' => 'blue' ],
    [ 'circle', 'cx' => 6, 'cy' => 6, 'r' => 3, 'stroke' => 'blue' ],
    [ 'circle', 'cx' => 5, 'cy' => 5, 'r' => 5, 'stroke' => 'red' ],
    ],
  ],
];
$width = 670;
$height = 100;
$images = getenv('base') . '/images';

$values = [10, 7.5, 5, 2.5, 10, 7.5, 5, 2.5];

$colours = [
  ['#ccc',
  'pattern' => "<image xlink:href=\"{$images}/feed-icon-14x14.png\" width=\"14\" height=\"14\" />",
  'width' => 15, 'height' => 15, 'angle' => 45, 'back_colour' => '#f99'],
  ['#ccc',
  'pattern' => "<image xlink:href=\"{$images}/feed-icon-14x14.png\" width=\"14\" height=\"14\" opacity=\"0.75\" />",
  'width' => 15, 'height' => 15, 'angle' => 45, 'back_colour' => '#f99:0.75'],
  ['#ccc',
  'pattern' => "<image xlink:href=\"{$images}/feed-icon-14x14.png\" width=\"14\" height=\"14\" opacity=\"0.5\" />",
  'width' => 15, 'height' => 15, 'angle' => 45, 'back_colour' => '#f99:0.5'],
  ['#ccc',
  'pattern' => "<image xlink:href=\"{$images}/feed-icon-14x14.png\" width=\"14\" height=\"14\" opacity=\"0.25\" />",
  'width' => 15, 'height' => 15, 'angle' => 45, 'back_colour' => '#f99:0.25'],
  ['round', 'pattern' => 'figure', 'size' => 12],
  ['round', 'pattern' => 'figure', 'size' => 15],
  ['round', 'pattern' => 'figure', 'size' => 18],
  ['round', 'pattern' => 'figure', 'size' => 8],
];

$graph = new Goat1000\SVGGraph\SVGGraph($width, $height, $settings);
$graph->colours($colours);
$graph->values($values);
$graph->render('BarGraph');

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.