7. Multiple columns
The code below is the source for this graph.
<?php
// 7. Multiple columns
require_once 'SVGGraph/autoloader.php';
$settings = [
'auto_fit' => true,
'back_colour' => '#fff',
'back_stroke_width' => 2,
'back_stroke_colour' => '#000',
'stroke_colour' => '#000',
'label_colour' => '#000',
'pad_right' => 10,
'pad_left' => 10,
'pad_top' => 70,
'legend_columns' => 3,
'legend_entry_height' => 10,
'legend_title' => 'Legend',
'legend_text_side' => 'left',
'legend_position' => 'outer top 5 1',
'legend_stroke_width' => 0,
'legend_shadow_opacity' => 0,
'legend_draggable' => false,
'legend_back_colour' => 'none',
'show_labels' => false,
'aspect_ratio' => 'auto',
'depth' => 10,
'legend_entries' => [
'Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'
],
];
$width = 300;
$height = 200;
$type = 'BarGraph';
$values = [
'Mon' => 18, 'Tue' => 17, 'Wed' => 14, 'Thu' => 15,
'Fri' => 13, 'Sat' => 16, 'Sun' => 12
];
$colours = [
['red','orange','h'],
['orange','yellow','h'],
['yellow','green','h'],
['green','blue','h'],
['blue','indigo','h'],
['indigo','violet','h'],
['violet','black','h'],
];
$type = 'Pie3DGraph';
$graph = new Goat1000\SVGGraph\SVGGraph($width, $height, $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.