Ejemplo n.º 1
0
        public IndexedPropertyDescriptor MakePropertyDescriptor(int index, ImmutableList <object> columnHeaderKey,
                                                                PropertyDescriptor originalPropertyDescriptor, IColumnCaption caption, AggregateOperation aggregateOperation)
        {
            IColumnCaption qualifiedCaption;

            if (columnHeaderKey.Count == 0)
            {
                qualifiedCaption = caption;
            }
            else
            {
                qualifiedCaption = new CaptionComponentList(columnHeaderKey.Concat(new[] { caption })
                                                            .Select(CaptionComponentList.MakeCaptionComponent));
            }
            var attributes = DataSchema.GetAggregateAttributes(originalPropertyDescriptor, aggregateOperation).ToArray();

            return(new IndexedPropertyDescriptor(DataSchema, index, aggregateOperation.GetPropertyType(originalPropertyDescriptor.PropertyType),
                                                 qualifiedCaption, attributes));
        }
Ejemplo n.º 2
0
        public IndexedPropertyDescriptor MakePropertyDescriptor(int index, ImmutableList <object> columnHeaderKey,
                                                                PropertyDescriptor originalPropertyDescriptor, IColumnCaption caption, AggregateOperation aggregateOperation)
        {
            IColumnCaption  qualifiedCaption;
            PivotedColumnId pivotedColumnId = null;

            if (columnHeaderKey.Count == 0)
            {
                qualifiedCaption = caption;
            }
            else
            {
                var pivotCaptionComponents = columnHeaderKey.Select(CaptionComponentList.MakeCaptionComponent).ToList();
                qualifiedCaption = new CaptionComponentList(pivotCaptionComponents.Append(caption));
                pivotedColumnId  = new PivotedColumnId(columnHeaderKey,
                                                       new CaptionComponentList(pivotCaptionComponents),
                                                       caption,
                                                       caption);
            }
            var attributes = DataSchema.GetAggregateAttributes(originalPropertyDescriptor, aggregateOperation).ToArray();

            return(new IndexedPropertyDescriptor(DataSchema, index, aggregateOperation.GetPropertyType(originalPropertyDescriptor.PropertyType),
                                                 qualifiedCaption, pivotedColumnId, attributes));
        }
Ejemplo n.º 3
0
        public bool ShowHeatMap()
        {
            Tuple <Clusterer, ClusteredReportResults, ReportColorScheme> resultsTuple = GetClusteredResults();

            if (resultsTuple == null)
            {
                return(false);
            }

            var clusteredResults    = resultsTuple.Item2;
            var colorScheme         = resultsTuple.Item3;
            var points              = new List <ClusterGraphResults.Point>();
            var rowHeaders          = new List <ClusterGraphResults.Header>();
            var columnValues        = new List <PivotedProperties.Series>();
            var columnGroups        = new List <ClusterGraphResults.ColumnGroup>();
            var dataSchemaLocalizer = BindingListSource.ViewInfo.DataSchema.DataSchemaLocalizer;
            var cellLocators        = new List <CellLocator>();

            for (int iGroup = 0; iGroup < clusteredResults.PivotedProperties.SeriesGroups.Count; iGroup++)
            {
                var group = clusteredResults.PivotedProperties.SeriesGroups[iGroup];

                var groupColumnHeaders = clusteredResults.ClusteredProperties.GetColumnHeaders(group).ToList();
                var groupHeaders       = new List <ClusterGraphResults.Header>();
                for (int iPivotKey = 0; iPivotKey < group.PivotKeys.Count; iPivotKey++)
                {
                    var colors = new List <Color>();
                    foreach (var series in groupColumnHeaders)
                    {
                        var pd = series.PropertyDescriptors[iPivotKey];
                        colors.Add(colorScheme.GetColumnColor(pd) ?? Color.Transparent);
                    }
                    groupHeaders.Add(new ClusterGraphResults.Header(group.PivotCaptions[iPivotKey].GetCaption(dataSchemaLocalizer), colors));
                }
                foreach (var series in group.SeriesList)
                {
                    var transform = clusteredResults.ClusteredProperties.GetColumnRole(series) as ClusterRole.Transform;
                    if (transform == null)
                    {
                        continue;
                    }
                    columnValues.Add(series);
                    columnGroups.Add(new ClusterGraphResults.ColumnGroup(
                                         clusteredResults.ColumnGroupDendrogramDatas[iGroup].DendrogramData, groupHeaders));
                    for (int iProperty = 0; iProperty < series.PropertyIndexes.Count; iProperty++)
                    {
                        var columnHeaders = groupColumnHeaders.Prepend(series)
                                            .Select(s => s.PropertyDescriptors[iProperty]).ToList();
                        var cellLocator = CellLocator.ForColumn(columnHeaders, clusteredResults.ItemProperties);
                        cellLocators.Add(cellLocator);
                    }
                }
            }
            for (int iRow = 0; iRow < clusteredResults.RowCount; iRow++)
            {
                var rowItem        = clusteredResults.RowItems[iRow];
                var rowColors      = new List <Color>();
                var rowHeaderParts = new List <object>();
                foreach (var rowHeader in clusteredResults.ClusteredProperties.RowHeaders)
                {
                    rowHeaderParts.Add(rowHeader.GetValue(rowItem));
                    rowColors.Add(colorScheme.GetColor(rowHeader, rowItem) ?? Color.Transparent);
                }

                string rowCaption = CaptionComponentList.SpaceSeparate(rowHeaderParts)
                                    .GetCaption(DataSchemaLocalizer.INVARIANT);
                rowHeaders.Add(new ClusterGraphResults.Header(rowCaption, rowColors));
                int iCol = 0;
                foreach (var series in columnValues)
                {
                    foreach (var color in colorScheme.GetSeriesColors(series, rowItem))
                    {
                        var point          = new ClusterGraphResults.Point(iRow, iCol, color);
                        var skylineDocNode = cellLocators[iCol].GetSkylineDocNode(rowItem);
                        if (skylineDocNode != null)
                        {
                            point = point.ChangeIdentityPath(skylineDocNode.IdentityPath);
                        }

                        var replicate = cellLocators[iCol].GetReplicate(rowItem);
                        if (replicate != null)
                        {
                            point = point.ChangeReplicateName(replicate.Name);
                        }
                        points.Add(point);
                        iCol++;
                    }
                }
            }
            var graphResults = new ClusterGraphResults(clusteredResults.RowDendrogramData?.DendrogramData, rowHeaders, columnGroups, points);
            var heatMapGraph = new HierarchicalClusterGraph()
            {
                SkylineWindow = DataSchemaSkylineWindow,
                GraphResults  = graphResults
            };

            heatMapGraph.Show(FormUtil.FindTopLevelOwner(this));
            return(true);
        }