protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.radPivotGrid1.PivotGridElement.ColumnGroupDescriptions.Add(new DateTimeGroupDescription() { PropertyName = "OrderDate", Step = DateTimeStep.Year, GroupComparer = new GroupNameComparer() }); this.radPivotGrid1.PivotGridElement.RowGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "ShipCountry", GroupComparer = new GrandTotalComparer(), SortOrder = Pivot.Core.SortOrder.Descending }); this.radPivotGrid1.PivotGridElement.RowGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "FirstName", GroupComparer = new GrandTotalComparer(), SortOrder = Pivot.Core.SortOrder.Ascending }); this.radPivotGrid1.PivotGridElement.AggregateDescriptions.Add(new PropertyAggregateDescription() { PropertyName = "Quantity", AggregateFunction = AggregateFunctions.Sum }); this.radPivotGrid1.PivotGridElement.AggregateDescriptions.Add(new PropertyAggregateDescription() { PropertyName = "UnitPrice", AggregateFunction = AggregateFunctions.Max }); NorthwindDataSet dataset = new DataSources.NorthwindDataSet(); OrdersViewTableAdapter adapter = new OrdersViewTableAdapter(); adapter.Fill(dataset.OrdersView); this.radPivotGrid1.AggregatesPosition = PivotAxis.Columns; this.radPivotGrid1.PivotGridElement.DataSource = dataset.OrdersView; }
private void FillWithData() { this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription() { PropertyName = "OrderDate", Step = DateTimeStep.Year, GroupComparer = new GroupNameComparer() }); this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription() { PropertyName = "OrderDate", Step = DateTimeStep.Quarter, GroupComparer = new GroupNameComparer() }); this.radPivotGrid1.RowGroupDescriptions.Add(new DateTimeGroupDescription() { PropertyName = "OrderDate", Step = DateTimeStep.Month, GroupComparer = new GroupNameComparer() }); this.radPivotGrid1.ColumnGroupDescriptions.Add(new PropertyGroupDescription() { PropertyName = "FirstName", GroupComparer = new GrandTotalComparer() }); this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription() { PropertyName = "Quantity", AggregateFunction = AggregateFunctions.Sum }); this.radPivotGrid1.AggregateDescriptions.Add(new PropertyAggregateDescription() { PropertyName = "Discount", AggregateFunction = AggregateFunctions.Average }); this.radPivotGrid1.FilterDescriptions.Add(new PropertyFilterDescription() { PropertyName = "ShipCountry", CustomName = "Country" }); NorthwindDataSet dataset = new DataSources.NorthwindDataSet(); OrdersViewTableAdapter adapter = new OrdersViewTableAdapter(); adapter.Fill(dataset.OrdersView); this.radPivotGrid1.AggregatesPosition = PivotAxis.Columns; this.radPivotGrid1.DataSource = dataset.OrdersView; this.radPivotGrid1.ErrorString = "Error"; this.radPivotGrid1.EmptyValueString = "No Data"; }