Skip to content

Commit bdb175b

Browse files
committed
Update structure + svg exportSVG
1 parent 3ae8078 commit bdb175b

5 files changed

Lines changed: 370 additions & 308 deletions

File tree

gantt/README.md

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@
22

33
A lightweight, browser-native Gantt chart tool. No server, no dependencies, no build step — just open `index.html`.
44

5+
**[Live demo →](https://grantim.github.io/gantt)**
6+
57
---
68

79
## Features
810

9-
- **CSV Import** — drag-and-drop, file browse, or paste directly
11+
- **CSV Import** — drag-and-drop, file browse, or paste directly; chart auto-updates on change
1012
- **Task Editor** — spreadsheet-style table that syncs both ways with the CSV
1113
- **Auto-duration parents** — leave duration blank and the tool calculates it from children
12-
- **Thread rows** — tasks sharing a Thread Id are grouped into a single row
13-
- **Sublayers** — nested tasks stack visually within their row by depth
14-
- **Resizable sidebar** — drag the divider to give more room to the chart
14+
- **Thread rows** — tasks sharing a Thread Id are grouped into a single row with sublayers
15+
- **Dependency-order scheduling** — topological sort ensures correct ordering regardless of CSV row order
1516
- **Hover tooltips** — start, end, duration, depth, parent, and requirements on every bar
17+
- **Light / dark theme** — toggle in the topbar; preference persisted to localStorage
1618
- **CSV export** — download the current task list at any time
19+
- **SVG export** — download a self-contained, fully styled SVG (transparent background, fills container width)
20+
- **Mobile responsive** — bottom-nav tab layout, touch tooltips, auto re-render on rotation
21+
- **LocalStorage persistence** — CSV content saved automatically and restored on reload
1722

1823
---
1924

2025
## CSV Format
2126

22-
| Column | Description |
23-
|---|---|
24-
| **Task Name** | Unique identifier for the task |
25-
| **Task Duration** | Duration in any consistent unit (days, seconds…). Leave blank to auto-compute from children |
26-
| **Parent Task** | Name of the parent task (for grouping / sublayers) |
27-
| **Required Tasks** | Semicolon-separated list of tasks that must finish before this one starts |
28-
| **Thread Id** | Tasks with the same Thread Id share a row and run sequentially within the same parent |
27+
| Column | Required | Description |
28+
|---|---|---|
29+
| **Task Name** | | Unique identifier for the task |
30+
| **Task Duration** | | Duration in any consistent unit (seconds, days…). Leave blank to auto-compute from children |
31+
| **Parent Task** | | Name of the parent task for grouping and sublayer nesting |
32+
| **Required Tasks** | | Semicolon-separated tasks that must finish before this one starts |
33+
| **Thread Id** | | Tasks with the same Thread Id share a row and are chained sequentially within the same parent |
2934

3035
---
3136

@@ -55,55 +60,60 @@ Production Deploy,1,Release & Deploy,QA Sign-off,Ops
5560
Post-deploy Monitor,2,Release & Deploy,Production Deploy,Ops
5661
```
5762

58-
This produces a 26-day timeline across three threads:
63+
Three threads running in parallel across a 26-day timeline. Parent tasks (`Release v2.4`, `Design & Planning`, etc.) have blank durations — resolved automatically from their children.
64+
65+
---
5966

60-
- **Backend** — Design & Planning (days 0–6) → parallel Auth/Payments/Notifications → Integration Tests
61-
- **Frontend** — runs in parallel with Backend Work after planning; UI Components → Auth Flow + Checkout Flow → E2E Tests
62-
- **Ops** — Release & Deploy phase begins once both Backend Work and Frontend Work are complete
67+
## Scheduling Rules
6368

64-
The five parent tasks (`Release v2.4`, `Design & Planning`, `Backend Work`, `Frontend Work`, `Release & Deploy`) all have blank durations — the tool resolves them automatically from their children.
69+
1. A task starts after all its **Required Tasks** have finished.
70+
2. A task starts no earlier than its **Parent Task** starts.
71+
3. Tasks on the same **Thread Id** with the same parent are topologically sorted then linked sequentially — works correctly regardless of CSV row order.
72+
4. **Null-duration parents** are resolved iteratively: the scheduler reruns until each parent's span converges to the actual max end of its children, handling arbitrarily deep nesting.
6573

6674
---
6775

68-
## Files
76+
## File Structure
6977

7078
```
71-
index.html — markup only; links to gantt.css and gantt.js
72-
gantt.css — all styles and design tokens
73-
gantt.js — parsing, scheduling, rendering, and UI logic
74-
favicon.svg — app icon
75-
example.csv — the software release pipeline above
76-
README.md — this file
79+
index.html — app shell; loads gantt-core.js + gantt-ui.js
80+
gantt-core.js — pure logic: CSV parsing, scheduling, SVG export (no DOM)
81+
gantt-ui.js — DOM: tooltips, panels, table editor, export, theme, auto-render
82+
gantt.css — styles and design tokens (light + dark theme)
83+
favicon.svg — app icon
84+
example.csv — the software release pipeline above
85+
svg/
86+
index.html — SVG-only endpoint: ?csv=<b64>&w=&h=&theme= → raw SVG
87+
README.md — this file
7788
```
7889

7990
---
8091

81-
## Scheduling Rules
82-
83-
1. A task starts after all its **Required Tasks** have finished.
84-
2. A task starts no earlier than its **Parent Task** starts.
85-
3. Tasks on the same **Thread Id** with the same parent are linked sequentially (the tool injects the dependency automatically).
86-
4. **Null-duration parents** are resolved iteratively: the scheduler runs until each parent's span converges to the actual max end of its children — handling arbitrarily deep nesting correctly.
92+
## SVG Export
8793

88-
---
94+
Click **↓ SVG** in the topbar to download a self-contained SVG of the current chart.
8995

90-
## Disclaimer
96+
The SVG uses `width="100%"` with a `viewBox`, so it scales to any container. The export function also accepts options programmatically:
9197

92-
This tool was built in collaboration with **Claude** (Anthropic), an AI assistant.
98+
```js
99+
buildGanttSVG(tasks, threadOrder, {
100+
width: 1600, // internal coordinate width (default: 1600)
101+
height: null, // null = auto-fit to row count
102+
theme: 'dark', // 'dark' | 'light' | null (reads live CSS vars)
103+
})
104+
```
93105

94-
The scheduling engine, null-duration resolution algorithm, visual depth computation, CSV parser, and the iterative convergence loop were all designed and debugged through an extended conversation with Claude — including several subtle bugs that Claude caught, reasoned through, and fixed:
106+
To embed in a GitHub README, download the SVG, commit it to your repo, and link the raw URL:
95107

96-
- Thread injection creating false cross-subtree dependencies
97-
- Null-duration parents not covering their grandchildren
98-
- Two-pass scheduling underestimating parallel child spans
99-
- Iterative convergence needed for deeply nested null-duration tasks
108+
```markdown
109+
![Gantt Chart](https://raw.githubusercontent.com/you/repo/main/docs/gantt.svg)
110+
```
100111

101-
The UI, color palette, layout, and overall design were also shaped by Claude's suggestions.
112+
---
102113

103-
Claude's contributions here go well beyond autocomplete — it acted as a genuine engineering partner, holding the full context of the scheduling logic across many iterations and proposing architecturally sound fixes rather than patches.
114+
## Disclaimer
104115

105-
> *"The best code review is one where the reviewer understands the problem better than you do."*
106-
> Claude understood this problem very well.
116+
Built in collaboration with **Claude** (Anthropic). The scheduling engine, null-duration resolution, topological sort, visual depth computation, CSV parser, SVG renderer, mobile layout, and iterative convergence logic were all designed and debugged through an extended conversation with Claude — including several subtle bugs caught, reasoned through, and fixed along the way.
107117

108118
---
109119

0 commit comments

Comments
 (0)