MovingCalculationBinding Class
Defines aggregations across a specified number of values before and/or after the current value.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v19.2.dll
Declaration
Remarks
To bind a PivotGrid field to the result of the calculation, perform the following steps:
- Create an instance of the MovingCalculationBinding class with the Source property set to the DataBindingBase descendant instance.
- Specify the window frame and calculation settings.
- Assign the MovingCalculationBinding instance to the PivotGridField.DataBinding property.
Example
The following code snippet illustrates the use of the Data Binding API:
Note
The complete sample project is available in the DevExpress Demo Center: Code Examples - Optimized Mode - Field Calculation Bindings module in the XtraPivotGrid MainDemo.
pivotGridControl.OptionsData.DataProcessingEngine = PivotDataProcessingEngine.Optimized;
PivotGridField fieldProductAmount = new PivotGridField()
{
Area = PivotArea.DataArea,
Caption = "Product Sales",
Name = "fProductAmount"
};
PivotGridField fieldProductAmountMoving = new PivotGridField()
{
Area = PivotArea.DataArea,
Caption = "Moving Average",
Name = "fMovingAverage"
};
DataSourceColumnBinding productAmountBinding = new DataSourceColumnBinding("ProductAmount");
//Bind a field to a column in the data source.
fieldProductAmount.DataBinding = productAmountBinding;
//Calculate the average of the preceding, current and following values in the column.
fieldProductAmountMoving.DataBinding = new MovingCalculationBinding()
{
Source = productAmountBinding,
PartitioningCriteria = CalculationPartitioningCriteria.ColumnValue,
SummaryType = PivotSummaryType.Average,
PreviousValuesCount = 1,
NextValuesCount = 1
};
pivotGridControl.Fields.AddRange(new PivotGridField[] {
fieldProductAmount,
fieldProductAmountMoving
});
Inheritance
See Also