Angular 甘特图 - 如何设置 from-date 和 to-date 范围以仅显示所需的分钟数?

Angular Gantt - How to set from-date and to-date range to show only required minutes?

我正在制作 Angular 甘特图。我将我的甘特图 headers 设置为仅显示分钟。我也想设置从分钟到分钟的范围。我编码如下。但它总是将一整天的视图显示为分钟。任何的想法?以分钟为单位只显示范围?是否可以在毫秒内显示 headers?

$scope.options = {
 fromDate:new Date(2013, 10, 15, 14, 0, 0),
 toDate:new Date(2013, 10, 15, 17, 50, 0)}

 $scope.data = [   
    {name: 'row2', tasks: [
        {name: 'task3', from: new Date(2013, 10, 15, 15, 0, 0), to: new Date(2013, 10, 15, 15, 10, 0)},
        {name: 'task4', from: new Date(2013, 10, 15, 16, 20, 0), to: new Date(2013, 10, 15, 16, 50, 0)}
      ]
    }
]
<div gantt data="data" from-date = "options.fromDate" to-date = "options.toDate" headers="['minute']" >
<gantt-tree>  </gantt-tree> </div>

您可以将毫秒添加到您的 header。但是似乎有一个问题,范围总是从一天的开始到一天的结束。

将 headers 和 headersFormats 添加到您的 div

<div gantt data="data" from-date = "options.fromDate" to-date = "options.toDate" headers="['seconds', 'milliseconds']" headers-formats="headersFormats">
<gantt-tree>  </gantt-tree> </div>

在您的控制器中定义 header格式如下

$scope.headersFormats = {
  seconds: function(column) {
    return column.date.format('ss');
  },
  milliseconds: function(column) {
    return column.date.format('SSS');
  }
};