Back to Devexpress

DataMemberSummaryFunction.ValueDataMember Property

wpf-devexpress-dot-xpf-dot-charts-dot-datamembersummaryfunction.md

latest10.4 KB
Original Source

DataMemberSummaryFunction.ValueDataMember Property

Gets or sets the data source field that provides data to be aggregated.

Namespace : DevExpress.Xpf.Charts

Assembly : DevExpress.Xpf.Charts.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public string ValueDataMember { get; set; }
vb
Public Property ValueDataMember As String

Property Value

TypeDescription
String

The string that is the data field name.

|

Remarks

The Series.ValueDataMember property value is ignored if the DataMemberSummaryFunction.ValueDataMember is specified.

Example

The example demonstrates how to apply AverageSummaryFunction to aggregate data points.

Use the following API members to configure the summary function options:

MemberDescription
Series.SummaryGets or sets the series data point summarization settings.
SummaryStores the series data point summarize options.
Summary.FunctionSpecifies the summary function that calculates data point values.
AverageSummaryFunctionThe summary function that calculates the average of data point values.
DataMemberSummaryFunction.ValueDataMemberGets or sets the data source field that provides data to be aggregated.
xaml
<Window.DataContext>
    <local:ChartViewModel/>
</Window.DataContext>
<Grid>
    <dxc:ChartControl>
        <dxc:XYDiagram2D SeriesItemsSource="{Binding SaleSeries}">
            <dxc:XYDiagram2D.SeriesItemTemplate>
                <DataTemplate>
                    <dxc:PointSeries2D DataSource="{Binding Values}"
                                       ArgumentDataMember="Category"
                                       ValueDataMember="Value">
                        <!-- Configure the summary function options. -->
                        <dxc:PointSeries2D.Summary>
                            <dxc:Summary>
                                <dxc:Summary.Function>
                                    <dxc:AverageSummaryFunction ValueDataMember="Value"/>
                                </dxc:Summary.Function>
                            </dxc:Summary>
                        </dxc:PointSeries2D.Summary>
                        <!--...-->
                        <dxc:PointSeries2D.Label>
                            <dxc:SeriesLabel Visible="True" TextPattern="Average: ${V}M" 
                                             dxc:MarkerSeries2D.Angle="90" ResolveOverlappingMode="JustifyAroundPoint"/>
                        </dxc:PointSeries2D.Label>
                    </dxc:PointSeries2D>
                </DataTemplate>
            </dxc:XYDiagram2D.SeriesItemTemplate>
            <dxc:XYDiagram2D.AxisX>
                <dxc:AxisX2D TickmarksMinorVisible="False"/>
            </dxc:XYDiagram2D.AxisX>
            <dxc:XYDiagram2D.AxisY>
                <dxc:AxisY2D Interlaced="False">
                    <dxc:AxisY2D.WholeRange>
                        <dxc:Range dxc:AxisY2D.AlwaysShowZeroLevel="False"/>
                    </dxc:AxisY2D.WholeRange>
                    <dxc:AxisY2D.Label>
                        <dxc:AxisLabel TextPattern="${V}M"/>
                    </dxc:AxisY2D.Label>
                </dxc:AxisY2D>
            </dxc:XYDiagram2D.AxisY>
        </dxc:XYDiagram2D>
        <dxc:ChartControl.Titles>
            <dxc:Title Content="Product Sales" HorizontalAlignment="Center" FontSize="14"/>
        </dxc:ChartControl.Titles>
    </dxc:ChartControl>
</Grid>
csharp
public class ChartViewModel {
    public IEnumerable<SaleSeries> SaleSeries { get; private set; }
    public ChartViewModel() {     
        SaleSeries = new Collection<SaleSeries> {
        new SaleSeries {
            Values = new Collection<SaleInfo> {
                new SaleInfo { Category= "Video players", Region = "Asia", Value = 853},
                new SaleInfo { Category= "Video players", Region = "Australia", Value = 321},
                new SaleInfo { Category= "Video players", Region = "Europe", Value = 655},
                new SaleInfo { Category= "Video players", Region = "North America", Value = 1325},
                new SaleInfo { Category= "Video players", Region = "South America", Value = 653},

                new SaleInfo { Category= "Automation", Region = "Asia", Value = 172},
                new SaleInfo { Category= "Automation", Region = "Australia", Value = 255},
                new SaleInfo { Category= "Automation", Region = "Europe", Value = 981D},
                new SaleInfo { Category= "Automation", Region = "North America", Value = 963D},
                new SaleInfo { Category= "Automation", Region = "South America", Value = 123D},

                new SaleInfo { Category= "Monitors", Region = "Asia", Value = 1011D},
                new SaleInfo { Category= "Monitors", Region = "Australia", Value = 359D},
                new SaleInfo { Category= "Monitors", Region = "Europe", Value = 721D},
                new SaleInfo { Category= "Monitors", Region = "North America", Value = 565D},
                new SaleInfo { Category= "Monitors", Region = "South America", Value = 532D},

                new SaleInfo { Category= "Projectors", Region = "Asia", Value = 998D},
                new SaleInfo { Category= "Projectors", Region = "Australia", Value = 222D},
                new SaleInfo { Category= "Projectors", Region = "Europe", Value = 865D},
                new SaleInfo { Category= "Projectors", Region = "North America", Value = 787D},
                new SaleInfo { Category= "Projectors", Region = "South America", Value = 332D},

                new SaleInfo { Category= "Televisions", Region = "Asia", Value = 1356D},
                new SaleInfo { Category= "Televisions", Region = "Australia", Value = 232D},
                new SaleInfo { Category= "Televisions", Region = "Europe", Value = 1323D},
                new SaleInfo { Category= "Televisions", Region = "North America", Value = 1125D},
                new SaleInfo { Category= "Televisions", Region = "South America", Value = 865D}
            }
        }
    };
    }
}
public class SaleSeries {
    public IEnumerable<SaleInfo> Values { get; set; }
}
public class SaleInfo {
    public string Category { get; set; }
    public string Region { get; set; }
    public double Value { get; set; }
}
vb
Public Class ChartViewModel
    Public Property SaleSeries As IEnumerable(Of SaleSeries)

    Public Sub New()
        SaleSeries = New Collection(Of SaleSeries) From {
            New SaleSeries With {
                .Values = New Collection(Of SaleInfo) From {
                    New SaleInfo With { .Category = "Video players", .Region = "Asia", .Value = 853R },
                    New SaleInfo With { .Category = "Video players", .Region = "Australia", .Value = 321R },
                    New SaleInfo With { .Category = "Video players", .Region = "Europe", .Value = 655R },
                    New SaleInfo With { .Category = "Video players", .Region = "North America", .Value = 1325R },
                    New SaleInfo With { .Category = "Video players", .Region = "South America", .Value = 653R },
                    New SaleInfo With { .Category = "Automation", .Region = "Asia", .Value = 172R },
                    New SaleInfo With { .Category = "Automation", .Region = "Australia", .Value = 255R },
                    New SaleInfo With { .Category = "Automation", .Region = "Europe", .Value = 981R },
                    New SaleInfo With { .Category = "Automation", .Region = "North America", .Value = 963R },
                    New SaleInfo With { .Category = "Automation", .Region = "South America", .Value = 123R },
                    New SaleInfo With { .Category = "Monitors", .Region = "Asia", .Value = 1011R },
                    New SaleInfo With { .Category = "Monitors", .Region = "Australia", .Value = 359R },
                    New SaleInfo With { .Category = "Monitors", .Region = "Europe", .Value = 721R },
                    New SaleInfo With { .Category = "Monitors", .Region = "North America", .Value = 565R },
                    New SaleInfo With { .Category = "Monitors", .Region = "South America", .Value = 532R },
                    New SaleInfo With { .Category = "Projectors", .Region = "Asia", .Value = 998R },
                    New SaleInfo With { .Category = "Projectors", .Region = "Australia", .Value = 222R },
                    New SaleInfo With { .Category = "Projectors", .Region = "Europe", .Value = 865R },
                    New SaleInfo With { .Category = "Projectors", .Region = "North America", .Value = 787R },
                    New SaleInfo With { .Category = "Projectors", .Region = "South America", .Value = 332R },
                    New SaleInfo With { .Category = "Televisions", .Region = "Asia", .Value = 1356R },
                    New SaleInfo With { .Category = "Televisions", .Region = "Australia", .Value = 232R },
                    New SaleInfo With { .Category = "Televisions", .Region = "Europe", .Value = 1323R },
                    New SaleInfo With { .Category = "Televisions", .Region = "North America", .Value = 1125R },
                    New SaleInfo With { .Category = "Televisions", .Region = "South America", .Value = 865R }
                }
            }
        }
    End Sub
End Class

Public Class SaleSeries
    Public Property Values As IEnumerable(Of SaleInfo)
End Class

Public Class SaleInfo
    Public Property Category As String
    Public Property Region As String
    Public Property Value As Double
End Class

See Also

DataMemberSummaryFunction Class

DataMemberSummaryFunction Members

DevExpress.Xpf.Charts Namespace