Back to Devexpress

CountSummaryFunction Class

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

latest7.6 KB
Original Source

CountSummaryFunction Class

The summary function that calculates the number of points.

Namespace : DevExpress.Xpf.Charts

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

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public class CountSummaryFunction :
    SummaryFunctionBase
vb
Public Class CountSummaryFunction
    Inherits SummaryFunctionBase

Remarks

Assign a Summary object to the Series.Summary property to summarize data point values.

Then assign a CountSummaryFunction object to the Summary.Function property.

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 CountSummaryFunction , the Chart Control provides the following summary functions:

Example

The example demonstrates how to apply CountSummaryFunction 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.
CountSummaryFunctionThe summary function that calculates the number of points.
xaml
<Window.DataContext>
    <local:ChartViewModel/>
</Window.DataContext>
<Grid>
    <dxc:ChartControl Width="540" Height="315">
        <dxc:XYDiagram2D>
            <dxc:PointSeries2D DataSource="{Binding Data}"
                               ArgumentDataMember="Argument"
                               ValueDataMember="Value">
                <!-- Configure the summary function options. -->
                <dxc:PointSeries2D.Summary>
                    <dxc:Summary>
                        <dxc:Summary.Function>
                            <dxc:CountSummaryFunction/>
                        </dxc:Summary.Function>
                    </dxc:Summary>
                </dxc:PointSeries2D.Summary>
                <!--...-->
            </dxc:PointSeries2D>
            <dxc:XYDiagram2D.AxisY>
                <dxc:AxisY2D Interlaced="False">
                    <dxc:AxisY2D.NumericScaleOptions>
                        <dxc:ContinuousNumericScaleOptions GridSpacing="1" AutoGrid="False"/>
                    </dxc:AxisY2D.NumericScaleOptions>
                    <dxc:AxisY2D.WholeRange>
                        <dxc:Range dxc:AxisY2D.AlwaysShowZeroLevel="False"/>
                    </dxc:AxisY2D.WholeRange>
                </dxc:AxisY2D>
            </dxc:XYDiagram2D.AxisY>
        </dxc:XYDiagram2D>
    </dxc:ChartControl>
</Grid>
csharp
public class ChartViewModel {
    public IEnumerable<DataPoint> Data { get; private set; }
    public ChartViewModel() {
        Data = new Collection<DataPoint> {
            new DataPoint { Argument= 1, Value = 853D},
            new DataPoint { Argument= 1, Value = 321D},
            new DataPoint { Argument= 2, Value = 655D},
            new DataPoint { Argument= 2, Value = 1325D},
            new DataPoint { Argument= 2, Value = 255D},
            new DataPoint { Argument= 2, Value = 981D},
            new DataPoint { Argument= 3, Value = 963D},
            new DataPoint { Argument= 3, Value = 123D},
            new DataPoint { Argument= 3, Value = 1011D},
            new DataPoint { Argument= 5, Value = 1356D},
            new DataPoint { Argument= 5, Value = 232D},
            new DataPoint { Argument= 5, Value = 1323D},
            new DataPoint { Argument= 5, Value = 1125D},
            new DataPoint { Argument= 6, Value = 865D},
            new DataPoint { Argument= 6, Value = 865D},
            new DataPoint { Argument= 10, Value = 1006D},
            new DataPoint { Argument= 10, Value = 236D},
            new DataPoint { Argument= 16, Value = 1090D},
            new DataPoint { Argument= 18, Value = 496D},
            new DataPoint { Argument= 18, Value = 691D},
            new DataPoint { Argument= 20, Value = 1125D},
            new DataPoint { Argument= 20, Value = 600D},
            new DataPoint { Argument= 20, Value = 770D}
        };
    }
}
public class DataPoint {
    public double Argument { get; set; }
    public double Value { get; set; }
}
vb
Public Class ChartViewModel
    Public Property Data As IEnumerable(Of DataPoint)

    Public Sub New()
        Data = New Collection(Of DataPoint) From {
            New DataPoint With { .Argument = 1, .Value = 853R },
            New DataPoint With { .Argument = 1, .Value = 321R },
            New DataPoint With { .Argument = 2, .Value = 655R },
            New DataPoint With { .Argument = 2, .Value = 1325R },
            New DataPoint With { .Argument = 2, .Value = 255R },
            New DataPoint With { .Argument = 2, .Value = 981R },
            New DataPoint With { .Argument = 3, .Value = 963R },
            New DataPoint With { .Argument = 3, .Value = 123R },
            New DataPoint With { .Argument = 3, .Value = 1011R },
            New DataPoint With { .Argument = 5, .Value = 1356R },
            New DataPoint With { .Argument = 5, .Value = 232R },
            New DataPoint With { .Argument = 5, .Value = 1323R },
            New DataPoint With { .Argument = 5, .Value = 1125R },
            New DataPoint With { .Argument = 6, .Value = 865R },
            New DataPoint With { .Argument = 6, .Value = 865R },
            New DataPoint With { .Argument = 10, .Value = 1006R },
            New DataPoint With { .Argument = 10, .Value = 236R },
            New DataPoint With { .Argument = 16, .Value = 1090R },
            New DataPoint With { .Argument = 18, .Value = 496R },
            New DataPoint With { .Argument = 18, .Value = 691R },
            New DataPoint With { .Argument = 20, .Value = 1125R },
            New DataPoint With { .Argument = 20, .Value = 600R },
            New DataPoint With { .Argument = 20, .Value = 770R
            }
        }
    End Sub
End Class

Public Class DataPoint
    Public Property Argument As Double
    Public Property Value As Double
End Class

Inheritance

Object DevExpress.Xpf.Charts.NotifyPropertyChangedObject SummaryFunctionBase CountSummaryFunction

See Also

CountSummaryFunction Members

DevExpress.Xpf.Charts Namespace