MovingCalculationBinding Class
Defines aggregations across a specified number of values before and/or after the current value.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.XtraPivotGrid.v24.2.dll
NuGet Package: DevExpress.Win.PivotGrid
#Declaration
public class MovingCalculationBinding :
MovingCalculationBindingBase
#Remarks
To bind a PivotGrid field to the result of the calculation in Optimized mode, do the following:
- Create an instance of the MovingCalculationBinding class.
- Set 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 to calculate the average of the preceding, current and following values in the column:
public static void PivotCalculations(PivotGridControl pivotGridControl) {
DataSourceColumnBinding productAmountBinding = new DataSourceColumnBinding("ExtendedPrice");
//Calculate the average of the preceding, current and following values in the column.
pivotGridControl.Fields["fMovingAverage"].DataBinding = new MovingCalculationBinding(
productAmountBinding, CalculationPartitioningCriteria.ColumnValue, PivotSummaryType.Average, 1, 1);
}