如何更改美人鱼甘特图中的标签宽度

问题描述 投票:0回答:3

我正在尝试使用

DiagrammeR
创建甘特图,按照 这个答案

但是,如果部分名称太长,它们就会溢出到图表中。 这是一个例子。

library(DiagrammeR)
mermaid("
  gantt
  dateFormat  YYYY-MM-DD
  title Project timeline

  section A ridiculously long section name
  create data structures                      :done,     frame1,     2019-01-01, 2019-02-28

  section Another long section name
  refactor mistakes in data structures        :active,     frame2,     after frame1, 12w

  section Section 3
  Write code                                  :active,     first_1,    after frame1, 2019-06-30
  Party                                       :crit,       first_2,    after first_1,  7d
  ")

enter image description here

有人知道如何调整部分标签栏的宽度吗?

?mermaid
没有提供任何解释。 此帮助页面(https://mermaidjs.github.io/gantt.html)仅在语法部分中显示“TBD”。

r mermaid
3个回答
5
投票

您可以在该部分的标题中添加“
”以强制换行:

section A ridiculously <br> long section <br> name

5
投票

我没有找到关于这个问题的正确答案。 然后我找到了一个丑陋的解决方法。 我添加了一个在 1 天或更多天前开始的任务,其长度是之前开始的天数

.:01/01/2022, 2d

更改日期和天数以放大标题栏。

我知道这很丑,但它确实有效。


0
投票

我可以通过将此配置添加到我的 mermaidjs 甘特图来扩展“部分”列:

%%{init: { 'gantt': {'leftPadding': 200} } }%%

这是应用了配置的示例甘特图:

%%{init: { 'gantt': {'leftPadding': 200} } }%%
gantt
    title A Gantt Diagram
    dateFormat  YYYY-MM-DD
    section Section I'm a really long section
    A task           :a1, 2024-09-15, 30d
    Another task     :after a1  , 20d
    section Another
    Task in sec      :2024-09-18  , 12d
    another task      : 24d
© www.soinside.com 2019 - 2024. All rights reserved.