GanttChart

class GanttChart

Represents a Gantt chart

addItem(Milestone|Section|Task|VerticalMarker ...$item)

Add item(s) to the GanttChart

Parameters:
  • $item (Milestone|Section|Task|VerticalMarker) – The item(s)

Returns:

A new GanttChart instance with the item(s) added

Return type:

GanttChart

render(array $attributes = [])

Renders the diagram

Parameters:
  • $attributes (array) –

    HTML attributes for the <pre> tag as name=>value pairs

    Note

    The mermaid class is added

Returns:

Mermaid diagram code in a <pre> tag

Return type:

string

withComment(string $comment)

Set a comment for the chart

Parameters:
  • $comment (string) – The comment

Returns:

A new GanttChart instance with the comment

Return type:

GanttChart

withItem(Milestone|Section|Task|VerticalMarker ...$item)

Set GanttChart item(s)

Parameters:
  • $item (Milestone|Section|Task|VerticalMarker) – The item(s)

Returns:

A new GanttChart instance with the item(s)

Return type:

GanttChart

withAxisFormat(string $axisFormat)

Set the axis date format

See Output date format on the axis

Parameters:
  • $item (Milestone|Section|Task) – The item(s)

Returns:

A new GanttChart instance with the item(s)

Return type:

GanttChart

withDateFormat(string $dateFormat)

Set the chart input date format

See Input date format

Parameters:
  • $dateFormat (string) – The date format

Returns:

A new GanttChart instance with the date format

Return type:

GanttChart

withExcludes(string|Exclude ...$excludes)

Set day(s) that are excluded from task duration calculations

Parameters:
  • ...$excludes (string|Exclude) – Day(s) that are excluded from task duration calculations as either a date in the the date format (withDateFormat) or an Exclude enum

Returns:

A new GanttChart instance with the excluded date(s)

Return type:

GanttChart

withStartOfWeek(Weekday $weekday)

Sets the start of the week

Tick markers are placed on the start of the week

Parameters:
  • $weekday (Weekday) – The item(s)

Returns:

A new GanttChart instance with the item(s)

Return type:

GanttChart

withTickInterval(string $tickInterval)

Sets the chart tick interval

Parameters:
  • $tickInterval (string) – The tick interval as a period in the form nt where n is an integer and t is a period, e.g. week

Returns:

A new GanttChart instance with the tick interval

Return type:

GanttChart

withTitle(string $title)

Set a title for the chart

Parameters:
  • $title (string) – The title

Returns:

A new GanttChart instance with the title

Return type:

GanttChart

withTodayMarker(string $todayMarker)

Set the style for the today marker

Parameters:
  • $title (string) – The today marker style. Use off to hide the today marker

Returns:

A new GanttChart instance with the today marker styled

Return type:

GanttChart

withWeekend(Weekend $weekend)

Set the first day of the weekend

Weekends are two days long

Parameters:
  • $weekend (Weekend) – The first day of the weekend

Returns:

A new GanttChart instance with the first day of the weekend

Return type:

GanttChart