Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] gantt diagram axis format #269

Closed
tylerlong opened this issue Dec 11, 2015 · 12 comments
Closed

[Feature request] gantt diagram axis format #269

tylerlong opened this issue Dec 11, 2015 · 12 comments
Labels
Type: Enhancement New feature or request

Comments

@tylerlong
Copy link
Collaborator

We can define gantt diagram date format like following:

dateFormat  YYYY-MM-DD

What I am requesting is similar: let user define axis format like following

axisFormat %-m/%-d

Currently user defined axis format is not supported. It can only be done via js code:

mermaid.ganttConfig = {
  axisFormatter: [
    ["%-m/%-d", function (d) {
        return d.getDay() == 1;
    }]
  ]
};
@knsv
Copy link
Collaborator

knsv commented Dec 17, 2015

Thats a good idea! This should be implemented.

@knsv knsv added the Type: Enhancement New feature or request label Dec 27, 2015
@jackycute
Copy link

Please add this feature, thank you!

@surfingtomchen
Copy link

please add this feature, thanks!!!

1 similar comment
@cnglen
Copy link

cnglen commented Dec 9, 2016

please add this feature, thanks!!!

@eagle0445
Copy link

please add this feature, thanks

@chaoslawful
Copy link

please add this feature, thanks!!!

@iwyatt
Copy link

iwyatt commented Jan 30, 2018

Also requesting this feature, thank you.

@nanochap
Copy link

nanochap commented Mar 1, 2018

I need this feature too, thanks.

@tylerlong
Copy link
Collaborator Author

tylerlong commented Mar 15, 2018

This feature is available in latest version.

There are two ways to specify gantt diagram xAxis format:

Option 1

mermaid.initialize({
      gantt: { axisFormat: '%m/%d/%Y' }
});

Then all gantt diagrams in the current web page will use axisFormat: '%m/%d/%Y'

Option 2

<div class="mermaid">
gantt
dateFormat  YYYY-MM-DD
axisFormat  %m/%d/%Y
...
</div>

Then the current gantt diagram will use axisFormat %m/%d/%Y

Which one to use:

Option 1 is like global config while option 2 is like local config. If both are specified, option 2 overrides options 1.

@rhz
Copy link

rhz commented Oct 10, 2018

What is the syntax for axisFormat? Why is it different to that of dateFormat?

@Demmonius
Copy link

Could you please put this solution in the official documentation here: https://mermaid-js.github.io/mermaid/#/gantt?id=syntax ? @tylerlong

@dhld
Copy link

dhld commented Jul 11, 2022

How to control the date of each day on the timeline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests