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 · 10 comments

Comments

Projects
None yet
10 participants
@tylerlong
Collaborator

tylerlong commented Dec 11, 2015

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

This comment has been minimized.

Owner

knsv commented Dec 17, 2015

Thats a good idea! This should be implemented.

@knsv knsv added the enhancement label Dec 27, 2015

@jackycute

This comment has been minimized.

jackycute commented Sep 29, 2016

Please add this feature, thank you!

@surfingtomchen

This comment has been minimized.

surfingtomchen commented Oct 26, 2016

please add this feature, thanks!!!

1 similar comment
@cnglen

This comment has been minimized.

cnglen commented Dec 9, 2016

please add this feature, thanks!!!

@eagle0445

This comment has been minimized.

eagle0445 commented Mar 23, 2017

please add this feature, thanks

@chaoslawful

This comment has been minimized.

chaoslawful commented Jul 26, 2017

please add this feature, thanks!!!

@iwyatt

This comment has been minimized.

iwyatt commented Jan 30, 2018

Also requesting this feature, thank you.

@nanochap

This comment has been minimized.

nanochap commented Mar 1, 2018

I need this feature too, thanks.

@tylerlong

This comment has been minimized.

Collaborator

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

This comment has been minimized.

rhz commented Oct 10, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment