Exploded 3D pie graph showing side shading
The code below is the source for this graph.
<?php
// Exploded 3D pie graph showing side shading
require_once 'SVGGraph/autoloader.php';
$settings = [
'back_stroke_width' => 0,
'auto_fit' => true,
'structure' => [
'key' => 0,
'value' => 1,
'explode' => 2,
],
'explode' => 'none',
'explode_amount' => 50,
'data_label_font_size' => 20,
'data_label_font_weight' => 'bold',
'data_label_type' => 'box',
'data_label_outline_colour' => 'fillColour/brightness(0.6)',
'data_label_outline_thickness' => 2,
'data_label_round' => 4,
'data_label_colour' => 'fillColour/brightness(0.6)',
'data_label_padding' => 6,
'sort' => false,
'aspect_ratio' => 'auto',
'start_angle' => 120,
'end_angle' => 60,
'depth_shade_gradient' => ['black:0.9', 'yellow:0.1', 'black:0.9', 'h'],
];
$type = 'ExplodedPie3DGraph';
$values = [
['Tea', 10, 0.7],
['Coffee', 20, 1.0],
['Milk', 25, 0.5],
['Water', 50],
];
$colours = ['#e97','#630','#edd', ['#6bf','pattern' => 'polkadot2']];
$graph = new Goat1000\SVGGraph\SVGGraph(670, 300, $settings);
$graph->colours($colours);
$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.