How to set displayed date/period of Gantt Chart

I can set the range of the gantt chart but cannot see how you control what the date is displayed.

So e.g. I want the full range to be 1/1/2017 to 31/12/2017 BUT I want it to load showing the chart starting from today (or a date of my choice) and not from 1/1/2017.

Thanks
Mark

3 Replies

SR Suriyaprasanth Ravikumar Syncfusion Team October 10, 2017 09:01 AM UTC

Hi Mark, 

We have analyzed your requirement and we have achieved this in workaround by using create client side event, this event will be triggered after the Gantt control get rendered. 
Please find the code snippet below. 
[HTML] 
   <ej-gantt #GanttControl id="GanttControl" [dataSource]="datasource" (create)="create($event)" ... > 
</ej-gantt> 

[TS] 
   export class AppComponent { 
    //.. 
   create(args) { 
        var ganttObj = $("#GanttControl").ejGantt("instance"), 
            date = new Date('01/10/2013'), // Set date as per your requirement 
            scrollObj = $("#GanttControl").find(".e-ganttviewerbodyContianer").ejScroller("instance"),  
            updatedLeft = ganttObj._getTaskLeft(date); 
        scrollObj.scrollX(updatedLeft) 
    } 
} 

Please find the sample from the below location. 
Please let us know if you need any other assistance.  
 
Regards,  
Suriyaprasanth R. 



MC Mark Chidlow October 11, 2017 01:49 PM UTC

Thank you - this resolved my issue.



SR Suriyaprasanth Ravikumar Syncfusion Team October 12, 2017 05:10 AM UTC

Hi Mark, 
 
Thanks for your update. 
Please let us know if you require any other assistance.  
 
Thanks, 
Suriyaprasanth R.  


Loader.
Up arrow icon