public MainPage() { InitializeComponent(); // Parses an XML file and creates a collection of data items. Assembly assembly = Assembly.GetExecutingAssembly(); Stream stream = assembly.GetManifestResourceStream(dataFileName); XmlSerializer s = new XmlSerializer(typeof(OrderData)); object dataSource = s.Deserialize(stream); // Binds a pivot grid to this collection. pivotGridControl1.DataSource = dataSource; // Creates a PivotGridCustomTotal object that defines the Median Custom Total. PivotGridCustomTotal medianCustomTotal = new PivotGridCustomTotal(); medianCustomTotal.SummaryType = FieldSummaryType.Custom; // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. medianCustomTotal.Tag = "Median"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. medianCustomTotal.Format = "{0} Median"; // Adds the Median Custom Total for the Country field. fieldCountry.CustomTotals.Add(medianCustomTotal); // Creates a PivotGridCustomTotal object that defines the Quartiles Custom Total. PivotGridCustomTotal quartileCustomTotal = new PivotGridCustomTotal(); quartileCustomTotal.SummaryType = FieldSummaryType.Custom; // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. quartileCustomTotal.Tag = "Quartiles"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. quartileCustomTotal.Format = "{0} Quartiles"; // Adds the Quartiles Custom Total for the Country field. fieldCountry.CustomTotals.Add(quartileCustomTotal); // Enables the Custom Totals to be displayed instead of Automatic Totals. fieldCountry.TotalsVisibility = FieldTotalsVisibility.CustomTotals; pivotGridControl1.RowTotalsLocation = FieldRowTotalsLocation.Far; }
public MainWindow() { InitializeComponent(); // Binds the pivot grid to data. pivotGridControl1.DataSource = salesPersonDataAdapter.GetData(); // Creates a PivotGridCustomTotal object that defines the Median Custom Total. PivotGridCustomTotal medianCustomTotal = new PivotGridCustomTotal(); medianCustomTotal.SummaryType = FieldSummaryType.Custom; // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. medianCustomTotal.Tag = "Median"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. medianCustomTotal.Format = "{0} Median"; // Adds the Median Custom Total for the Sales Person field. fieldSalesPerson.CustomTotals.Add(medianCustomTotal); // Creates a PivotGridCustomTotal object that defines the Quartiles Custom Total. PivotGridCustomTotal quartileCustomTotal = new PivotGridCustomTotal(); quartileCustomTotal.SummaryType = FieldSummaryType.Custom; // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. quartileCustomTotal.Tag = "Quartiles"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. quartileCustomTotal.Format = "{0} Quartiles"; // Adds the Quartiles Custom Total for the Sales Person field. fieldSalesPerson.CustomTotals.Add(quartileCustomTotal); // Enables the Custom Totals to be displayed instead of Automatic Totals. fieldSalesPerson.TotalsVisibility = FieldTotalsVisibility.CustomTotals; pivotGridControl1.RowTotalsLocation = FieldRowTotalsLocation.Far; }
public static void AddCustomTotal(PivotGridField field, PivotSummaryType sType, string tag, FormatType hFormatType, string hFormatString, FormatType cFormatType, string FormatStr) { if (field.TotalsVisibility != PivotTotalsVisibility.CustomTotals) { field.TotalsVisibility = PivotTotalsVisibility.CustomTotals; } PivotGridCustomTotal customTotal = new PivotGridCustomTotal(sType); field.CustomTotals.Add(customTotal); customTotal.Tag = tag; customTotal.Format.FormatType = hFormatType; customTotal.Format.FormatString = hFormatString; customTotal.CellFormat.FormatType = cFormatType; customTotal.CellFormat.FormatString = FormatStr; }
private void Form1_Load(object sender, EventArgs e) { // Binds the pivot grid to data. nwindDataSetTableAdapters.ProductReportsTableAdapter adapter = new nwindDataSetTableAdapters.ProductReportsTableAdapter(); pivotGridControl1.DataSource = adapter.GetData(); // Creates a PivotGridCustomTotal object that defines the Median Custom Total. PivotGridCustomTotal medianCustomTotal = new PivotGridCustomTotal(PivotSummaryType.Custom); // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. medianCustomTotal.Tag = "Median"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. medianCustomTotal.Format.FormatString = "{0} Median"; medianCustomTotal.Format.FormatType = DevExpress.Utils.FormatType.Custom; // Adds the Median Custom Total for the Category Name field. fieldCategoryName.CustomTotals.Add(medianCustomTotal); // Creates a PivotGridCustomTotal object that defines the Quartiles Custom Total. PivotGridCustomTotal quartileCustomTotal = new PivotGridCustomTotal(PivotSummaryType.Custom); // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. quartileCustomTotal.Tag = "Quartiles"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. quartileCustomTotal.Format.FormatString = "{0} Quartiles"; quartileCustomTotal.Format.FormatType = DevExpress.Utils.FormatType.Custom; // Adds the Quartiles Custom Total for the Category Name field. fieldCategoryName.CustomTotals.Add(quartileCustomTotal); // Enables the Custom Totals to be displayed instead of Automatic Totals. fieldCategoryName.TotalsVisibility = PivotTotalsVisibility.CustomTotals; }
protected void ASPxPivotGrid1_Load(object sender, System.EventArgs e) { if (IsCallback || IsPostBack) { return; } // Creates a PivotGridCustomTotal object that defines the Median Custom Total. PivotGridCustomTotal medianCustomTotal = new PivotGridCustomTotal(PivotSummaryType.Custom); // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. medianCustomTotal.Tag = "Median"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. medianCustomTotal.Format.FormatString = "{0} Median"; medianCustomTotal.Format.FormatType = DevExpress.Utils.FormatType.Custom; // Adds the Median Custom Total for the Category Name field. fieldCategoryName.CustomTotals.Add(medianCustomTotal); // Creates a PivotGridCustomTotal object that defines the Quartiles Custom Total. PivotGridCustomTotal quartileCustomTotal = new PivotGridCustomTotal(PivotSummaryType.Custom); // Specifies a unique PivotGridCustomTotal.Tag property value // that will be used to distinguish between two Custom Totals. quartileCustomTotal.Tag = "Quartiles"; // Specifies formatting settings that will be used to display // Custom Total column/row headers. quartileCustomTotal.Format.FormatString = "{0} Quartiles"; quartileCustomTotal.Format.FormatType = DevExpress.Utils.FormatType.Custom; // Adds the Quartiles Custom Total for the Category Name field. fieldCategoryName.CustomTotals.Add(quartileCustomTotal); // Enables the Custom Totals to be displayed instead of Automatic Totals. fieldCategoryName.TotalsVisibility = PivotTotalsVisibility.CustomTotals; }