mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-14 22:09:29 +02:00
Merge pull request #6693 from mermaid-js/6649-gantt-chart-dateformat
6649: gantt chart date format issue
This commit is contained in:
@@ -609,9 +609,20 @@ export const draw = function (text, id, version, diagObj) {
|
||||
* @param h
|
||||
*/
|
||||
function makeGrid(theSidePad, theTopPad, w, h) {
|
||||
const dateFormat = diagObj.db.getDateFormat();
|
||||
const userAxisFormat = diagObj.db.getAxisFormat();
|
||||
let axisFormat;
|
||||
if (userAxisFormat) {
|
||||
axisFormat = userAxisFormat;
|
||||
} else if (dateFormat === 'D') {
|
||||
axisFormat = '%d';
|
||||
} else {
|
||||
axisFormat = conf.axisFormat ?? '%Y-%m-%d';
|
||||
}
|
||||
|
||||
let bottomXAxis = axisBottom(timeScale)
|
||||
.tickSize(-h + theTopPad + conf.gridLineStartPadding)
|
||||
.tickFormat(timeFormat(diagObj.db.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
||||
.tickFormat(timeFormat(axisFormat));
|
||||
|
||||
const reTickInterval = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/;
|
||||
const resultTickInterval = reTickInterval.exec(
|
||||
@@ -663,7 +674,7 @@ export const draw = function (text, id, version, diagObj) {
|
||||
if (diagObj.db.topAxisEnabled() || conf.topAxis) {
|
||||
let topXAxis = axisTop(timeScale)
|
||||
.tickSize(-h + theTopPad + conf.gridLineStartPadding)
|
||||
.tickFormat(timeFormat(diagObj.db.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
|
||||
.tickFormat(timeFormat(axisFormat));
|
||||
|
||||
if (resultTickInterval !== null) {
|
||||
const every = resultTickInterval[1];
|
||||
|
Reference in New Issue
Block a user