posFromDate

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

number posFromDate(Date date);
dateDatea date you want to know the position of
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(2023,02,31)); // -> 0
gantt.posFromDate(new Date(2023,03,1));  // -> 74
gantt.posFromDate(new Date(2023,03,2));  // -> 148
See also
Back to top