Aggregation

public struct Aggregation : Encodable

Undocumented

  • A reference to the data array in the parent trace to aggregate.

    To aggregate by nested variables, use . to access them. For example, set groups to marker.color to aggregate over the marker color array. The referenced array must already exist, unless func is count, and each array may only be referenced once.

    Declaration

    Swift

    public var target: String?
  • Sets the aggregation function.

    All values from the linked target, corresponding to the same value in the groups array, are collected and reduced by this function. count is simply the number of values in the groups array, so does not even require the linked array to exist. first (last) is just the first (last) linked value. Invalid values are ignored, so for example in avg they do not contribute to either the numerator or the denominator. Any data type (numeric, date, category) may be aggregated with any function, even though in certain cases it is unlikely to make sense, for example a sum of dates or average of categories. median will return the average of the two central values if there is an even count. mode will return the first value to reach the maximum count, in case of a tie. change will return the difference between the first and last linked values. range will return the difference between the min and max linked values.

    See more

    Declaration

    Swift

    public enum Function : String, Encodable
  • Sets the aggregation function.

    All values from the linked target, corresponding to the same value in the groups array, are collected and reduced by this function. count is simply the number of values in the groups array, so does not even require the linked array to exist. first (last) is just the first (last) linked value. Invalid values are ignored, so for example in avg they do not contribute to either the numerator or the denominator. Any data type (numeric, date, category) may be aggregated with any function, even though in certain cases it is unlikely to make sense, for example a sum of dates or average of categories. median will return the average of the two central values if there is an even count. mode will return the first value to reach the maximum count, in case of a tie. change will return the difference between the first and last linked values. range will return the difference between the min and max linked values.

    Declaration

    Swift

    public var function: Function?
  • stddev supports two formula variants: sample (normalize by N-1) and population (normalize by N).

    See more

    Declaration

    Swift

    public enum FunctionMode : String, Encodable
  • stddev supports two formula variants: sample (normalize by N-1) and population (normalize by N).

    Declaration

    Swift

    public var functionMode: FunctionMode?
  • Determines whether this aggregation function is enabled or disabled.

    Declaration

    Swift

    public var enabled: Bool?
  • Creates Aggregation object with specified properties.

    Declaration

    Swift

    public init(target: String? = nil, function: Function? = nil, functionMode: FunctionMode? = nil,
            enabled: Bool? = nil)

    Parameters

    target

    A reference to the data array in the parent trace to aggregate.

    function

    Sets the aggregation function.

    functionMode

    stddev supports two formula variants: sample (normalize by N-1) and population (normalize by N).

    enabled

    Determines whether this aggregation function is enabled or disabled.