Skip to main content

Generate Gantt charts from JSON descriptions using matplotlib

Project description

jsonantt

jsonantt generates beautiful Gantt chart images from a simple JSON description.
Charts are rendered with matplotlib so they can be saved as .png, .pdf, .svg, and more.


Features

  • Infinitely nestable tasks — define sub-tasks, sub-sub-tasks, etc.
  • Auto date computation — parent task start/end are derived automatically from children when not specified.
  • Milestone markers — easy "milestone": true flag renders a distinctive diamond.
  • Fully colourable — set colours per-task; children inherit their parent's colour.
  • Clean, indented y-axis labels — task names are left-aligned with proper indentation per depth level.
  • PNG / PDF / SVG output — whatever matplotlib supports.

Installation

pip install jsonantt

Or, directly from source:

git clone https://github.com/briday1/jsonantt.git
cd jsonantt
pip install -e .

Quick start

1. Create a JSON description

{
  "title": "My Project",
  "dateformat": "%Y-%m-%d",
  "tasks": [
    {
      "name": "Phase 1 – Planning",
      "children": [
        { "name": "Requirements", "start": "2024-01-08", "end": "2024-01-19" },
        { "name": "Architecture",  "start": "2024-01-15", "end": "2024-01-31" }
      ]
    },
    { "name": "Planning done", "milestone": true, "date": "2024-01-31" },
    {
      "name": "Phase 2 – Build",
      "color": "#70AD47",
      "children": [
        { "name": "Backend",  "start": "2024-02-01", "end": "2024-03-01" },
        { "name": "Frontend", "start": "2024-02-12", "end": "2024-03-08" }
      ]
    },
    { "name": "Launch", "milestone": true, "date": "2024-04-01", "color": "#FF5757" }
  ]
}

2. Generate the chart

CLI:

jsonantt project.json project.png
jsonantt project.json project.pdf   # vector PDF
jsonantt project.json project.svg   # scalable SVG
jsonantt --dpi 300 project.json project.png   # high-resolution PNG

Python API:

from jsonantt import load_chart, render_chart

config = load_chart("project.json")
render_chart(config, "project.png", dpi=150)

JSON reference

Field Type Description
title string Optional chart title shown at the top
dateformat string strptime format string (default: "%Y-%m-%d")
start date string Optional chart x-axis start date (overrides task dates)
end date string Optional chart x-axis end date
style object Visual style overrides (see below)
tasks array Top-level list of task objects

Task object

Field Type Description
name string Required. Task label
start date string Bar start date
end date string Bar end date
color CSS hex string Bar/milestone colour (e.g. "#4472C4")
milestone boolean Render as a diamond milestone instead of a bar
date date string Milestone date (used when milestone: true)
children array Nested sub-tasks (infinitely nestable)

Auto date computation: When a task has children but no explicit start/end, the dates are computed automatically as the earliest child start and latest child end, recursively.

Style object

Field Default Description
width 14 Figure width in inches
row_height 0.45 Height of each task row in inches
bar_height 0.5 Bar height as a fraction of row_height
font_size 9 Base font size in points
indent_size 3 Spaces added per depth level in labels
label_fraction 0.28 Fraction of figure width used for labels
colors palette Array of default hex colours cycled per top-level task
background "#FFFFFF" Figure background colour
grid_color "#E0E0E0" Vertical gridline colour
row_band_color "#F5F5F5" Alternating row band colour
milestone_color "#E65100" Default milestone colour

Examples

See the examples/ folder for ready-to-run JSON files:

Generate them locally:

jsonantt examples/simple.json simple.png
jsonantt examples/complex.json complex.png

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonantt-2026.1.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonantt-2026.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonantt-2026.1.tar.gz.

File metadata

  • Download URL: jsonantt-2026.1.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonantt-2026.1.tar.gz
Algorithm Hash digest
SHA256 dbc0f21a77537591f44e336b2ce8011bb7932903c87a6e2d63387572e6928d7b
MD5 0f10754e19e3afda60c870b54fca6bce
BLAKE2b-256 7983aee4eef717bd5f7e8382cce02ce101fa248ba26c0d4877e822c87edd4814

See more details on using hashes here.

File details

Details for the file jsonantt-2026.1-py3-none-any.whl.

File metadata

  • Download URL: jsonantt-2026.1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jsonantt-2026.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6f80692ebf29b1ea819840d332d9f3af1c567aa4b740938aec22b114116c80c0
MD5 1e17fede589a198457da551f8b7ee8f0
BLAKE2b-256 bc979fccb8a94c27fb65a197f0a81ae3405d2a23de6644b96c668e156b9fdf3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page