Hi,
When i set TimescaleStart as 3rd day of february and in addition i choose TimescaleUnit.Months, the label of february will not appear unless i change this: project.TimescaleStart = new DateTime(2024, 2, 3, 0, 0, 0); to this project.TimescaleStart = new DateTime(2024, 2, 1, 0, 0, 0);
Example:
DateTime with day set as 3 (17.6 KB)
DateTime with day set as 1 (18.8 KB)
Code i used:
Project project = new Project();
var ganttChartView = (GanttChartView)project.Views.First(v => v.Name == "&Gantt Chart");
SaveOptions options = new PdfSaveOptions()
{
Timescale = Timescale.DefinedInView
};
Aspose.Tasks.Task task = project.RootTask.Children.Add("Summary1");
task.Start = new DateTime(2024,2,1,0,0,0);
task.Finish = new DateTime(2024,5,1,0,0,0);
Aspose.Tasks.Task subtask = task.Children.Add("Subtask1");
subtask.Start = new DateTime(2024, 2, 10, 0, 0, 0);
subtask.Finish = new DateTime(2024, 5, 1, 0, 0, 0);
project.CalculationMode = CalculationMode.None;
project.TimescaleStart = new DateTime(2024, 2, 3, 0, 0, 0);
project.TimescaleFinish = new DateTime(2024, 2, 28, 0, 0, 0);
ganttChartView.TopTimescaleTier = null;
ganttChartView.MiddleTimescaleTier = new TimescaleTier();
ganttChartView.BottomTimescaleTier = new TimescaleTier();
ganttChartView.MiddleTimescaleTier.Count = 1;
ganttChartView.MiddleTimescaleTier.Unit = TimescaleUnit.Months;
ganttChartView.MiddleTimescaleTier.Label = DateLabel.MonthMmmmYyyy;
ganttChartView.BottomTimescaleTier.Count = 1;
ganttChartView.BottomTimescaleTier.Unit = TimescaleUnit.Days;
ganttChartView.BottomTimescaleTier.Label = DateLabel.WeekDayOfMonthDd;
project.Save("CreateTasks_out.pdf", SaveFileFormat.Pdf);