Gantt Chart
SVG Gantt chart for project management timelines.
Preview
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
| Name | Type | Default |
|---|---|---|
| tasks | list | None | None |
| title | str | None | None |
| unit_label | str | 'Day' |
| units | int | None | None |
| row_height | int | 32 |
| width | int | 600 |
| custom_class | str | '' |
| **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
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.gantt_chart | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 6 of this component's classes at line 2168, 2433, 2434, 2435, 2436, 2437. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |