posFromDate

gets the relative horizontal position of the specified date in the chart area

number posFromDate(Date date);

Parameters

dateDatea date you want to know the position of

Returns

numberx-coordinate (in pixels) of the specified date in the timeline

Example

gantt.posFromDate(new Date());

Details

The method returns the position of a date that is currently rendered in the Gantt chart. If a date isn't rendered in the chart - the method will return 'null'.

For example, for the Gantt chart above, the method will return the following:

gantt.posFromDate(new Date(2013,02,31)); // -> 0
gantt.posFromDate(new Date(2013,03,1));  // -> 74
gantt.posFromDate(new Date(2013,03,2));  // -> 148
Back to top