Subgraph in subgraph
The code below is the source for this graph.
<?php
// Subgraph in subgraph
require_once 'SVGGraph/autoloader.php';
$settings = [
'back_stroke_width' => 0,
'auto_fit' => true,
'minimum_grid_spacing' => 20,
'sort' => false,
'show_labels' => false,
'axis_font_size' => 11,
'marker_size' => 3,
'marker_type' => 'square',
'stroke_colour' => '#999',
'grid_back_colour' => '#fefefe',
];
$values = [ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ];
$colours = [ '#66f', '#f76', '#dc3' ];
$graph = new Goat1000\SVGGraph\SVGGraph(600, 200, $settings);
$graph->values($values);
$inner_settings = [
'back_stroke_width' => 1,
'back_round' => 10,
'minimum_grid_spacing' => 15,
];
$inner_values = [];
foreach($values as $k => $v)
$inner_values[] = 1 / $v;
$subgraph = $graph->subgraph('LineGraph', 45, 2, 280, 130, null, $inner_settings);
$subgraph->values($inner_values);
$pie_settings = [
'back_colour' => 'none',
'pad_left' => 1,
'pad_top' => 3,
'pad_right' => 3,
'pad_bottom' => 1,
'stroke_width' => 0,
];
$ss = $subgraph->subgraph('PieGraph', 'g7', 'gt', 'u3', 'u3x', $settings, $pie_settings);
$ss->values($values);
$ss->colourRangeHexHSL(0, '#f00', '#00f', true);
$graph->render('LineGraph');
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.