我正在研究gojs时间轴示例(http://gojs.net/latest/samples/timeline.html),默认情况下是基于日期的功能。我已经向现有节点添加了更多的节点,因为它们相互重叠。 然后如何在此布局中设置nodespacing。
答案 0 :(得分:0)
在示例中的原型代码中,您可以找到这个部分,您可以重写它:
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);
}
这里有三个选项(实际上是两个,只是一个建议):
更改var
:
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*/
使其可配置:
做类似
的事情TimelineLayout.prototype.setCellW = function(newcellW){
this.cellW = newcellW;
}
然后在上面显示的部分中引用它。