Exploded donut graph and donut slice gap examples

The code below is the source for this graph.

<?php
// Exploded donut graph and donut slice gap examples
require_once 'SVGGraph/autoloader.php';

$settings = [
  'back_stroke_width' => 0,
  'back_shadow' => 3,
  'back_colour' => 'white',
  'auto_fit' => true,
  'stroke_width' => 0,
  'show_tooltips' => false,
  'show_shadow' => true,
  'shadow_opacity' => 0.3,
  'structure' => [
    'key' => 0, 'value' => [ 1, 2, 3,],
  ],

  'sort' => false,
  'inner_text_font_size' => 14,
  'inner_radius' => 0.6,
  'label_position' => 0.8,
  'data_label_font_weight' => 'bold',
  'array_graph_type' => [ 'ExplodedDonutGraph', 'DonutGraph' ],
  'array_graph_dataset' => [ 0, 1 ],
  'array_graph_options' => [
    ['inner_text' => 'Exploded'], ['inner_text' => 'Gaps', 'donut_slice_gap' => 2],
  ],
];


$values = [
  ["K01", 318.6, 585.2, 1200,],
  ["K02", 134.8, 263.4, ],
  ["K03", 312.4, 623.9, ],
  ["K04", 181, 449.3, 900,],
  ["K05", 176.7, 370.6, ],
  ["K06", 623.4, 1519, ],
  ["K07", 409, 1215, 1600, ],
  ["K08", 206.4, 644.6, ],
  ["K09", 259.8, 714.3, ],
  ["K10", 333.2, 773.3, ],
  ["K11", 459, 1405, ],
  ["K12", 180.2, 519.3, 1200],
];

$graph = new Goat1000\SVGGraph\SVGGraph(670, 300, $settings);
$graph->values($values);
$graph->colourRangeHexHSL(0, 'red/saturation(180%)/brightness(150%)',
  'orange/brightness(80%)', '#88f');
$graph->render('ArrayGraph');

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.

This site uses cookies - details here.