Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AutomaticTimeSpanScaleOptions.CustomAggregateFunction Property

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
CustomAggregateFunction

The custom aggregate function callback.

#Remarks

Do the following to create an aggregate function:

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