Version

Customize Chart Section of WinGanttView

This topic illustrates the customization options available to modify the look and user interaction of the chart section of WinGanttView™. The chart section of the control is a type of bar chart that displays tasks and task information. The display of bars in the chart section can be customized through the TimelineSettings object. The TimelineSettings object can also be applied to a specific Task.

The following example code assumes that you have an UltraGanttView control dropped onto the form that displays parent and child tasks and task details. For more information on adding tasks to GanttView please see the Adding Tasks to WinGanttView topic.

In Visual Basic:

' Allow drag operation for End Indicator of tasks
Me.ultraGanttView1.TimelineSettings.AllowedDragActions = BarDragActions.EndDateTime
' Set the default back color for child task bars
Me.ultraGanttView1.TimelineSettings.BarSettings.BarAppearance.BackColor = Color.Blue
' Set the default height for child task bars
Me.ultraGanttView1.TimelineSettings.BarSettings.BarHeight = 10
' Set the text to be displayed to the right of child task bars
Me.ultraGanttView1.TimelineSettings.BarSettings.BarTextRight = Infragistics.Win.UltraWinSchedule.TaskUI.BarTextField. ResourceNames
' Set the text to be displayed at the left of child task bars
Me.ultraGanttView1.TimelineSettings.BarSettings.BarTextLeft = Infragistics.Win.UltraWinSchedule.TaskUI.BarTextField.PercentComplete
' Set the default back color for deadline indicators
Me.ultraGanttView1.TimelineSettings.BarSettings.DeadlineIndicatorAppearance.BackColor = Color.Red
' Set the default back color for Percent complete bars within child task bars
Me.ultraGanttView1.TimelineSettings.BarSettings.PercentCompleteBarAppearance.BackColor = Color.Yellow
'Set the height for Percent complete bars within child task bars
Me.ultraGanttView1.TimelineSettings.BarSettings.PercentCompleteBarHeight = 7
'  Set the bar settings for  Summary tasks
Me.ultraGanttView1.TimelineSettings.BarSettingsSummary.BarTextInside = Infragistics.Win.UltraWinSchedule.TaskUI.BarTextField.Name
Me.ultraGanttView1.TimelineSettings.BarSettingsSummary.BarAppearance.BackColor = Color.Wheat
' Allow only dragging of percent complete for a specific Task
Me.ultraGanttView1.CalendarInfo.Tasks[0].Tasks[0].TimelineSettings.AllowedDragActions = BarDragActions.PercentComplete
' Show start and end indicators for child tasks similar to summary tasks
Me.ultraGanttView1.TimelineSettings.BarSettings.StartIndicatorVisible = Infragistics.Win.DefaultableBoolean.True
Me.ultraGanttView1.TimelineSettings.BarSettings.EndIndicatorVisible = Infragistics.Win.DefaultableBoolean.True
' Set the default back color for End Indicators of child task bars
Me.ultraGanttView1.TimelineSettings.BarSettings.EndIndicatorAppearance.BackColor = Color.Green

In C#:

// Allow drag operation for End Indicator of tasks
this.ultraGanttView1.TimelineSettings.AllowedDragActions = BarDragActions.EndDateTime;
// Set the default back color for child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.BarAppearance.BackColor = Color.Blue;
// Set the height for child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.BarHeight = 10;
// Set the Text to be displayed at the right of child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.BarTextRight = Infragistics.Win.UltraWinSchedule.TaskUI.BarTextField.ResourceNames;
// Set the Text to be displayed at the left of child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.BarTextLeft = Infragistics.Win.UltraWinSchedule.TaskUI.BarTextField.PercentComplete;
// Set the default back color for deadline indicators
this.ultraGanttView1.TimelineSettings.BarSettings.DeadlineIndicatorAppearance.BackColor = Color.Red;
// Set the default back color for End Indicators of child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.EndIndicatorAppearance.BackColor = Color.Green;
// Set the default back color for Percent complete bars within child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.PercentCompleteBarAppearance.BackColor = Color.Yellow;
//Set the height for Percent complete bars within child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.PercentCompleteBarHeight = 7;
//  Set the bar settings for  Summary tasks
this.ultraGanttView1.TimelineSettings.BarSettingsSummary.BarTextInside = Infragistics.Win.UltraWinSchedule.TaskUI.BarTextField.Name;
this.ultraGanttView1.TimelineSettings.BarSettingsSummary.BarAppearance.BackColor = Color.Wheat;
// Allow only dragging of percent complete for a specific Task
this.ultraGanttView1.CalendarInfo.Tasks[0].Tasks[0].TimelineSettings.AllowedDragActions = BarDragActions.PercentComplete;
// Show start and end indicators for child tasks similar to summary tasks
this.ultraGanttView1.TimelineSettings.BarSettings.StartIndicatorVisible = Infragistics.Win.DefaultableBoolean.True;
this.ultraGanttView1.TimelineSettings.BarSettings.EndIndicatorVisible = Infragistics.Win.DefaultableBoolean.True;
// Set the default back color for End Indicators of child task bars
this.ultraGanttView1.TimelineSettings.BarSettings.EndIndicatorAppearance.BackColor = Color.Green;
WinGanttView Customize Chart section of WinGanttView 01.png