wpf-devexpress-dot-xpf-dot-charts-f107851e.md
The summary function that shows the maximum value.
Namespace : DevExpress.Xpf.Charts
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
public class MaxSummaryFunction :
MinSummaryFunction
Public Class MaxSummaryFunction
Inherits MinSummaryFunction
Assign a Summary object to the Series.Summary property to summarize data point values.
Then assign a MaxSummaryFunction object to the Summary.Function property.
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.
In addition to the MaxSummaryFunction , the Chart Control provides the following summary functions:
The example demonstrates how to apply MaxSummaryFunction to aggregate data points.
Use the following API members to configure the summary function options:
| Member | Description |
|---|---|
| Series.Summary | Gets or sets the series data point summarization settings. |
| Summary | Stores the series data point summarize options. |
| Summary.Function | Specifies the summary function that calculates data point values. |
MaxSummaryFunction | The summary function that shows the maximum value. |
| DataMemberSummaryFunction.ValueDataMember | Gets or sets the data source field that provides data to be aggregated. |
<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:MaxSummaryFunction ValueDataMember="Value"/>
</dxc:Summary.Function>
</dxc:Summary>
</dxc:PointSeries2D.Summary>
<!--...-->
<dxc:PointSeries2D.Label>
<dxc:SeriesLabel Visible="True" TextPattern="Max: ${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>
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; }
}
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
Object DevExpress.Xpf.Charts.NotifyPropertyChangedObject SummaryFunctionBase DataMemberSummaryFunction MinSummaryFunction MaxSummaryFunction
See Also