SummaryDataAdapter.NumericSummaryOptions Property
Returns options that configure how the series calculates summary values of its data source with numeric arguments.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.1.dll
NuGet Package: DevExpress.Charts
Declaration
[PersistenceMode(PersistenceMode.InnerProperty)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Data)]
[XtraSerializableProperty(XtraSerializationVisibility.Content)]
public NumericSummaryOptions NumericSummaryOptions { get; }
Property Value
Type | Description |
---|---|
NumericSummaryOptions | Stores summarization settings for a chart with numeric arguments. |
Remarks
The NumericSummaryOptions include the SummaryFunction property, which defines a function used to summarize series values.
Example
The following example shows how to create a series and aggregate points with equal arguments.
A summary function is not applied. | A summary function (SUM) is applied. |
---|---|
- Create a SummaryDataAdapter object.
- Define the adapter’s DataSource property.
- Populate the adapter DataMembers collection. You should specify data members that contain arguments and values.
- Specify the SummaryOptionsBase.SummaryFunction property to select a function used to summarize values.
- Use the Series.DataAdapter property to assign the adapter to the series.
using DevExpress.XtraCharts;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace SummaryChart {
private void OnLoad(object sender, EventArgs e) {
// Create a series.
Series series = new Series("Series", ViewType.Point);
// Create a summary data adapter.
SummaryDataAdapter dataAdapter = new SummaryDataAdapter();
// Specify the data source.
dataAdapter.DataSource = DataPoint.GetDataPoints();
// Create a data member that defines arguments.
dataAdapter.DataMembers.Add(new DataMember {
DataMemberType = ChartDataMemberType.Argument,
ColumnName = "Argument",
ScaleType = ScaleType.Numerical
});
// Create a data member that defines values.
dataAdapter.DataMembers.Add(new DataMember {
DataMemberType = ChartDataMemberType.Value,
ColumnName = "Value",
ScaleType = ScaleType.Numerical
});
// Specify a summary function.
dataAdapter.NumericSummaryOptions.SummaryFunction = "SUM([Value])";
// Assign the data adapter to the series.
series.DataAdapter = dataAdapter;
// Add the series to the chart.
chart.Series.Add(series);
}
public class DataPoint {
public double Argument { get; set; }
public double Value { get; set; }
public static List<DataPoint> GetDataPoints() {
return new List<DataPoint> {
new DataPoint { Argument= 1, Value = 853D},
new DataPoint { Argument= 1, Value = 321D},
new DataPoint { Argument= 1, Value = 655D},
new DataPoint { Argument= 1, Value = 1325D},
new DataPoint { Argument= 2, Value = 653D},
new DataPoint { Argument= 2, Value = 172D},
new DataPoint { Argument= 2, Value = 255D},
new DataPoint { Argument= 3, Value = 981D},
new DataPoint { Argument= 3, Value = 913D},
new DataPoint { Argument= 4, Value = 123D},
new DataPoint { Argument= 4, Value = 1011D},
new DataPoint { Argument= 4, Value = 359D},
new DataPoint { Argument= 4, Value = 721D},
new DataPoint { Argument= 4, Value = 565D}
};
}
}
}
}
See Also