Formatted data labels
The code below is the source for this graph.
<?php
// Formatted data labels
require_once 'SVGGraph/autoloader.php';
$settings = [
'auto_fit' => true,
'back_colour' => '#eee',
'back_stroke_width' => 0,
'back_stroke_colour' => '#eee',
'stroke_colour' => '#000',
'label_colour' => '#000',
'pad_right' => 10,
'pad_left' => 10,
'datetime_keys' => true,
'structure' => ['key' => 0, 'value' => [1, 2]],
'aspect_ratio' => 'auto',
'data_label_datetime_format' => "j M Y\ng:ia",
'data_label_type' => 'box',
];
$values = [
['2001-01-01T06:57', 7.5, 0, 'Mindanao, Philippines'],
['2001-01-09T16:49', 7.1, 0, 'Vanuatu Islands'],
['2001-01-10T16:02', 7.0, 0, 'Kodiak Island region, Alaska, United States'],
['2001-01-13T17:33', 7.7, 944, 'El Salvador'],
['2001-01-26T03:16', 7.7, 20085, 'Western India'],
['2001-02-13T14:22', 6.6, 315, 'El Salvador'],
['2001-02-13T19:28', 7.4, 0, 'Southern Sumatra, Indonesia'],
['2001-02-17T20:25', 4.1, 1, 'El Salvador'],
];
$type = 'Pie3DGraph';
$width = 670;
$height = 200;
$graph = new Goat1000\SVGGraph\SVGGraph($width, $height, $settings);
$graph->colourRangeHexHSL(0, '#060', '#f60', true);
$graph->values($values);
$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.