Figure markers
The code below is the source for this graph.
<?php
// Figure markers
require_once 'SVGGraph/autoloader.php';
$settings = [
'auto_fit' => true,
'show_axes' => false,
'show_tooltips' => false,
'back_stroke_width' => 0,
'axis_max_h' => 10,
'axis_max_v' => 16,
'grid_division_v' => 2,
'marker_type' => [
'figure:box-blue',
'figure:box-red',
'figure:box-yellow',
'figure:box-purple',
],
'marker_size' => [15, 14, 15, 16],
'grid_back_colour' => '#f9f9f9',
'pad_left' => 5,
'pad_top' => 5,
'pad_right' => 5,
'pad_bottom' => 5,
'fill_under' => true,
'fill_opacity' => 0.8,
'figure' => [
['box-outer',
['polyline', 'points' => [
-10, -10,
-10, 10,
10, 10,
10, -10,
-6, -22
], 'stroke-width' => 2
],
],
['box-blue',
['rect', 'x' => -10, 'y' => -10, 'width' => 20, 'height' => 20,
'fill' => ['#33e', '#eef'], 'stroke' => 'none'],
['figure', 'x' => 0, 'y' => 0, 'name' => 'box-outer'],
],
['box-red',
['rect', 'x' => -10, 'y' => -10, 'width' => 20, 'height' => 20,
'fill' => ['#e33', '#e66'], 'stroke' => 'none'],
['figure', 'x' => 0, 'y' => 0, 'name' => 'box-outer'],
],
['box-yellow',
['rect', 'x' => -10, 'y' => -10, 'width' => 20, 'height' => 20,
'fill' => ['#ff1', '#ff8'], 'stroke' => 'none'],
['figure', 'x' => 0, 'y' => 0, 'name' => 'box-outer'],
],
['box-purple',
['rect', 'x' => -10, 'y' => -8, 'width' => 20, 'height' => 18,
'fill' => ['#f0f', '#9cf'], 'stroke' => 'none'],
['figure', 'x' => 0, 'y' => 0, 'name' => 'box-outer'],
],
],
];
$values = [];
for($c = 4; $c > 0; --$c) {
$values[] = [1 => 6 - $c, 2, 3, 2, 3, 2, 3, 2, 6 - $c];
}
$graph = new Goat1000\SVGGraph\SVGGraph(650, 200, $settings);
$graph->colours([
['#e11','#fff'],
['#1b1','#fff'],
['#11e','#fff'],
['#e71','#fff'],
['#333','#fff'],
]);
$graph->values($values);
$graph->render('StackedLineGraph');
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.