protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Initializes a data source. ds = new AccessDataSource("~/nwind.mdb", "SELECT [CategoryName]," + "[ProductName], [ProductSales], [ShippedDate] FROM [ProductReports]"); // Initializes ASPxPivotGrid. ASPxPivotGrid1 = new ASPxPivotGrid(); // Binds ASPxPivotGrid to the data source. ASPxPivotGrid1.DataSource = ds; // Places the Pivot Grid onto a page. form1.Controls.Add(ASPxPivotGrid1); if (ASPxPivotGrid1.Fields.Count != 0) return; // Creates pivot grid fields for all data source fields. ASPxPivotGrid1.RetrieveFields(); // Locates the pivot grid fields in appropriate areas. ASPxPivotGrid1.Fields["CategoryName"].Area = PivotArea.RowArea; ASPxPivotGrid1.Fields["ProductName"].Area = PivotArea.RowArea; ASPxPivotGrid1.Fields["ShippedDate"].Area = PivotArea.ColumnArea; ASPxPivotGrid1.Fields["ProductSales"].Area = PivotArea.DataArea; ASPxPivotGrid1.Fields["ShippedDate"].GroupInterval = PivotGroupInterval.DateYear; }
protected void AddPivot(ASPxPanel panel, DataTable dtvars, int mymeasureid, Datadictionary dict) { ASPxPivotGrid pivot = new ASPxPivotGrid(); pivot.ID = mymeasureid.ToString(); pivot.DataSource = dtvars; pivot.DataBind(); pivot.RetrieveFields(); pivot.OptionsPager.RowsPerPage = 50; pivot.OptionsCustomization.AllowExpand = false; pivot.Fields["varnum"].Area = PivotArea.RowArea; pivot.Fields["variablelabel"].Area = PivotArea.RowArea; pivot.Fields["varnum"].AreaIndex = 0; pivot.Fields["variablelabel"].AreaIndex = 1; //pivot.Fields["ord_pos"].Visible = false; pivot.Fields["timepoint_text"].Area = PivotArea.ColumnArea; pivot.Fields["timepoint_text"].AreaIndex = 0; if (mymeasureid == 4911 | mymeasureid == 4912) { pivot.Fields["studymeasname2"].Area = PivotArea.ColumnArea; pivot.Fields["studymeasname2"].AreaIndex = 1; } pivot.Fields["value"].Area = PivotArea.DataArea; pivot.Fields["value"].SummaryType = DevExpress.Data.PivotGrid.PivotSummaryType.Min; pivot.Fields["timepoint_text"].TotalsVisibility = PivotTotalsVisibility.None; pivot.Fields["varnum"].TotalsVisibility = PivotTotalsVisibility.None; pivot.Fields["id"].TotalsVisibility = PivotTotalsVisibility.None; pivot.Fields["value"].TotalsVisibility = PivotTotalsVisibility.None; pivot.OptionsView.ShowColumnGrandTotals = false; pivot.OptionsView.ShowRowGrandTotals = false; pivot.OptionsView.ShowColumnHeaders = false; pivot.OptionsView.ShowRowHeaders = false; pivot.OptionsView.ShowDataHeaders = false; pivot.OptionsView.ShowFilterHeaders = false; ASPxLabel lbl = new ASPxLabel(); lbl.EncodeHtml = false; lbl.Text = String.Format("<br/><b>{0}</b>", dict.measname); lbl.Font.Size = 14; panel.Controls.Add(lbl); panel.Controls.Add(pivot); }
protected void DisplayNs(DataSet dset_descstats) { foreach (DataTable dt in dset_descstats.Tables) { ASPxPivotGrid pivot = new ASPxPivotGrid(); pivot.OptionsView.ShowColumnTotals = false; pivot.OptionsView.ShowColumnGrandTotals = false; pivot.OptionsView.ShowRowTotals = false; pivot.OptionsView.ShowRowGrandTotals = false; pivot.OptionsView.ShowFilterHeaders = false; pivot.OptionsPager.RowsPerPage = 0; pivot.DataSource = dt; panel1.Controls.Add(pivot); pivot.RetrieveFields(); pivot.Fields["Measure"].Area = PivotArea.RowArea; pivot.Fields["Varname"].Area = PivotArea.RowArea; pivot.Fields["N"].Area = PivotArea.DataArea; List <string> ivs = dt.TableName.Split(',').ToList(); foreach (string s in ivs) { pivot.Fields[s].Area = PivotArea.ColumnArea; } Literal lit = new Literal(); lit.Text = "<br/><br/>"; panel1.Controls.Add(lit); } }