Configure the horizontal axis


#1

I’m ok with time on the vertical axis but i would like to be able to have a sequence of numbers on the horizontal axis instead of day/month/week. Can I have the numbers 1 thru 100 across the horizontal axis?


#2

Hello,
You can specify items of the X-Axis with the help of {timelineName}_scale_date template:
https://docs.dhtmlx.com/scheduler/api__scheduler_{timelinename}_scale_date_template.html ;
You can calculate the ordinal number of the day in the year in the following way:

scheduler.templates.timeline_scale_date = function (date) {
    let start = new Date(date.getFullYear(), 0, 0);
    let diff = +date - +start;
    const oneDay = 1000 * 60 * 60 * 24;
    let dayNum = Math.floor(diff / oneDay);
    return dayNum
}

Please check the example of how it might be imlemented:
https://snippet.dhtmlx.com/kxjgt47a ;
If you want to just specify numbers from 1 to 100 , then you can use onScaleAdd event:
https://docs.dhtmlx.com/scheduler/api__scheduler_onscaleadd_event.html ;
with {timelineName}_scale_date template to return an increasing by one variable:

scheduler.attachEvent("onScaleAdd", function (unit, date) {
    let counter = 1;
    scheduler.templates.timeline_scale_date = function (date) {
        return counter++
    }
});

Please check the following snippet:
https://snippet.dhtmlx.com/c8qm8vxh ;