public Clusterer(CancellationToken cancellationToken, IEnumerable <RowItem> rowItems, ClusteredProperties properties, ClusterMetricType distanceMetric) { CancellationToken = cancellationToken; RowItems = ImmutableList.ValueOf(rowItems); Properties = properties; RowHeaderLevels = ImmutableList.ValueOf(Properties.RowHeaders); DistanceMetric = distanceMetric; }
private ReportColorScheme(ClusteredProperties clusteredProperties, Dictionary <string, ColorManager> managers, Dictionary <string, Color> columnColors, Dictionary <object, ColorManager> seriesColorManagers) { ClusteredProperties = clusteredProperties; _colorManagers = managers; _columnColors = columnColors; _seriesColorManagers = seriesColorManagers; }
public static Clusterer CreateClusterer(CancellationToken cancellationToken, ClusteringSpec clusteringSpec, ReportResults reportResults) { var pivotedPropertySet = new PivotedProperties(reportResults.ItemProperties); pivotedPropertySet = pivotedPropertySet.ChangeSeriesGroups(pivotedPropertySet.CreateSeriesGroups()).ReorderItemProperties(); var clusteredProperties = ClusteredProperties.FromClusteringSpec(clusteringSpec, pivotedPropertySet); if (!clusteredProperties.RowValues.Any() && !clusteredProperties.ColumnValues.Any()) { clusteringSpec = ClusteringSpec.GetDefaultClusteringSpec(cancellationToken, reportResults, pivotedPropertySet); if (clusteringSpec == null) { return(null); } clusteredProperties = ClusteredProperties.FromClusteringSpec(clusteringSpec, pivotedPropertySet); } return(new Clusterer(cancellationToken, reportResults.RowItems, clusteredProperties, ClusterMetricType.FromName(clusteringSpec.DistanceMetric) ?? ClusterMetricType.DEFAULT)); }
public ClusteredReportResults(IEnumerable <RowItem> rowItems, ClusteredProperties clusteredProperties, CaptionedDendrogramData rowDendrogramData, IEnumerable <CaptionedDendrogramData> columnDendrogramDatas) : base(rowItems, clusteredProperties.PivotedProperties.ItemProperties) { if (rowDendrogramData != null && rowDendrogramData.DendrogramData.LeafCount != RowItems.Count) { throw new ArgumentException(@"Row count does not match", nameof(rowDendrogramData)); } RowDendrogramData = rowDendrogramData; ClusteredProperties = clusteredProperties; var colDendrograms = ImmutableList.ValueOf(columnDendrogramDatas); if (colDendrograms != null) { if (colDendrograms.Count != clusteredProperties.PivotedProperties.SeriesGroups.Count) { throw new ArgumentException(@"Number of groups does not match", nameof(colDendrograms)); } for (int i = 0; i < colDendrograms.Count; i++) { var dendrogram = colDendrograms[i]; if (dendrogram != null && clusteredProperties.PivotedProperties.SeriesGroups[i].PivotKeys.Count != dendrogram.LeafCount) { throw new ArgumentException(@"Wrong number of columns", nameof(colDendrograms)); } } if (colDendrograms.Any(d => null != d)) { ColumnGroupDendrogramDatas = colDendrograms; } } }