From df194dcb65060d29ca0142514526bd26ae49537b Mon Sep 17 00:00:00 2001 From: STEINNI Date: Wed, 14 Oct 2026 12:26:44 +0000 Subject: [PATCH] better columns VS nodes width and placement --- bzGantt.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bzGantt.js b/bzGantt.js index b85dfbe..a7218e0 100644 --- a/bzGantt.js +++ b/bzGantt.js @@ -30,7 +30,8 @@ class BZgantt extends Buildoz { this.append(this.graflow) this.fireEvent('domConnected', { gantt: this }) - this.dayWidth = this.getBZAttribute('daywidth') || 20 + this.dayWidth = this.getBZAttribute('daywidth') || 20 + this.dayWidthPadding = 10 if(this.getBZAttribute('nodesfile')) this.nodesfile = this.getBZAttribute('nodesfile') else this.initGantt() const dataSrc = this.getBZAttribute('src') @@ -160,7 +161,7 @@ class BZgantt extends Buildoz { "nodeType": "bar", "id": task.id, "coords": { - "x": startIdx * this.dayWidth, + "x": (startIdx * this.dayWidth) + (startIdx > 0 ? this.dayWidthPadding : 0), "y": curY, }, "markup": markup @@ -211,8 +212,8 @@ class BZgantt extends Buildoz { for(let idx=0; idx<=endIdx; idx++){ const dayDiv = document.createElement('div') dayDiv.classList.add('day') - dayDiv.style.left = `calc(var(--chart-left) + ${idx * this.dayWidth}px)` - dayDiv.style.width = this.dayWidth + 'px' + dayDiv.style.left = `calc(var(--chart-left) + ${idx * (this.dayWidth + this.dayWidthPadding)}px)` + dayDiv.style.width = (this.dayWidth + this.dayWidthPadding) + 'px' dayDiv.innerHTML = ' ' + dayDate.getDate() if(dayDate.toISOString().substring(0,10) == (new Date()).toISOString().substring(0,10)) dayDiv.classList.add('today') dayDiv.setAttribute('title', new Intl.DateTimeFormat('fr-FR', {