Gantt chart with double axes and padding
The code below is the source for this graph.
<?php
// Gantt chart with double axes and padding
require_once 'SVGGraph/autoloader.php';
$options = [
'auto_fit' => true,
'structure' => [
'key' => 0, 'axis_text' => 1,
'value' => [2, 4, 6, 8],
'end' => [3, 5, 7, 9],
'complete' => ['c1', 'c2', 'c3', 'c4'],
'milestone' => ['m1', 'm2', 'm3', 'm4'],
'group' => 'g',
],
'data_label_font_weight' => 'bold',
'gantt_today_date' => '2022-04-19',
'bar_space' => 20,
'axis_double_x' => true,
'axis_double_y' => true,
'axis_pad_top' => 20,
'axis_pad_left' => 20,
'axis_pad_right' => 20,
'axis_pad_bottom' => 20,
];
$values = [
[0, 'Big project', 'g' => 'top'],
[1, 'First part', 'g' => '*'],
[2, 'Repeated', '2022-04-01', '2022-04-05', '2022-04-08', '2022-04-12',
'c1' => 80, 'c2' => 10],
[3, 'Second task', '2022-04-05', '2022-04-20', '2022-04-25',
'c1' => 40, 'm2' => true],
[4, 'Second part', 'g' => '*', 'd' => 3],
[5, 'Important dates', '2022-03-29', null, '2022-04-12', null, '2022-04-26',
'm1' => true, 'm2' => true, 'm3' => true, 'm4' => true],
[6, 'Third task', '2022-05-02', '2022-05-17', '2022-05-19', '2022-05-20'],
[7, 'Final task', '2022-05-16', '2022-05-20', '2022-04-12',
'm2' => true],
];
$graph = new Goat1000\SVGGraph\SVGGraph(670, 'auto', $options);
$graph->values($values);
$graph->colourRangeHexHSL(0, '#c50', '#c59');
$graph->colourRangeHexHSL(1, '#6a0', '#6a9');
$graph->render('GanttChart');
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.