간트 차트 렌더링

개요

Gantt 차트는 프로젝트 일정, 작업 계층, 기간 및 종속성을 시각화하는 데 널리 사용됩니다. aspose.tasks.

Microsoft Project를 사용하면 사용자가 Gantt 차트에 표시되는 타임 스케일을 설정할 수 있습니다. (TimesCale은 Gantt 차트보기의 상단에 표시됩니다.) 필요한 시간 분해능을 정확하게 제공하기 위해 최대 3 개의 타임 스케일을 가질 수 있습니다.

aspose.tasks for .NET 은이 기능을 지원하고 다양한 시간 확장 설정으로 Gantt 차트를 렌더링 할 수 있습니다. Gantt 차트는 이러한 옵션을 사용하여 1 페이지 이미지로 렌더링 할 수 있습니다.

지원되는 출력 형식

간트 차트는 다음으로 내보낼 수 있습니다.

일반적인 사용 사례에는 다음이 포함됩니다.

타임 스케일 설정 및 이미지에 저장

ImagesAveOptions 클래스의 시간 규모 속성은 프로젝트의 시간 규모 설정을 결정합니다. 타임 스케일은 기본적으로 며칠로 설정됩니다. 다른 옵션은 달과 3 개월입니다.

다음 코드 샘플 :

  1. 프로젝트 파일을 읽습니다.
  2. 각각의 다른 타임 스케일 설정을 설정합니다.
  3. 파일을 디스크에 JPG로 저장합니다.

Key Rendering Settings

PropertyDescription
ImageSaveOptions.TimescaleDefines timeline scale (Days, Months, etc.)
RollUpGanttBarsEnables rolled-up summary bars
DrawNonWorkingTimeToggles rendering of non-working hours/days
TextFormatterCustomizes task labels dynamically
StringAlignmentControls alignment of text in columns
UseGradientBrushEnables MS Project–like gradient fill

Rolling Up Gantt Bars During Rendering

Also, if SaveOptions.DrawNonWorkingTime (default value = true) is set to false, non-working time will not be shown on the Gantt chart.

Example 1: Gantt Chart Bars Not Rolled Up

The output from example 1

rendering Gantt Chart without bar rollup

Example 2: Rolling Up Gantt Chart Bars

In this example, SaveOptions.RollUpGanttBars = true, SaveOptions.DrawNonWorkingTime = true, and task.HideBar = false for hidden tasks.

The output from example 2

rendering Gantt Chart with rolled up bar

Customize Text with Task Bars

In this example, the text on the right of the taskbar can be customized by delegate instance. Here we customize the text on the critical tasks.

Align Cell Contents

Text can be aligned by GanttChartColumn.StringAlignment, ResourceViewColumn.StringAlignment properties. Alignment by default is StringAlignment.Near (left).

Changing Gantt Chart Bars Color Gradient

Microsoft Project allows users to render the output of Gantt charts using gradients. The same functionality is provided by Aspose.Tasks as shown in the following sample code.

Setting Start date of Gantt Chart View

The TimeScaleStart property exposed by Prj class allows to set the start date of the Gantt chart view. However, if the saved file is opened by MSP in maximized window mode then the timescale start date will not match.

Aspose.Tasks for .NET provides comprehensive capabilities for exporting Gantt charts with full control over layout, style, and visual logic. Whether you’re generating visual reports, printing schedules, or embedding task data into dashboards — the flexible rendering engine supports your use case.

You can further explore:

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.