mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 14:29:25 +02:00
Merge branch 'Issue3250/addDateToGantt' into monica_branch
This commit is contained in:
@@ -235,7 +235,6 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
const uniqueTaskOrderIds = [...new Set(theArray.map((item) => item.order))];
|
const uniqueTaskOrderIds = [...new Set(theArray.map((item) => item.order))];
|
||||||
const uniqueTasks = uniqueTaskOrderIds.map((id) => theArray.find((item) => item.order === id));
|
const uniqueTasks = uniqueTaskOrderIds.map((id) => theArray.find((item) => item.order === id));
|
||||||
const numOccurrences = Object.keys(categoryHeights).map((d) => [d, categoryHeights[d]]);
|
const numOccurrences = Object.keys(categoryHeights).map((d) => [d, categoryHeights[d]]);
|
||||||
|
|
||||||
// Draw background rects covering the entire width of the graph, these form the section rows.
|
// Draw background rects covering the entire width of the graph, these form the section rows.
|
||||||
svg
|
svg
|
||||||
.append('g')
|
.append('g')
|
||||||
@@ -261,7 +260,8 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
}
|
}
|
||||||
return 'section section0';
|
return 'section section0';
|
||||||
})
|
})
|
||||||
.data(numOccurrences);
|
.data(numOccurrences)
|
||||||
|
.enter();
|
||||||
|
|
||||||
// Draw the rects representing the tasks
|
// Draw the rects representing the tasks
|
||||||
const rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
|
const rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
|
||||||
@@ -286,7 +286,7 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
0.5 * theBarHeight
|
0.5 * theBarHeight
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// if (d.special) {
|
// if (d.vert) {
|
||||||
// return (
|
// return (
|
||||||
// timeScale(d.startTime) +
|
// timeScale(d.startTime) +
|
||||||
// theSidePad +
|
// theSidePad +
|
||||||
@@ -299,7 +299,7 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
.attr('y', function (d, i) {
|
.attr('y', function (d, i) {
|
||||||
// Ignore the incoming i value and use our order instead
|
// Ignore the incoming i value and use our order instead
|
||||||
i = d.order;
|
i = d.order;
|
||||||
if (d.special) {
|
if (d.vert) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return i * theGap + theTopPad;
|
return i * theGap + theTopPad;
|
||||||
@@ -308,12 +308,22 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
if (d.milestone) {
|
if (d.milestone) {
|
||||||
return theBarHeight;
|
return theBarHeight;
|
||||||
}
|
}
|
||||||
if (d.special) {
|
if (d.vert) {
|
||||||
return 0.005 * theBarHeight;
|
return 0.005 * theBarHeight;
|
||||||
}
|
}
|
||||||
return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
|
return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
|
||||||
})
|
})
|
||||||
.attr('height', theBarHeight)
|
// .attr('height', theBarHeight)
|
||||||
|
.attr('height', function (d) {
|
||||||
|
if (d.vert) {
|
||||||
|
return (
|
||||||
|
conf.gridLineStartPadding +
|
||||||
|
taskArray.length * (conf.barHeight + conf.barGap) +
|
||||||
|
conf.barHeight * 2
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return theBarHeight;
|
||||||
|
})
|
||||||
.attr('transform-origin', function (d, i) {
|
.attr('transform-origin', function (d, i) {
|
||||||
// Ignore the incoming i value and use our order instead
|
// Ignore the incoming i value and use our order instead
|
||||||
i = d.order;
|
i = d.order;
|
||||||
@@ -370,9 +380,8 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
if (d.milestone) {
|
if (d.milestone) {
|
||||||
taskClass = ' milestone ' + taskClass;
|
taskClass = ' milestone ' + taskClass;
|
||||||
}
|
}
|
||||||
|
if (d.vert) {
|
||||||
if (d.special) {
|
taskClass = ' vert ' + taskClass;
|
||||||
taskClass = ' special ' + taskClass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
taskClass += secNum;
|
taskClass += secNum;
|
||||||
@@ -404,6 +413,10 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
if (d.milestone) {
|
if (d.milestone) {
|
||||||
endX = startX + theBarHeight;
|
endX = startX + theBarHeight;
|
||||||
}
|
}
|
||||||
|
if (d.vert) {
|
||||||
|
return startX + theSidePad + (endX - startX) / 2 - this.getBBox().width / 2;
|
||||||
|
}
|
||||||
|
|
||||||
const textWidth = this.getBBox().width;
|
const textWidth = this.getBBox().width;
|
||||||
|
|
||||||
// Check id text width > width of rectangle
|
// Check id text width > width of rectangle
|
||||||
@@ -419,14 +432,8 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
})
|
})
|
||||||
.attr('y', function (d, i) {
|
.attr('y', function (d, i) {
|
||||||
// Ignore the incoming i value and use our order instead
|
// Ignore the incoming i value and use our order instead
|
||||||
if (d.special) {
|
if (d.vert) {
|
||||||
// console.log(d);
|
return conf.gridLineStartPadding + taskArray.length * (conf.barHeight + conf.barGap) + 60;
|
||||||
// console.log(numOccurrences);
|
|
||||||
// console.log((numOccurrences.at(0)).at(1));
|
|
||||||
return (
|
|
||||||
conf.barHeight * numOccurrences.at(0).at(1) * 1.8 + (conf.fontSize / 2 - 2) + theTopPad
|
|
||||||
);
|
|
||||||
// return conf.gridLineStartPadding;
|
|
||||||
}
|
}
|
||||||
i = d.order;
|
i = d.order;
|
||||||
return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
|
return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
|
||||||
@@ -438,6 +445,9 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
if (d.milestone) {
|
if (d.milestone) {
|
||||||
endX = startX + theBarHeight;
|
endX = startX + theBarHeight;
|
||||||
}
|
}
|
||||||
|
if (d.vert) {
|
||||||
|
endX = startX + theBarHeight;
|
||||||
|
}
|
||||||
const textWidth = this.getBBox().width;
|
const textWidth = this.getBBox().width;
|
||||||
|
|
||||||
let classStr = '';
|
let classStr = '';
|
||||||
@@ -476,8 +486,9 @@ export const draw = function (text, id, version, diagObj) {
|
|||||||
if (d.milestone) {
|
if (d.milestone) {
|
||||||
taskType += ' milestoneText';
|
taskType += ' milestoneText';
|
||||||
}
|
}
|
||||||
if (d.special) {
|
|
||||||
taskType += ' specialText';
|
if (d.vert) {
|
||||||
|
taskType += ' vertText';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check id text width > width of rectangle
|
// Check id text width > width of rectangle
|
||||||
|
@@ -237,14 +237,8 @@ const getStyles = (options) =>
|
|||||||
fill: ${options.taskTextDarkColor} !important;
|
fill: ${options.taskTextDarkColor} !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.special {
|
.vertText {
|
||||||
width: 1px;
|
font-size: 15px;
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.specialText {
|
|
||||||
font-weight: bold;
|
|
||||||
fill: red;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.activeCritText0,
|
.activeCritText0,
|
||||||
|
Reference in New Issue
Block a user