Beispiel #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);
        }
Beispiel #2
0
        private Dictionary <ImmutableList <HeaderLevel>, PointPairList> GetRowPointPairLists(int xAxisIndex, int yAxisIndex)
        {
            var pointLists  = new Dictionary <ImmutableList <HeaderLevel>, PointPairList>();
            var results     = Clusterer.PerformPcaOnRows(Math.Max(xAxisIndex, yAxisIndex) + 1);
            var cellLocator = CellLocator.ForRow(Clusterer.Properties.RowHeaders);

            for (int iRow = 0; iRow < results.ItemLabels.Count; iRow++)
            {
                var rowItem = results.ItemLabels[iRow];
                var headers = new List <HeaderLevel>();
                foreach (var pdHeader in Clusterer.Properties.RowHeaders)
                {
                    var objectValue = pdHeader.GetValue(rowItem);
                    headers.Add(new HeaderLevel(pdHeader.ColumnCaption, objectValue,
                                                ColorScheme.GetColor(pdHeader, rowItem) ?? 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);
                pointInfo = pointInfo.ChangeIdentityPath(cellLocator.GetSkylineDocNode(rowItem)?.IdentityPath)
                            .ChangeReplicateName(cellLocator.GetReplicate(rowItem)?.Name);
                var point = new PointPair(results.ItemComponents[iRow][xAxisIndex], results.ItemComponents[iRow][yAxisIndex])
                {
                    Tag = pointInfo
                };
                pointPairList.Add(point);
            }

            return(pointLists);
        }