SummaryDataAdapter.DateTimeSummaryOptions Property
Returns options that configure how the series calculates summary values of its data source with DateTime 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 DateTimeSummaryOptions DateTimeSummaryOptions { get; }
Property Value
Type | Description |
---|---|
DateTimeSummaryOptions | Stores summarization settings for a chart with DateTime arguments. |
Remarks
The DateTimeSummaryOptions 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 {
public partial class Form1 : Form {
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.DateTime
});
// 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.DateTimeSummaryOptions.SummaryFunction = "SUM([Value])";
// Assign the data adapter to the series.
series.DataAdapter = dataAdapter;
// Add the series to the chart.
chart.Series.Add(series);
XYDiagram xYDiagram = chart.Diagram as XYDiagram;
xYDiagram.AxisX.Label.TextPattern = "{A:MMMM}";
}
public class DataPoint {
public DateTime Argument { get; set; }
public double Value { get; set; }
public static List<DataPoint> GetDataPoints() {
return new List<DataPoint> {
new DataPoint { Argument= new DateTime(2020,1,1), Value = 853D},
new DataPoint { Argument= new DateTime(2020,1,1), Value = 321D},
new DataPoint { Argument= new DateTime(2020,1,1), Value = 655D},
new DataPoint { Argument= new DateTime(2020,2,1), Value = 1325D},
new DataPoint { Argument= new DateTime(2020,2,1), Value = 653D},
new DataPoint { Argument= new DateTime(2020,2,1), Value = 172D},
new DataPoint { Argument= new DateTime(2020,2,1), Value = 255D},
new DataPoint { Argument= new DateTime(2020,2,1), Value = 981D},
new DataPoint { Argument= new DateTime(2020,3,1), Value = 963D},
new DataPoint { Argument= new DateTime(2020,3,1), Value = 123D},
new DataPoint { Argument= new DateTime(2020,3,1), Value = 1011D},
new DataPoint { Argument= new DateTime(2020,3,1), Value = 359D},
new DataPoint { Argument= new DateTime(2020,4,1), Value = 721D},
new DataPoint { Argument= new DateTime(2020,4,1), Value = 565D}
};
}
}
}
}
See Also