Je travaille sur gojs timeline sample (http://gojs.net/latest/samples/timeline.html) qui est la fonctionnalité par défaut basée sur les dates. J'ai ajouté plus de nombre de nœuds aux nœuds existants en raison de leur chevauchement. puis comment définir l'espacement des nœuds dans cette disposition.comment paramétrer nodespacing dans la mise en page chronologie
0
A
Répondre
0
dans le code prototype dans l'exemple, vous trouverez cette partie, que vous pouvez réécrire:
var bar = line.findObject("BAR");
var length = 100;
var cellw = 100;
if (bar && numweeks > 0) {
length = bar.actualBounds.width;
cellw = length/numweeks;
// set the size of each cell
bar.gridCellSize = new go.Size(cellw, bar.gridCellSize.height);
// offset to account for starting on a non-first day of the week
bar.gridOrigin = new go.Point(convertDateToX(firstsunday), bar.gridOrigin.y);
}
ici, vous avez trois options (en fait deux, 3. est seulement une suggestion):
changer le
var
s:var length = /*the length you want the bar to have (you could take the number of cells * the cellw below)*/ var cellw = /*the length you want each cell to have*/
rendent configurable:
faire quelque chose comme
TimelineLayout.prototype.setCellW = function(newcellW){ this.cellW = newcellW; }
référence alors dans la partie ci-dessus.
- Utilisez un GridLayout à la place: regarder here pour voir si cela serait suffisant pour vos besoins.