Get Date by X on Chart

Is there any API where I can provide the X and/or Y coords and get the date? Like gantt.getDateAt(x,y): Date?

I have a custom element that I added through the addTimelineLayer API and now I have to handle the drag and drop of it, so while dragging it around I have to identify its current position so that I have to either render it in the middle of the grid column, or extend the timeline in case it hits the borders. By the way, the task does this, is there any way to maybe reuse this behaviour?


You can try using dateFromPos method that returns the date according to “x” position and combine it with getScrollState method:
However, the timeline is not displayed under the grid. In the following example you will see the date in the web console after you move the mouse. When it is above the grid, you will see “null”:

1 Like

Thank you once again @ramil!