how to draw repeating tasks in Gantt chart using mermaid

175 views Asked by At

I was using Typora to draw Gantt chart with mermaid and couldn't find a way to draw repeating tasks. The code as follows:

gantt
dateFormat ss
axisFormat %S
    section Round Robin scheduling
    p1: a, 00, 01
    p2: a, 01, 02
    p3: a, 02, 03
    p4: a, 03, 04
    p5: a, 04, 05
    p1: a, 05, 06

picture of that gantt chart
it turns out to be that the repeating tasks of p1 are not in the same line. The latter p1 is recognized as another task. How can I achieve this?

1

There are 1 answers

0
Chris On BEST ANSWER

I don't think there's any way to get just p1 on the same line both times, but you can use the compact display mode to collapse tasks onto the same line when they fit:

<script type="module">
  import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
  mermaid.initialize({ startOnLoad: true });
</script>

<pre class="mermaid">
---
displayMode: compact
---

%% The preceding YAML block turns on compact mode

gantt
dateFormat ss
axisFormat %S
    section Round Robin scheduling
    p1: a, 00, 01
    p2: a, 01, 02
    p3: a, 02, 03
    p4: a, 03, 04
    p5: a, 04, 05
    p1: a, 05, 06
</pre>