LineGraph containing another LineGraph
The code below is the source for this graph.
<?php
// LineGraph containing another LineGraph
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);
$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.