Timeline day view - Y Data undefined


#1

Hi all,

I am having an issue with timeline scheduler day view. I am not getting the days in the Y Data.
The code I am testing is:

function init() {

		scheduler.locale.labels.timeline_tab = "Timeline";
		scheduler.locale.labels.section_custom="Section";
		scheduler.config.details_on_create=true;
		scheduler.config.details_on_dblclick=true;

		//===============
		//Configuration
		//===============


		scheduler.createTimelineView({
            name:"timeline", 
            render:"days", 
            days:7,   
            //time scale is configured to cover 1 day 
            x_unit:"minute", 
            x_date:"%H:%i",  
            x_step:30,       
            x_size:24,       
            x_start:16       
        });

	    scheduler.templates.timeline_scale_label = function(key, label, section){
        // specifies the same labels as in the Day view
            return scheduler.templates.day_date(label); 
        };
        
		scheduler.init('scheduler_here',new Date(2017,5,30),"timeline");
		scheduler.parse([
			{ "id": "2", "start_date": "2017-06-30 12:00", "end_date": "2017-06-30 14:00", "text": "Section A test"},
			{ "id": "3", "start_date": "2017-07-03 10:00", "end_date": "2017-07-06 11:00", "text": "Section B test"},
			{ "id": "4", "start_date": "2017-06-30 16:00", "end_date": "2017-06-30 18:00", "text": "Section C test"},
			{ "id": "5", "start_date": "2017-06-30 10:00", "end_date": "2017-06-30 15:00", "text": "Section D test"},
			{ "id": "6", "start_date": "2017-06-29 12:00", "end_date": "2017-06-29 14:00", "text": "day before test"},
			{ "id": "7", "start_date": "2017-07-01 12:00", "end_date": "2017-07-01 14:00", "text": "day after test"}]);
	}

The result:

Am I missing something?


#2

Hello,
You can’t use templates in the other templates functions.
If you want to create a timeline with days in the Y-axis sections, you need to use Daytimeline extension. You need to set the start date of the timeline. It can look like this:

scheduler.date[view_name + "_start"] = function (date) {
    let view = scheduler.matrix.timeline;
    date = scheduler.date.month_start(date);
    date = scheduler.date.add(date, view.x_step*view.x_start, view.x_unit);
    return date;
};

And change the dates of the timeline when you are changing the view or the calendar with the help of onBeforeViewChange event:
https://docs.dhtmlx.com/scheduler/api__scheduler_onbeforeviewchange_event.html
Please check the following example:
https://snippet.dhtmlx.com/0ugpigbr