VijayVishnu
VijayVishnu

Reputation: 537

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

I am working an Angular Gantt Charts. I set my Gantt chart headers to show only minutes. Also I want to set from minutes and to minutes range. I have coded like below. But It always display the entire day view as minutes. Any idea? to show only the range in minutes? and Is It possible to show the headers in milliseconds?

$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>

Upvotes: 3

Views: 2431

Answers (1)

Skanda
Skanda

Reputation: 882

You can add milliseconds to your header. But there seems to be an issue that the range is always from start of day to end of day.

Add headers and headersFormats to your div

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

In your controller define the headerFormats as follows

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

Upvotes: 2

Related Questions