ManualTimeSpanScaleOptions.CustomAggregateFunction Property
In This Article
Gets or sets the custom aggregate function callback that calculates the aggregated values.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v24.2.dll
NuGet Package: DevExpress.Wpf.Charts
#Declaration
[Browsable(false)]
public CustomAggregateFunction CustomAggregateFunction { get; set; }
#Property Value
Type | Description |
---|---|
Custom |
The custom aggregate function callback. |
#Remarks
Do the following to create an aggregate function:
Set the AggregateFunction property to Custom.
Develop a class that inherits the CustomAggregateFunction class.
Override the CustomAggregateFunction.Calculate(GroupInfo) method.
Initialize the CustomAggregateFunction property with a newly created aggregate function class instance.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using DevExpress.Xpf.Charts;
namespace TimeSpanExample {
public class StandardDeviationAggregateFunction : CustomAggregateFunction {
public override string ToString() {
return "StdDev (Custom)";
}
public override double[] Calculate(GroupInfo groupInfo) {
double sum = 0.0;
foreach (double value in groupInfo.Values1) {
sum += value;
}
int len = groupInfo.Values1.Count();
double averageAmount = sum / len;
double standardDeviationSquareSum = 0.0;
foreach (double value in groupInfo.Values1) {
double deviation = value - averageAmount;
standardDeviationSquareSum += deviation * deviation;
}
double stdDev = Math.Sqrt(standardDeviationSquareSum / len);
return new double[1] { stdDev };
}
}
}
See Also