/// <summary> /// Acquires an independent axis suitable for use with the data values of the series. /// </summary> /// <returns>Axis instance.</returns> protected override IAxis AcquireIndependentAxis() { IAxis independentAxis = SeriesHost.Axes .Where(a => (a.Orientation == AxisOrientation.X) && ((a is IRangeAxis) || (a is ICategoryAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue))) .FirstOrDefault(); if (null == independentAxis) { object probeValue = DataItems.Any() ? DataItems.First().ActualIndependentValue : null; double convertedDouble; DateTime convertedDateTime; if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDouble)) { independentAxis = new LinearAxis(); } else if ((null != probeValue) && ValueHelper.TryConvert(probeValue, out convertedDateTime)) { independentAxis = new DateTimeAxis(); } else { independentAxis = new CategoryAxis(); } independentAxis.Orientation = AxisOrientation.X; } return(independentAxis); }
public static void Write(this DataItems reportDataItems, CSideWriter writer) { if (writer.CodeStyle.DoNotPrintEmptyReportDataItems) { if (!reportDataItems.Any()) { return; } } writer.BeginSection("DATAITEMS"); foreach (var reportDataItem in reportDataItems) { reportDataItem.Write(writer); } writer.EndSection(); }
private IEnumerable <EfgGrouping> CalculateEfgGrouping() { if (!DataItems.Any()) { return(Enumerable.Empty <EfgGrouping>()); } if (_grouping != null) { return(_grouping); } var grouping = from dataItem in DataItems where IsInExclusiveFeatureGroup(dataItem) group dataItem by new { TakeRateId = dataItem.FdpVolumeHeaderId, dataItem.MarketId, ModelId = dataItem.ModelId.GetValueOrDefault(), dataItem.ExclusiveFeatureGroup } into g select new EfgGrouping { TakeRateId = g.Key.TakeRateId, MarketId = g.Key.MarketId, Market = g.First().Market, ModelId = g.Key.ModelId, Model = g.First().Model, ExclusiveFeatureGroup = g.Key.ExclusiveFeatureGroup, TotalPercentageTakeRate = g.Sum(p => p.PercentageTakeRate), HasStandardFeatureInGroup = g.Any(d => d.IsStandardFeatureInGroup), NumberOfItemsWithTakeRate = g.Count(d => d.PercentageTakeRate > 0), FeatureId = GetFirstFeatureIdentifierInGroup(g) }; _grouping = grouping; return(_grouping); }
/// <summary> /// Acquires a dependent axis suitable for use with the data values of the series. /// </summary> /// <returns>Axis instance.</returns> protected override IAxis AcquireDependentAxis() { IAxis dependentAxis = SeriesHost.Axes .Where(a => (a.Orientation == AxisOrientation.Y) && (a is IRangeAxis) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualDependentValue))) .FirstOrDefault(); if (null == dependentAxis) { LinearAxis linearAxis = new LinearAxis { Orientation = AxisOrientation.Y, ShowGridLines = true }; if (IsStacked100) { Style style = new Style(typeof(AxisLabel)); style.Setters.Add(new Setter(AxisLabel.StringFormatProperty, "{0}%")); linearAxis.AxisLabelStyle = style; } dependentAxis = linearAxis; } return(dependentAxis); }
/// <summary> /// Acquires an independent axis suitable for use with the data values of the series. /// </summary> /// <returns>Axis instance.</returns> protected override IAxis AcquireIndependentAxis() { IAxis independentAxis = SeriesHost.Axes .Where(a => (a.Orientation == IndependentAxisOrientation) && ((a is ICategoryAxis) || (a is IRangeAxis)) && DataItems.Any() && (a.CanPlot(DataItems.First().ActualIndependentValue))) .FirstOrDefault(); if (null == independentAxis) { independentAxis = new CategoryAxis { Orientation = IndependentAxisOrientation }; } return(independentAxis); }
public bool Any() { return(DataItems.Any()); }
public bool Any(string criteria = null) { return(DataItems.Any(GetExpression(criteria))); }
private IEnumerable <FeaturePack> CalculateFeaturePacks() { if (!DataItems.Any()) { return(Enumerable.Empty <FeaturePack>()); } if (_packs != null) { return(_packs); } var packs = (from packItem in PackFeatures group packItem by new { TakeRateId = packItem.FdpVolumeHeaderId, packItem.MarketId, packItem.ModelId, packItem.FeaturePackId, PackName = packItem.FeaturePackName } into g select new FeaturePack { TakeRateId = g.Key.TakeRateId, MarketId = g.Key.MarketId, ModelId = g.Key.ModelId, FeaturePackId = g.Key.FeaturePackId, PackName = g.Key.PackName, PackItems = g.ToList() }) .ToList(); // Populate the actual take rate data for each pack // I changed the way packs and features were determined to cater for features in multiple packs, // just didn't want to rewrite all the take rate routines foreach (var pack in packs) { var featuresInPack = pack.PackItems.Select(f => f.FeatureId).ToList(); pack.DataItems = DataItems .Where(d => d.MarketId == pack.MarketId && d.ModelId.GetValueOrDefault() == pack.ModelId && ( // Feature pack data item featuresInPack.Contains(d.FeatureId.GetValueOrDefault()) || // Feature pack itself (!d.FeatureId.HasValue && d.FeaturePackId.GetValueOrDefault() == pack.FeaturePackId) ) ) .ToList(); if (!pack.DataItems.Any()) { continue; } pack.Market = pack.DataItems.First().Market; pack.Model = pack.DataItems.First().Model; } _packs = packs; return(_packs); }