Gantt Chart

SVG Gantt chart for project management timelines.

python 8 params

Preview

Sprint plan123456789DesignDesign: Day 0-3BuildBuild: Day 2-7ShipShip: Day 6-8
Arguments
gantt_chart(title='Sprint plan', tasks=[{'name': 'Design', 'start': 0, 'duration': 3}, {'name': 'Build', 'start': 2, 'duration': 5}, {'name': 'Ship', 'start': 6, 'duration': 2}])

Usage

views.py
python
from djust import LiveView
from djust.components import GanttChart


class MyView(LiveView):
    template_name = "my_template.html"

    def mount(self, request, **kwargs):
        self.component = GanttChart(title='Sprint plan', tasks=[{'name': 'Design', 'start': 0, 'duration': 3}, {'name': 'Build', 'start': 2, 'duration': 5}, {'name': 'Ship', 'start': 6, 'duration': 2}])
my_template.html
django
{{ component }}

Parameters

NameTypeDefaultDescription
taskslist | NoneNoneList of dicts with ``name``, ``start`` (unit offset), ``duration`` (units), optional ``color``, ``progress`` (0-1)
titlestr | NoneNoneOptional chart title
unit_labelstr'Day'Label for time units (default: "Day")
unitsint | NoneNoneNumber of time units to display (auto-calculated if omitted)
row_heightint32Height per row in px (default: 32)
widthint600SVG width (default: 600)
custom_classstr''Additional CSS classes
**kwargs— passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state——
Source & styles
FilePathNotes
moduledjust.components.components.gantt_chartSubclass it, or pass custom_class, to change how it renders.
cssdjust_components/components.cssDefines 6 of this component's classes at line 2224, 2536, 2537, 2538, 2539, 2540. Override those rules, or the custom properties they read, in a stylesheet loaded after it.