Rendered vert task at last + Trying to reposition vert label

This commit is contained in:
nghtlinh
2025-04-09 18:15:26 -04:00
parent 2203792164
commit 81fa2a675f
2 changed files with 7 additions and 6 deletions

View File

@@ -231,10 +231,11 @@ export const draw = function (text, id, version, diagObj) {
* @param w * @param w
*/ */
function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) { function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
// Sort theArray so that tasks with `vert` come last
theArray.sort((a, b) => (a.vert === b.vert ? 0 : a.vert ? 1 : -1));
// Get unique task orders. Required to draw the background rects when display mode is compact. // Get unique task orders. Required to draw the background rects when display mode is compact.
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]]);
// 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')
@@ -260,7 +261,6 @@ export const draw = function (text, id, version, diagObj) {
} }
return 'section section0'; return 'section section0';
}) })
.data(numOccurrences)
.enter(); .enter();
// Draw the rects representing the tasks // Draw the rects representing the tasks
@@ -429,9 +429,10 @@ export const draw = function (text, id, version, diagObj) {
if (d.milestone) { if (d.milestone) {
endX = startX + theBarHeight; endX = startX + theBarHeight;
} }
if (d.vert) { // if (d.vert) {
endX = startX + theBarHeight; // return startX + theSidePad + (endX - startX) / 2 - this.getBBox().width / 2;
} // }
const textWidth = this.getBBox().width; const textWidth = this.getBBox().width;
let classStr = ''; let classStr = '';

View File

@@ -242,8 +242,8 @@ const getStyles = (options) =>
} }
.vertText { .vertText {
font-size: 15px;
fill: navy; fill: navy;
font-size: 15px;
} }
.activeCritText0, .activeCritText0,