How can the timeline font color be changed in a Gantt diagram?

0 votes
asked Jun 8, 2021 in Question / help by 1derer (200 points)

I read in the documentation that the heading background color can be changed with the following:

<style>
ganttDiagram {
   timeline {
      BackgroundColor Bisque
   }
}
</style>

I'm trying to also change the font color for the timeline, but it doesn't work like with other parts of the Gantt like Task, Milestone, Note, etc., so not sure why FontColor, FontSize and all these other attributes are not available for the timeline like with all the other elements of the Gantt. 

Am I using these wrong or they're just not supported yet? If not, can that be added as a feature?

Thanks.

1 Answer

+2 votes
answered Jun 8, 2021 by The-Lu (64,340 points)

Hello 1.,

See similar request here:

With some answer of PlantUML:

Syntax for background was easy.

Since you want to style months, day, weeks, I am not sure about the right option for styles.
Do we have to add "Day", "Month", "Weekday", "Year" ? And don't forget that some days may be closed.
And that you can change the printscale.

It would really help if you could help us to find the right syntax for style.

Thanks !

What are our proposal?

Why not for beginning:

<style>
ganttDiagram {
  timeline {
    BackgroundColor Bisque
    FontName Helvetica 
    FontSize 16
    FontStyle bold
    FontColor purple
  }
  closed {
    BackgroundColor pink
    FontColor red
    FontStyle bold
    FontName Serif
  }
}
</style>

If that can help,
Regards,
Th.

commented Jun 8, 2021 by 1derer (200 points)

Hello! Thanks for the quick answer.

Yes, that would be a good way to start: Just generic Font Name/Size/Style/Color attributes that apply to the whole timeline whatever the scale, which would only be overwritten initially by the "closed" styles, if present.

However, specific attributes could also be available for all standard time units that would apply only as they're derived from the "projectscale" definition or naturally rendered by plantUML to represent the time hierarchy. For example:

<style>
ganttDiagram {
  timeline {
    BackgroundColor Bisque
    FontName Helvetica
    FontSize 16
    FontStyle bold
    FontColor purple
    YearFontColor black
    QuarterFontColor gray
    MonthFontColor black
    WeekFontColor gray
    WeekdayFontColor blue
    DayFontColor lightBlue
  }
  closed {
    BackgroundColor pink
    FontColor red
    FontStyle bold
    FontName Serif
  }
}
</style>

Then, applying that to your example output, whatever time unit not specified would be purple by default if any; "December" and "January" along with "2020" labels would be black as per YearFontColor and MonthFontColor; quarters and week numbers wouldn't show up even if we defined QuarterFontColor and WeekFontColor as gray, because they're not relevant at this scale and don't appear; the week day labels would be blue as per WeekdayFontColor, and the day numbers would be light blue as per DayFontColor.

In addition to that, both week day labels and day numbers would still show up as red every Sunday as per the "closed" style definition.

Not sure if I left out any available time units but it's just to give an idea of how it could be implemented based on date/time stuff I've seen before. 

Thanks.

commented Nov 16, 2021 by Capitán Primate (140 points)
Any news regarding this issue?

Currently we have to save the diagram as SVG and manually edit it with Inkscape or the like.

Thanks in advance!
...