Is it possible to get the Y-axis value based on the mouse position in unit view


#1

Hi, I am implementing the unit view and want to know is it possible to get the relative Y-axis value when hovering the mouse on the unit view.
For example:

It should get the 10:00 based on the mouse position.
Thanks.


#2

Hello,
You can use the onMouseMove event with getActionData method which returns the current cursor-pointed date and section (if defined):

const dateToStr = scheduler.date.date_to_str("%H:%i");
scheduler.attachEvent("onMouseMove", (id, e) => {
    let action_data = scheduler.getActionData(e);
    console.log(dateToStr(action_data.date));
});

Here is an example in the snippet: https://snippet.dhtmlx.com/cmypwywi. Please open development tools and move the mouse over the scheduler then the relative Y-axis value will be displayed in the console.