Back to Devexpress

Summary Class

wpf-devexpress-dot-xpf-dot-charts-2643f687.md

latest12.7 KB
Original Source

Summary Class

Stores the series data point summarize options.

Namespace : DevExpress.Xpf.Charts

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

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public class Summary :
    ChartDependencyObject,
    IWeakEventListener
vb
Public Class Summary
    Inherits ChartDependencyObject
    Implements IWeakEventListener

The following members return Summary objects:

Remarks

The Function property allows you to set an aggregate function that calculates the series point value summaries.

The following built-in functions are available:

For the Average , Max , Min and Sum functions, specify the ValueDataMember property to define a data source field that provides data to be aggregated.

For numerical and date-time x-axis scales, the function aggregates data point values for each interval specified by the MeasureUnit (NumericSummaryOptions.MeasureUnit or DateTimeSummaryOptions.MeasureUnit) property.

The following images illustrate how the measurement unit’s change affects point summarization:

A summary function is not applied.

AverageSummaryFunction is applied. NumericSummaryOptions.MeasureUnit = 1

AverageSummaryFunction is applied. NumericSummaryOptions.MeasureUnit = 5

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

Inheritance

Object DispatcherObject DependencyObject Freezable ChartDependencyObject Summary

See Also

Summary Members

DevExpress.Xpf.Charts Namespace