Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gantt — Project Timeline Chart

Signature

sp.gantt(title, labels, start, end, *, variant="basic", categories=None, color_values=None, **kwargs) -> Chart

Aliases: sp.gantt, sp.gantt_chart, sp.broken_barh, sp.timeline_chart, sp.project_timeline, sp.build_gantt

Description

sp.gantt() draws one horizontal bar per task spanning from start to end on a shared numeric timeline (day index, epoch, or any consistent unit — no date-typed axis required). Tasks are sorted like every other chart via sort_order, and rows can be grouped by an optional categories list (e.g. team or phase), which colors bars by category with an automatic legend instead of per-row palette rotation. Reuses the labels/start/end/categories fields already on ChartArgs (the same start/end pair used by dumbbell()) — no new parameter shape.

Variants

Data

labels (list[str]) — Task names. start (list[float]) — Task start (numeric timeline unit). end (list[float]) — Task end. categories (list[str]) — Optional group per task; colors bars by group with a legend. color_values (list[float]) — Completion fraction (0–1) per task, used by the "progress" variant.

Parameters

Themes

Returns

Chart — object with .html property and .show() method.

Flat colored bar per task.

Variant "basic"Aliases basic / default / classic / flat
Preview

Outlined bar with an inner fill proportional to `color_values` (0–1 completion fraction) and a `%` label.

Variant "progress"Aliases progress / percent / completion / filled
Preview

Renders zero-duration tasks (`start == end`) as a diamond marker instead of a degenerate bar — the standard way project-planning tools distinguish milestones from work items.

Variant "milestone"Aliases milestone / diamonds / checkpoints / markers
Preview