Skip to content

Instantly share code, notes, and snippets.

@matthewfeickert
Last active September 22, 2019 21:17
Show Gist options
  • Save matthewfeickert/7be2caa8bea32fc20dff895ab1c3565a to your computer and use it in GitHub Desktop.
Save matthewfeickert/7be2caa8bea32fc20dff895ab1c3565a to your computer and use it in GitHub Desktop.
Example of Gantt charts made with Mermaid JS

Example of Gantt charts made with Mermaid JS

Mermaid JS supports Gantt charts. It is reasonable to want to be able to make Gantt charts though without having to run a website and instead use a command line utility. This can be a pain, so I made a Docker image that has mermaid and mermaid.cli installed so that you can use the image as the utility.

As an example, to make the example that is shown on the Mermaid JS website (included here as example.mmd) we would first pull the image from Docker Hub

docker pull matthewfeickert/mermaid-cli

and then run it at the command line to make a .PNG file Gantt chart

docker run --rm -v "${PWD}":/home/node/data matthewfeickert/mermaid-cli -i example.mmd -o example.png

This Gist also has a Makefile to help script this more usefully.

Examples in the "wild"

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
default: example
all: example key
example: example.mmd
docker run --rm -v "${PWD}":/home/node/data matthewfeickert/mermaid-cli -i example.mmd -o example.svg
docker run --rm -v "${PWD}":/home/node/data matthewfeickert/mermaid-cli -i example.mmd -o example.pdf
docker run --rm -v "${PWD}":/home/node/data matthewfeickert/mermaid-cli -i example.mmd -o example.png
key: gantt_key.mmd
docker run --rm -v "${PWD}":/home/node/data matthewfeickert/mermaid-cli -i gantt_key.mmd -o gantt_key.svg
docker run --rm -v "${PWD}":/home/node/data matthewfeickert/mermaid-cli -i gantt_key.mmd -o gantt_key.pdf
docker run --rm -v "${PWD}":/home/node/data matthewfeickert/mermaid-cli -i gantt_key.mmd -o gantt_key.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment