corelibraries-devexpress-dot-xtracharts-dot-summarydataadapter.md
Returns options that configure how the series calculates summary values of its data source with numeric arguments.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
[PersistenceMode(PersistenceMode.InnerProperty)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Data)]
public NumericSummaryOptions NumericSummaryOptions { get; }
<XtraChartsLocalizableCategory(XtraChartsCategory.Data)>
<PersistenceMode(PersistenceMode.InnerProperty)>
Public ReadOnly Property NumericSummaryOptions As NumericSummaryOptions
| Type | Description |
|---|---|
| NumericSummaryOptions |
Stores summarization settings for a chart with numeric arguments.
|
The NumericSummaryOptions include the SummaryFunction property, which defines a function used to summarize series values.
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}
};
}
}
}
}
Imports DevExpress.XtraCharts
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
Namespace SummaryChart
Private Sub OnLoad(ByVal sender As Object, ByVal e As EventArgs)
' Create a series.
Dim series As Series = New Series("Series", ViewType.Point)
' Create a summary data adapter.
Dim dataAdapter As SummaryDataAdapter = New SummaryDataAdapter()
' Specify the data source.
dataAdapter.DataSource = DataPoint.GetDataPoints()
' Create a data member that defines arguments.
dataAdapter.DataMembers.Add(New DataMember With {
.DataMemberType = ChartDataMemberType.Argument,
.ColumnName = "Argument",
.ScaleType = ScaleType.Numerical
})
' Create a data member that defines values.
dataAdapter.DataMembers.Add(New DataMember With {
.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)
End Sub
Public Class DataPoint
Public Property Argument As Double
Public Property Value As Double
Public Shared Function GetDataPoints() As List(Of DataPoint)
Return New List(Of DataPoint) From {
New DataPoint With {
.Argument = 1,
.Value = 853R
},
New DataPoint With {
.Argument = 1,
.Value = 321R
},
New DataPoint With {
.Argument = 1,
.Value = 655R
},
New DataPoint With {
.Argument = 1,
.Value = 1325R
},
New DataPoint With {
.Argument = 2,
.Value = 653R
},
New DataPoint With {
.Argument = 2,
.Value = 172R
},
New DataPoint With {
.Argument = 2,
.Value = 255R
},
New DataPoint With {
.Argument = 3,
.Value = 981R
},
New DataPoint With {
.Argument = 3,
.Value = 913R
},
New DataPoint With {
.Argument = 4,
.Value = 123R
},
New DataPoint With {
.Argument = 4,
.Value = 1011R
},
New DataPoint With {
.Argument = 4,
.Value = 359R
},
New DataPoint With {
.Argument = 4,
.Value = 721R
},
New DataPoint With {
.Argument = 4,
.Value = 565R
}
}
End Function
End Class
End Namespace
See Also