Structured pie graph explosion
The code below is the source for this graph.
<?php
// Structured pie graph explosion
require_once 'SVGGraph/autoloader.php';
$settings = [
'auto_fit' => true,
'back_stroke_width' => 0,
'structure' => [
'key' => 0,
'value' => 1,
'explode' => 2,
],
'explode' => 'none',
'explode_amount' => 30,
'data_label_font_size' => 10,
'data_label_back_colour' => '#333',
'sort' => false,
'label_colour' => '#fff',
];
$values = [
['Tea', 10],
['Coffee', 20, 1.0],
['Milk', 25, 0.5],
['Water', 50],
];
$colours = ['#e97','#630','#edd', ['#6bf','pattern' => 'polkadot2']];
$graph = new Goat1000\SVGGraph\SVGGraph(300, 200, $settings);
$graph->colours($colours);
$graph->values($values);
$graph->render('ExplodedPieGraph');
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.