private void GenerateGanttChartFromGraphCompilation() { lock (m_Lock) { GanttChart = null; IList <IDependentActivity <int, int> > dependentActivities = GraphCompilation.DependentActivities .Select(x => (IDependentActivity <int, int>)x.CloneObject()) .ToList(); if (!HasCompilationErrors && dependentActivities.Any()) { List <IDependentActivity <int, int> > orderedActivities = dependentActivities.OrderBy(x => x.EarliestStartTime) .ThenBy(x => x.Duration) .ToList(); ArrowGraphSettingsModel arrowGraphSettings = ArrowGraphSettings; ResourceSeriesSetModel resourceSeriesSet = ResourceSeriesSet; if (arrowGraphSettings != null && resourceSeriesSet != null) { GanttChart = new GanttChartModel { DependentActivities = m_Mapper.Map <List <IDependentActivity <int, int> >, List <DependentActivityModel> >(orderedActivities), ResourceSeriesSet = resourceSeriesSet, IsStale = false, }; } } } PublishGanttChartDataUpdatedPayload(); }
private void GenerateGanttChart() { GanttChartAreaCtrl.ClearGantt(); GanttChartModel ganttChart = ViewModel.GanttChart; if (ganttChart != null) { IList <DependentActivityModel> dependentActivities = ganttChart.DependentActivities; ResourceSeriesSetModel resourceSeriesSet = ganttChart.ResourceSeriesSet; m_DateTimeCalculator.UseBusinessDays(ViewModel.UseBusinessDays); DateTime projectStart = ViewModel.ProjectStart; DateTime minDate = DatePicker.SelectedDate ?? projectStart; DateTime maxDate = minDate.AddDays(DaysSelect.Value.GetValueOrDefault()); GanttChartAreaCtrl.Initialize(minDate, maxDate); // Create timelines and define how they should be presented. GanttChartAreaCtrl.CreateTimeLine(new PeriodYearSplitter(minDate, maxDate), FormatYear); GanttChartAreaCtrl.CreateTimeLine(new PeriodMonthSplitter(minDate, maxDate), FormatMonth); TimeLine gridLineTimeLine = GanttChartAreaCtrl.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDay); //GanttChartAreaCtrl.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDayName); // Attach gridlines. GanttChartAreaCtrl.SetGridLinesTimeline(gridLineTimeLine, DetermineBackground); // Prep formatting helpers. SlackColorFormatLookup colorFormatLookup = null; ArrowGraphSettingsModel arrowGraphSettings = ViewModel.ArrowGraphSettings; if (arrowGraphSettings?.ActivitySeverities != null) { colorFormatLookup = new SlackColorFormatLookup(arrowGraphSettings.ActivitySeverities); } if (GroupByResource.IsChecked.GetValueOrDefault()) { BuildGanttChart(dependentActivities.Select(x => x.Activity), resourceSeriesSet, projectStart, colorFormatLookup); } else { BuildGanttChart(dependentActivities.Select(x => x.Activity), projectStart, colorFormatLookup); } } }