Пример #1
0
        /// <summary>
        /// Customize the display text of individual column and row headers and filter dropdown items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void Grid_FieldValueDisplayText(object sender, PivotFieldDisplayTextEventArgs e)
        {
            string txt;

            PivotGridValueType vt = e.ValueType;             // Value, Total, GrantTotal, CustomTotal

            PivotGridFieldContext fc = GetPivotGridFieldContext(e.Field);

            if (fc == null)
            {
                return;
            }

            if (fc.Aggregation.IsGroupingType)
            {
                object vo = e.Value;
                txt           = GroupingMethods.FormatGroupedValue(fc.Qc, fc.Aggregation, vo);
                e.DisplayText = txt;
            }

            else if (fc.Aggregation.Role == AggregationRole.DataSummary)             // data area header when 2 or more data fields
            {
                txt           = PivotGridControlMx.BuildFieldCaption(fc.F);
                e.DisplayText = txt;
            }

            else
            {
                return;
            }


            return;
        }
Пример #2
0
/// <summary>
/// SetFieldGridDataRow
/// </summary>
/// <param name="dr"></param>
/// <param name="f"></param>

        void SetFieldGridDataRow(DataRow dr, PivotGridFieldMx f)
        {
            string label, txt;

            ResultsField  rfld = f.ResultsField as ResultsField;
            ResultsTable  rt   = rfld.ResultsTable;
            ResultsFormat rf   = rt.ResultsFormat;
            MetaColumn    mc   = rfld.MetaColumn;
            QueryColumn   qc   = rfld.QueryColumn;
            QueryTable    qt   = qc.QueryTable;
            Query         q    = qt.Query;

            dr["ColTypeImageCol"] = QueryTableControl.GetMetaColumnDataTypeImage(mc);
            dr["PivotFieldCol"]   = f;           // store reference to pivot field
            dr["FieldNameCol"]    = f.Caption;

            dr["AggRoleCol"] = f.Aggregation.RoleLabel;

            dr["AggTypeCol"] = f.Aggregation.TypeLabel;

            //			txt = GroupingTypeLabel(f);
            //			dr["HeaderBinningCol"] = txt;

            dr["SourceColumnCol"] = PivotGridControlMx.BuildFieldCaption(f);

            label = qt.ActiveLabel;
            if (rf.Tables.Count > 1)
            {
                label = "T" + (rt.Position + 1) + " - " + label;
            }
            dr["SourceTableCol"] = label;

            return;
        }
Пример #3
0
        /// <summary>
        /// BeginSerialization
        /// </summary>
        /// <param name="tw"></param>

        public override void BeginSerialization(XmlTextWriter tw)
        {
            base.BeginSerialization(tw);

            PivotGridPropertiesMx p = PivotGridPropertiesMx;

            if (p == null)
            {
                return;
            }

            tw.WriteStartElement("PivotGridView");

            tw.WriteAttributeString("CompactLayout", p.CompactLayout.ToString());
            tw.WriteAttributeString("ShowColumnTotals", p.ShowColumnTotals.ToString());
            tw.WriteAttributeString("ShowColumnGrandTotals", p.ShowColumnGrandTotals.ToString());
            tw.WriteAttributeString("ShowRowTotals", p.ShowRowTotals.ToString());
            tw.WriteAttributeString("ShowRowGrandTotals", p.ShowRowGrandTotals.ToString());
            tw.WriteAttributeString("ShowFilterHeaders", p.ShowFilterHeaders.ToString());

            tw.WriteAttributeString("PivotGridChartType", p.PivotGridChartType);
            tw.WriteAttributeString("PgcShowSelectionOnly", p.PgcShowSelectionOnly.ToString());
            tw.WriteAttributeString("PgcDataVertical", p.PgcProvideDataByColumns.ToString());
            tw.WriteAttributeString("PgcShowPointLabels", p.PgcShowPointLabels.ToString());
            tw.WriteAttributeString("PgcShowColumnGrandTotals", p.PgcShowColumnGrandTotals.ToString());
            tw.WriteAttributeString("PgcShowRowGrandTotals", p.PgcShowRowGrandTotals.ToString());

            if (p.PivotFields != null)
            {
                tw.WriteStartElement("PivotGridFields");
                foreach (PivotGridFieldMx f in p.PivotFields)
                {
                    ResultsField rfld = f.ResultsField as ResultsField;

                    tw.WriteStartElement("PivotGridField");

                    if (rfld == null || f.Caption != PivotGridControlMx.BuildFieldCaption(f))                     // write caption if different than field name
                    {
                        tw.WriteAttributeString("Caption", f.Caption);
                    }

                    tw.WriteAttributeString("UnboundFieldName", f.UnboundFieldName);                     // tableAlias.mcName link to source query table/column

                    tw.WriteAttributeString("Role", f.Role.ToString());
                    tw.WriteAttributeString("AreaIndex", f.AreaIndex.ToString());

                    if (f.SummaryTypeMx != AggregationDef.Model.SummaryType)
                    {
                        tw.WriteAttributeString("SummaryType", f.SummaryTypeMx.ToString());
                    }

                    if (f.GroupingType != AggregationDef.Model.GroupingType)
                    {
                        tw.WriteAttributeString("GroupingType", f.GroupingType.ToString());
                    }

                    if (f.NumericIntervalSize != AggregationDef.Model.NumericIntervalSize)
                    {
                        tw.WriteAttributeString("NumericIntervalSize", f.NumericIntervalSize.ToString());
                    }

                    if (f.Width != PivotGridField.DefaultWidth)
                    {
                        tw.WriteAttributeString("Width", f.Width.ToString());
                    }

                    tw.WriteEndElement();             // PivotGridField
                }
                tw.WriteEndElement();                 // PivotGridFields
            }

            tw.WriteEndElement();             // PivotGridView

            return;
        }