Get Started With .NET Gantt Control: Calendars Indicate Work-Free Days

Posted by Alfred Göhlich on May 19, 2015 3:00:00 PM

This is blog #6 of our getting started with VARCHART XGantt series. If you followed all steps from the previous blog posts, you should have developed a pretty impressing Gantt chart application by now.

After we discussed the usage of layers and filters in the .NET Gantt control last time, we now focus on another area which will make your Gantt more meaningful to your users both from a 'look' but also from a 'feel' (i.e. the user interaction with the data) point of view. So, let's take a first look into calendars and how to mark workfree periods within activities.

Using Calendars

By default, XGantt uses a calendar that defines a  5-day week with working times 0-24 h from Monday til Friday. This calendar could be used for highlighting workfree periods in the Gantt chart background by colors, e.g., with gray.


The default calendar can be edited in the Specify Calendars dialog by clicking Button_Edit2 . Moreover, the button_new button allows you to create new calendars. With this, you can individually define different calendars for different shifts ... and can apply them to different resources, resource groups or even tasks. 


Now, we'd like to define 1 May, 2015 as a workfree day. Open the Administrate Intervals dialog by clicking the Button_Edit2 button and click button_new to add the interval NewInterval. New intervals have the profile <NonworkingTime> by default so that in our specific case no changes need to be made. Enter start and end date according to the screenshot below and confirm with OK.


In order to have the workfree periods displayed you have to activate the desired calendar in the EditTimeScaleSection dialog:

  1. Open the Objects property page and select Time scales... 
  2. Click Button_Edit2 to open the EditTimeScaleSection dialog.
  3. Make the settings as shown.


Omitting the selection of a specific calendar, which is indicated by the <not specified> entry, means that the calendar marked by a red triangle in the SpecifyCalendars dialog will be used. Have a look at the result:



Marking Non-Working Intervals in Activities

The visual interruption of the activities by non working intervals can be displayed by setting the option Layers with nonWork interval. However, this option only takes effect, if the activities depend on a calendar. To link nodes to a calendar, you can set the option Nodes use calendars. If not specified otherwise, the default calendar will be used.


Here's the result:

LayersWithNonWorkInterval not checked



Layers with nonWork Intervals checked:



Your next steps

You want to go on programming your application and can't wait for the next sequence of our blog series? We support you by providing a very comprehensive developer's manual, which we highly recommend to use. In addition to this, you can also download our free whitepaper offering 11 best practice tips including code snippets:

Ebook- 11 Best Practice Tips for Advanced Gantt Visualization


For your reference: all posts from this series



Topics: Windows Forms Gantt Control, Gantt Best Practice, Gantt Chart Controls