Mermaid: Add Title To the Graph

Created on 4 Aug 2017  路  10Comments  路  Source: mermaid-js/mermaid

There should be a way to add title to the graph right from Flowchart diagram. I am really sorry if you have one that I didn't find anywhere.

Most helpful comment

Here is a little workaround for adding a fake title to the top down flowchart (TD):

View in Mermaid Live Editor

graph TD

title[<u>My Title</u>]
title-->FirstStep
style title fill:#FFF,stroke:#FFF
linkStyle 0 stroke:#FFF,stroke-width:0;

FirstStep-->...

Add this to the top immediately after the graph TD definition.

This defines a box, styles its text with underscore (<u>, YMMV) and makes the box fill & stroke blank (style title) and links it to the real first step/box (FirstStep) so it appears on top, while making the link hidden using linkStyle 0.

All 10 comments

Here is a little workaround for adding a fake title to the top down flowchart (TD):

View in Mermaid Live Editor

graph TD

title[<u>My Title</u>]
title-->FirstStep
style title fill:#FFF,stroke:#FFF
linkStyle 0 stroke:#FFF,stroke-width:0;

FirstStep-->...

Add this to the top immediately after the graph TD definition.

This defines a box, styles its text with underscore (<u>, YMMV) and makes the box fill & stroke blank (style title) and links it to the real first step/box (FirstStep) so it appears on top, while making the link hidden using linkStyle 0.

@alexkli that is a brilliant idea! It could be used as a nice workaround before we add official support

Any update on that feature ?

@alexkli does not work for Sequence Diagrams unfortunately.

good idea but it also doesn't apply to the left-to-right graphs unfortunately.

Until this issue is resolved, this is another workaround that applies to the left-to-right graphs too.

graph LR
  subgraph This is my caption
    A --> B
  end

which uses a subgraph to display something like

Graph with caption

Any updates on this?

Not yet, but I've got it on my list.

Not yet, but I've got it on my list.

I see, Thanks for the.. update? i gues 'working on it' is still a status update in my book ;)

I'm closing this issue in favour of #1433, please refer to the new issue for future updates. This is still one of the tasks I want to work on once I get the time, so it does not change priorities to close this one :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mestaritonttu picture mestaritonttu  路  3Comments

tokyo786 picture tokyo786  路  3Comments

chen4221 picture chen4221  路  3Comments

visualcurrent picture visualcurrent  路  3Comments

yk-liu picture yk-liu  路  4Comments