Пример #1
0
        TryAutoFillColorColumn
        (
            ListObject oTable,
            String sSourceColumnName,
            String sDestinationColumnName,
            ColorColumnAutoFillUserSettings oDetails,
            out Boolean bSourceColumnContainsNumbers,
            out Double dSourceCalculationNumber1,
            out Double dSourceCalculationNumber2,
            out Int32 iDecimalPlaces,
            out ICollection <String> oCategoryNames
        )
        {
            Debug.Assert(oTable != null);
            Debug.Assert(!String.IsNullOrEmpty(sDestinationColumnName));
            Debug.Assert(oDetails != null);

            bSourceColumnContainsNumbers = oDetails.SourceColumnContainsNumbers;
            dSourceCalculationNumber1    = 0;
            dSourceCalculationNumber2    = 1;
            iDecimalPlaces = 0;
            oCategoryNames = null;

            if (String.IsNullOrEmpty(sSourceColumnName))
            {
                return(false);
            }

            if (bSourceColumnContainsNumbers)
            {
                return(TableColumnMapper.TryMapToColor(oTable,
                                                       sSourceColumnName, sDestinationColumnName,
                                                       oDetails.UseSourceNumber1, oDetails.UseSourceNumber2,
                                                       oDetails.SourceNumber1, oDetails.SourceNumber2,
                                                       oDetails.DestinationColor1, oDetails.DestinationColor2,
                                                       oDetails.IgnoreOutliers, oDetails.UseLogs,
                                                       out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                                       out iDecimalPlaces
                                                       ));
            }

            return(TableColumnMapper.TryMapToColor(oTable, sSourceColumnName,
                                                   sDestinationColumnName, out oCategoryNames));
        }
Пример #2
0
        TryAutoFillColorColumn
        (
            ListObject oTable,
            String sSourceColumnName,
            String sDestinationColumnName,
            ColorColumnAutoFillUserSettings oDetails,
            out Double dSourceCalculationNumber1,
            out Double dSourceCalculationNumber2,
            out Int32 iDecimalPlaces
        )
        {
            Debug.Assert(oTable != null);
            Debug.Assert(!String.IsNullOrEmpty(sDestinationColumnName));
            Debug.Assert(oDetails != null);

            dSourceCalculationNumber1 = dSourceCalculationNumber2 =
                Double.MinValue;

            iDecimalPlaces = Int32.MinValue;

            if (String.IsNullOrEmpty(sSourceColumnName))
            {
                return(false);
            }

            return(TableColumnMapper.TryMapToColor(
                       oTable, sSourceColumnName, sDestinationColumnName,
                       oDetails.UseSourceNumber1,
                       oDetails.UseSourceNumber2,
                       oDetails.SourceNumber1,
                       oDetails.SourceNumber2,
                       oDetails.DestinationColor1,
                       oDetails.DestinationColor2,
                       oDetails.IgnoreOutliers,
                       oDetails.UseLogs,
                       out dSourceCalculationNumber1,
                       out dSourceCalculationNumber2,
                       out iDecimalPlaces
                       ));
        }
Пример #3
0
        AutoFillByEdgeTimestamp
        (
            Microsoft.Office.Interop.Excel.Workbook workbook,
            String edgeTimestampColumnName,
            Boolean showVertexLabels,
            String vertexLabelColumnName
        )
        {
            Debug.Assert(workbook != null);
            Debug.Assert(!String.IsNullOrEmpty(edgeTimestampColumnName));

            Debug.Assert(!showVertexLabels ||
                         !String.IsNullOrEmpty(vertexLabelColumnName));

            ListObject         oVertexTable         = null;
            ListObject         oEdgeTable           = null;
            ExcelHiddenColumns oHiddenVertexColumns = null;
            ExcelHiddenColumns oHiddenEdgeColumns   = null;

            AutoFillWorkbookWithSchemeResults oAutoFillWorkbookWithSchemeResults =
                new AutoFillWorkbookWithSchemeResults();

            try
            {
                if (
                    !TryStartAutoFill(workbook, showVertexLabels,
                                      vertexLabelColumnName, out oEdgeTable, out oVertexTable,
                                      out oHiddenEdgeColumns, out oHiddenVertexColumns)
                    ||
                    ExcelUtil.VisibleTableRangeIsEmpty(oEdgeTable)
                    )
                {
                    return;
                }

                // Map the edge timestamp column to the edge color column.

                Double dSourceCalculationNumber1, dSourceCalculationNumber2;
                Int32  iDecimalPlaces;

                if (!TableColumnMapper.TryMapToColor(oEdgeTable,
                                                     edgeTimestampColumnName, EdgeTableColumnNames.Color, false,
                                                     false, 0, 0, MinimumEdgeTimestampColor,
                                                     MaximumEdgeTimestampColor, false, false,
                                                     out dSourceCalculationNumber1, out dSourceCalculationNumber2,
                                                     out iDecimalPlaces
                                                     ))
                {
                    return;
                }

                // Fill in other columns with constants.

                FillColumnsWithConstants(

                    oEdgeTable, EdgeTableColumnNames.Width, 2.0F,

                    oEdgeTable, CommonTableColumnNames.Alpha,
                    AlphaConverter.MaximumAlphaWorkbook,

                    oVertexTable, VertexTableColumnNames.Shape,
                    (new VertexShapeConverter()).GraphToWorkbook(
                        VertexShape.Circle),

                    oVertexTable, VertexTableColumnNames.Color,
                    (new ColorConverter2()).GraphToWorkbook(
                        Color.FromArgb(0, 0, 0)),

                    oVertexTable, VertexTableColumnNames.Radius, 1.5F,

                    oVertexTable, CommonTableColumnNames.Alpha,
                    AlphaConverter.MaximumAlphaWorkbook
                    );

                // Save the results.

                ListColumn oEdgeTimestampColumn;

                ExcelUtil.TryGetTableColumn(oEdgeTable, edgeTimestampColumnName,
                                            out oEdgeTimestampColumn);

                oAutoFillWorkbookWithSchemeResults.SetEdgeTimestampResults(
                    edgeTimestampColumnName,
                    ExcelUtil.GetColumnFormat(oEdgeTimestampColumn),
                    dSourceCalculationNumber1, dSourceCalculationNumber2);
            }
            finally
            {
                (new PerWorkbookSettings(workbook)).
                AutoFillWorkbookWithSchemeResults =
                    oAutoFillWorkbookWithSchemeResults;

                EndAutoFill(workbook, oEdgeTable, oVertexTable,
                            oHiddenEdgeColumns, oHiddenVertexColumns);
            }
        }