SeriesBase.SummaryFunction Property
OBSOLETE
This property is obsolete now. Use the NumericSummaryOptions.SummaryFunction, DateTimeSummaryOptions.SummaryFunction or QualitativeSummaryOptions.SummaryFunction property instead.
Specifies the summary function which should calculate data point values.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.1.dll
NuGet Package: DevExpress.Charts
Declaration
[Browsable(false)]
[Obsolete("This property is obsolete now. Use the NumericSummaryOptions.SummaryFunction, DateTimeSummaryOptions.SummaryFunction or QualitativeSummaryOptions.SummaryFunction property instead.")]
[XtraSerializableProperty]
public string SummaryFunction { get; set; }
Property Value
Type | Description |
---|---|
String | A String specifying the name of a summary function. |
Remarks
If you use the SeriesBase.SummaryFunction property (obsolete now), you can replace it with the SummaryOptionsBase.SummaryFunction property. To access SummaryFunction, use following properties:
- SeriesBase.DateTimeSummaryOptions
- SeriesBase.NumericSummaryOptions
- SeriesBase.QualitativeSummaryOptions
- SeriesBase.TimeSpanSummaryOptions
For data-bound series, you can enable the automatic summary calculation. A summary function (either standard or custom) should be registered by calling the ChartControl.RegisterSummaryFunction (WebChartControl.RegisterSummaryFunction) method with the specified parameters (name, displayName, resultScaleType, resultDimensions, argumentDescriptions, function).
For more information, refer to Calculating Summaries.
Example
The following example demonstrates how to create a custom summary function, which returns an OHLC point calculated by the passed array of values. To accomplish this task, create a SummaryFunction delegate and register it using the ChartControl.RegisterSummaryFunction method:
// Declare the Financial summary function.
private static SeriesPoint[] CalculateProductValue(
Series series,
object argument,
string[] functionArguments,
DataSourceValues[] values,
object[] colors
) {
string functionArgument = functionArguments[0];
int lastIndex = values.Length - 1;
double open = Convert.ToDouble(values[0][functionArgument], CultureInfo.InvariantCulture);
double close = Convert.ToDouble(values[lastIndex][functionArgument], CultureInfo.InvariantCulture);
double high = Math.Max(open, close);
double low = Math.Min(open, close);
for (int i = 1; i < lastIndex; i++) {
high = Math.Max(high, Convert.ToDouble(values[i][functionArgument], CultureInfo.InvariantCulture));
low = Math.Min(low, Convert.ToDouble(values[i][functionArgument], CultureInfo.InvariantCulture));
}
// Return the result.
return new SeriesPoint[] {
new SeriesPoint(argument, high, low, open, close)
};
}
private void Form1_Load(object sender, EventArgs e) {
chartControl.DataSource = new CurrencyRateLoader("../../Data/EurUsdRate.xml").Load();
// Register the summary function in a chart.
chartControl.RegisterSummaryFunction(
name: "FINANCIAL",
displayName: "Financial",
resultScaleType: ScaleType.Numerical,
resultDimension: 4,
argumentDescriptions: new SummaryFunctionArgumentDescription[] {
new SummaryFunctionArgumentDescription("Value", ScaleType.Numerical)
},
function: CalculateProductValue
);
Series series = chartControl.Series["EurUsd"];
series.ArgumentDataMember = "DateTime";
// Note that ValueDataMembers are not specified.
series.DateTimeSummaryOptions.SummaryFunction = "FINANCIAL([Value])";
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the SummaryFunction property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.