How to display scale by days


Is there any way to display the scale by days number instead of date?
Just like this picture


One of the options is to use gantt.scales.config with format function that expects a date object as a parameter: ;
You can get the configuration of the time scale by getScale method: ;
and get the amount of dates in the timeline area from the trace_x property. You can return the indices dates as numbers in the following way:

gantt.config.scales = [
        unit: "day", step: 1, format: function (date) {
            const scale = gantt.getScale();
            let index = scale.trace_x.findIndex(function (x) {
                return +x === +date
            return index + 1

Please check the example:


Thanks for reply,
And how to remove the offsets Before the first task? I had specify the startDate (gantt.config.start_date), but it seems not work


You can specify the start date of the earliest task as gantt.config.start_date to display a timeline area without empty interval. You can get the start date of the earliest task from the getSubtaskDates method: ;
Please check the example of how it might be implemented: ;