GanttChartView class

Represents a GanttChart view.

public class GanttChartView : View


Name Description
GanttChartView() Initializes a new instance of the GanttChartView class.


Name Description
AutoFilters { get; } Gets a list of auto filters of a Gantt Chart view.
BarRounding { get; set; } Gets or sets a value indicating whether the bars round to the nearest day. The default value is True.
BarSize { get; set; } Gets or sets the height, in points, of the Gantt bars in the Gantt Chart.
BarStyles { get; } Gets a list of parent (common) bar styles of the Gantt Chart view. GanttBarStyle.
BottomTimescaleTier { get; set; } Gets or sets settings of view’s bottom timescale tier. TimescaleTier
CustomBarStyles { get; } Gets a list of custom task-specific bar styles of the Gantt Chart view. GanttBarStyle.
Filter { get; set; } Gets or sets a filter used in a single view.
Gridlines { get; set; } Gets or sets a list of Gridlines of the Gantt Chart view.
Group { get; set; } Gets or sets a group of the single view.
HideRollupBarsWhenSummaryExpanded { get; set; } Gets or sets a value indicating whether rollup bars will be hidden when expanding summary task.
HighlightFilter { get; set; } Gets or sets a value indicating whether Microsoft Project highlights the filter for a single view.
MiddleTimescaleTier { get; set; } Gets or sets settings of view’s middle timescale tier. TimescaleTier.
Name { get; set; } Gets or sets the name of a View object.
NonWorkingTimeColor { get; set; } Gets or sets non-working time color.
PageInfo { get; } Gets an instance of the PageInfo class. Represents page setup data which is present in mpp file format.
ParentProject { get; } Gets the parent of the View object. Read-only Project.
ProgressLines { get; set; } Gets or sets progress lines for the Gantt Chart view. ProgressLines.
RollUpGanttBars { get; set; } Gets or sets a value indicating whether bars on the Gantt Chart must be rolled up.
Screen { get; } Gets the screen type for the single view. Read-only ViewScreen.
ShowBarSplits { get; set; } Gets or sets a value indicating whether task splits on the Gantt Chart must be shown.
ShowDrawings { get; set; } Gets or sets a value indicating whether drawings on the Gantt Chart must be shown.
ShowInMenu { get; set; } Gets or sets a value indicating whether Microsoft Project shows the single view name in the View or the Other Views drop-down lists in the Ribbon.
Table { get; set; } Gets or sets a table of the single view.
TableTextStyles { get; } Gets a list of table text styles of the Gantt Chart view. TableTextStyle.
TextStyles { get; set; } Gets or sets a list of TextStyle of the Gantt Chart view.
TimescaleSizePercentage { get; set; }
TopTimescaleTier { get; set; } Gets or sets settings of view’s top timescale tier. TimescaleTier.
Type { get; } Gets the type of item in the single view, such as tasks or resources. Read-only ItemType.
Uid { get; } Gets the unique identifier of a view.
VisualObjectsPlacements { get; } Gets a collection of objects representing placement and appearance of OleObject in the view.


Name Description
CompareTo(View) Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
override Equals(object) Returns a value indicating whether this instance is equal to a specified object.
override GetHashCode() Returns a hash code value for the instance of the Resource class.


Shows how to modify timescale tiers.

var project = new Project();

// Init Gantt Chart View
var view = new GanttChartView
    TopTimescaleTier = new TimescaleTier(),
    MiddleTimescaleTier = new TimescaleTier(),
    BottomTimescaleTier = new TimescaleTier()

// set Time Scale count
view.TopTimescaleTier.Count = 2;
view.TopTimescaleTier.Unit = TimescaleUnit.Quarters;
view.TopTimescaleTier.Label = DateLabel.QuarterQQyy;
view.TopTimescaleTier.ShowTicks = false;

view.MiddleTimescaleTier.Count = 2;
view.MiddleTimescaleTier.Unit = TimescaleUnit.Weeks;
view.MiddleTimescaleTier.Label = DateLabel.WeekDddDd;
view.MiddleTimescaleTier.ShowTicks = false;

view.BottomTimescaleTier.Unit = TimescaleUnit.Days;
view.BottomTimescaleTier.Label = DateLabel.DayDdd;
view.BottomTimescaleTier.Count = 2;
view.BottomTimescaleTier.ShowTicks = false;

// add Gantt Chart View to project

// add some test data to project
var task1 = project.RootTask.Children.Add("Task 1");
var task2 = project.RootTask.Children.Add("Task 2");
task1.Set(Tsk.Duration, task1.ParentProject.GetDuration(24, TimeUnitType.Hour));
task2.Set(Tsk.Duration, task1.ParentProject.GetDuration(40, TimeUnitType.Hour));

// Use 'Timescale.DefinedInView' option to render timescales using timescale settings which we have set (view.TopTimescaleTier, view.MiddleTimescaleTier, view.BottomTimescaleTier). 
var pdfSaveOptions = new PdfSaveOptions
    Timescale = Timescale.DefinedInView,
    StartDate = DateTime.Now.AddDays(-30),
    EndDate = DateTime.Now.AddDays(30)

project.Save(OutDir + "WorkWithTimescaleTier_out.pdf", pdfSaveOptions);

See Also