2015-08-19 4 views

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):

  1. 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*/ 
    
  2. rendent configurable:

    faire quelque chose comme

    TimelineLayout.prototype.setCellW = function(newcellW){ 
    this.cellW = newcellW; 
    } 
    

    référence alors dans la partie ci-dessus.

  3. Utilisez un GridLayout à la place: regarder here pour voir si cela serait suffisant pour vos besoins.