public ClusterDataSet <RowItem, int> .DataFrame MakeDataFrame(PivotedProperties.Series series, ClusterRole.Transform clusterValueTransform) { var rows = new List <List <double> >(); foreach (var rowItem in RowItems) { var rawValues = series.PropertyDescriptors.Select(pd => pd.GetValue(rowItem)).ToList(); var valuesToAdd = clusterValueTransform.TransformRow(rawValues) .Select(value => value ?? clusterValueTransform.ValueForNull).ToList(); #if DEBUG foreach (var value in valuesToAdd) { if (double.IsNaN(value) || double.IsInfinity(value)) { Debug.WriteLine(@"{0} is not a valid double", value); } } #endif rows.Add(valuesToAdd); } var columnDatas = new List <ImmutableList <double> >(); for (int i = 0; i < series.PropertyIndexes.Count; i++) { columnDatas.Add(ImmutableList.ValueOf(rows.Select(row => row[i]).ToList())); } return(new ClusterDataSet <RowItem, int> .DataFrame(Enumerable.Range(0, columnDatas.Count), columnDatas)); }
public IEnumerable <Color?> GetSeriesColors(PivotedProperties.Series series, RowItem rowItem) { if (!_seriesColorManagers.TryGetValue(series.SeriesId, out ColorManager colorManager)) { return(Enumerable.Repeat((Color?)null, series.PropertyIndexes.Count)); } return(colorManager.GetRowValues(rowItem).Select(colorManager.ColorScheme.GetColor)); }
private CaptionedValues GetColumnHeaderLevel(IList <RowItem> rowItems, PivotedProperties.Series series) { var values = new List <object>(); foreach (var propertyDescriptor in series.PropertyDescriptors) { values.Add(rowItems.Select(propertyDescriptor.GetValue).FirstOrDefault(v => null != v)); } return(new CaptionedValues(series.SeriesCaption, series.PropertyType, values)); }
public Color?GetColor(PivotedProperties.Series series, object value) { if (!_colorManagers.TryGetValue( ClusteredProperties.PivotedProperties.ItemProperties[series.PropertyIndexes[0]].Name, out ColorManager colorManager)) { return(null); } return(colorManager.ColorScheme.GetColor(value)); }
public static ColumnRef FromPivotedPropertySeries(PivotedProperties.Series series) { if (series.SeriesId is PropertyPath propertyPath) { return(new ColumnRef(propertyPath)); } if (series.SeriesId is IColumnCaption caption) { return(new ColumnRef(new ColumnId(caption))); } return(null); }
public static bool EqualValuesInAllRows(CancellationToken cancellationToken, ReportResults reportResults, PivotedProperties.Series series) { foreach (var propertyDescriptor in series.PropertyDescriptors) { cancellationToken.ThrowIfCancellationRequested(); var distinctValues = reportResults.RowItems.Select(propertyDescriptor.GetValue) .Where(value => null != value).Distinct(); if (distinctValues.Skip(1).Any()) { return(false); } } return(true); }
public ClusterRole GetColumnRole(PivotedProperties.Series series) { _columnRoles.TryGetValue(series.SeriesId, out ClusterRole role); return(role); }
private static ClusteringSpec.ColumnRef ToColumnRef(PivotedProperties.Series series) { return(ClusteringSpec.ColumnRef.FromPivotedPropertySeries(series)); }