private BarChartData(DateTimeOffset startDate, DateTimeOffset endDate, bool workspaceIsBillable, DateFormat dateFormat, IImmutableList <BarViewModel> bars, int maximumHoursPerBar, IImmutableList <DateTimeOffset> horizontalLegend) { StartDate = startDate.ToString(dateFormat.Short, CultureInfo.CurrentCulture); EndDate = endDate.ToString(dateFormat.Short, CultureInfo.CurrentCulture); Bars = bars; MaximumHoursPerBar = maximumHoursPerBar; WorkspaceIsBillable = workspaceIsBillable; HorizontalLabels = horizontalLegend ?.Select(date => new BarChartDayLabel(DateTimeOffsetConversion.ToDayOfWeekInitial(date), date.ToString(dateFormat.Short, CultureInfo.CurrentCulture))) .ToImmutableList() ?? ImmutableList <BarChartDayLabel> .Empty; }
private BarChartData(DateTimeOffset startDate, DateTimeOffset endDate, bool workspaceIsBillable, DateFormat dateFormat, BarViewModel[] bars, int maximumHoursPerBar, DateTimeOffset[] horizontalLegend) { StartDate = startDate.ToString(dateFormat.Short, CultureInfo.InvariantCulture); EndDate = endDate.ToString(dateFormat.Short, CultureInfo.InvariantCulture); Bars = bars; MaximumHoursPerBar = maximumHoursPerBar; WorkspaceIsBillable = workspaceIsBillable; if (horizontalLegend != null) { HorizontalLabels = horizontalLegend .Select(date => new BarChartDayLabel(DateTimeOffsetConversion.ToDayOfWeekInitial(date), date.ToString(dateFormat.Short, CultureInfo.InvariantCulture))) .ToArray(); } else { HorizontalLabels = new BarChartDayLabel[0]; } }
private IEnumerable <UILabel> createHorizontalLegendLabels(IEnumerable <DateTimeOffset> dates, DateFormat format) => dates.Select(date => new BarLegendLabel( DateTimeOffsetConversion.ToDayOfWeekInitial(date), date.ToString(format.Short, CultureInfo.InvariantCulture)));