Example #1
0
        private Dictionary <ImmutableList <HeaderLevel>, PointPairList> GetColumnPointPairLists(
            PivotedProperties.SeriesGroup seriesGroup, int xAxisIndex, int yAxisIndex)
        {
            var pointLists = new Dictionary <ImmutableList <HeaderLevel>, PointPairList>();

            var results      = Clusterer.PerformPcaOnColumnGroup(seriesGroup, Math.Max(xAxisIndex, yAxisIndex) + 1);
            var headerLevels = Clusterer.Properties.GetColumnHeaders(seriesGroup).ToList();


            for (int iColumn = 0; iColumn < results.ItemComponents.Count; iColumn++)
            {
                var headers = new List <HeaderLevel>();
                foreach (var series in headerLevels)
                {
                    var pd          = series.PropertyDescriptors[iColumn];
                    var objectValue = Clusterer.RowItems.Select(pd.GetValue).FirstOrDefault(value => null != value);
                    headers.Add(new HeaderLevel(series.SeriesCaption, objectValue, ColorScheme.GetColor(series, objectValue) ?? MISSING_COLOR));
                }
                var           key = ImmutableList.ValueOf(headers);
                PointPairList pointPairList;
                if (!pointLists.TryGetValue(key, out pointPairList))
                {
                    pointPairList = new PointPairList();
                    pointLists.Add(key, pointPairList);
                }
                var pointInfo   = new PointInfo(key);
                var cellLocator = CellLocator.ForColumn(headerLevels.Select(series => series.PropertyDescriptors[iColumn]).ToList(),
                                                        ImmutableList.Empty <DataPropertyDescriptor>());
                var rowItem = Clusterer.RowItems[0];
                pointInfo = pointInfo.ChangeIdentityPath(cellLocator.GetSkylineDocNode(rowItem)?.IdentityPath)
                            .ChangeReplicateName(cellLocator.GetReplicate(rowItem)?.Name);
                var pointPair = new PointPair(results.ItemComponents[iColumn][xAxisIndex],
                                              results.ItemComponents[iColumn][yAxisIndex])
                {
                    Tag = pointInfo
                };

                pointPairList.Add(pointPair);
            }

            return(pointLists);
        }