Gantt chart

The code below is the source for this graph.

<?php
// Gantt chart
require_once 'SVGGraph/autoloader.php';

$options = [
  'auto_fit' => true,
  'structure' => [
    'key' => 0, 'axis_text' => 1, 'value' => 2, 'end' => 3,
    'complete' => 4,
    'milestone' => 'm',
    'group' => 'g',
    'depends' => 'd', 'depends_type' => 'dt',
  ],
  'show_data_labels' => true,
  'data_label_font_weight' => 'bold',
  'pad_right' => 30,
  'gantt_today_date' => '2022-04-19',
  'bar_space' => 25,
  'gantt_depends_stroke_width' => 1.5,
  'gantt_depends_colour' => '#338',
];

$values = [
  [0, 'Big project', 'g' => 'top'],

  [1, 'First part', 'g' => '*'],
  [2, 'A simple task', '2022-04-01', '2022-04-13', 80],
  [3, 'Second task', '2022-04-05', '2022-04-20', 40, 'd' => 2, 'dt' => 'SS'],

  [4, 'Second part', 'g' => '*', 'd' => 3],
  [5, 'Important date', '2022-04-26', 'm' => true],
  [6, 'Third task', '2022-05-02', '2022-05-17', 10],
  [7, 'Final task', '2022-05-16', '2022-05-20', 0, 'd' => 6, 'dt' => 'FF'],
];

$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.

This site uses cookies - details here.