AFAggregate.HistogramAsync(T, TBin) Method
- Last UpdatedNov 18, 2025
- 3 minute read
- PI System
- AF SDK 2024 R2
- Developer
Generates a histogram for the specified items with the specified weighting asynchronously.
Namespace: OSIsoft.AF.Data.Aggregate
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static Task<AFBinnedResult<TBin>> HistogramAsync<T, TBin>( this IEnumerable<T> items, string field, IEnumerable<TBin> bins, UOM binUOM, CancellationToken cancellationToken ) where T : AFObject where TBin : Object, IComparable<TBin>
<ExtensionAttribute> Public Shared Function HistogramAsync(Of T As AFObject, TBin As {Object, IComparable(Of TBin)}) ( items As IEnumerable(Of T), field As String, bins As IEnumerable(Of TBin), binUOM As UOM, cancellationToken As CancellationToken ) As Task(Of AFBinnedResult(Of TBin)) Dim items As IEnumerable(Of T) Dim field As String Dim bins As IEnumerable(Of TBin) Dim binUOM As UOM Dim cancellationToken As CancellationToken Dim returnValue As Task(Of AFBinnedResult(Of TBin)) returnValue = items.HistogramAsync(field, bins, binUOM, cancellationToken)
public: [ExtensionAttribute] generic<typename T, typename TBin> where T : AFObject where TBin : Object, IComparable<TBin> static Task<AFBinnedResult<TBin>^>^ HistogramAsync( IEnumerable<T>^ items, String^ field, IEnumerable<TBin>^ bins, UOM^ binUOM, CancellationToken cancellationToken )
[<ExtensionAttribute>] static member HistogramAsync : items : IEnumerable<'T> * field : string * bins : IEnumerable<'TBin> * binUOM : UOM * cancellationToken : CancellationToken -> Task<AFBinnedResult<'TBin>> when 'T : AFObject when 'TBin : Object and IComparable<'TBin>
Parameters
- items
- Type: System.Collections.GenericIEnumerableT
The items that should be summarized. - field
- Type: SystemString
The field whose value should be binned. - bins
- Type: System.Collections.GenericIEnumerableTBin
The bins the field should be sorted into. - binUOM
- Type: OSIsoft.AF.UnitsOfMeasureUOM
The unit of measure associated with bin values. - cancellationToken
- Type: System.ThreadingCancellationToken
A token to control cancellation of the aggregation request.
Type Parameters
- T
- The type of items to summarize
- TBin
- The type of the histogram bins.
Return Value
Type: TaskAFBinnedResultTBinA result containing the requested histogram or an error if the summaries could not be performed.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
| This call might use a background task to complete some of its work. See the Threading Overview for some matters to consider when execution transitions to another thread. |