Skip to content

dimple.aggregateMethod

Christabella edited this page Jun 14, 2017 · 2 revisions

The aggregate methods are exposed to allow specific aggregations of the data. By default the data will be summed. A custom aggregation method could be created and passed in place of these methods if it conforms to the parameter signature used by the methods below:

Static Methods

dimple.aggregateMethod.avg(lhs, lhsCount, rhs, rhsCount) [code] - This method is provided to pass to the dimple.series.aggregate property in order to calculate a mean of data values for the series, rather than the default sum. This method can be used recursively to aggregate a large data set. The property details below are only provided should you wish to create a custom version, this is not intended to be called by external code. The code link above may be more helpful for this:

  • lhs (Required): The first of the two values to average.

  • lhsCount (Required): The number of discrete values making up the lhs value.

  • rhs (Required): The second of the two values to average.

  • rhsCount (Required): The number of discrete values making up the rhs value.

Example:

// Set a predefined series to calculate a mean
mySeries.aggregate = dimple.aggregateMethod.avg

dimple.aggregateMethod.count(lhs, lhsCount, rhs, rhsCount) [code] - This method is provided to pass to the dimple.series.aggregate property in order to count data values for the series, rather than the default sum. This method can be used recursively to aggregate a large data set. The property details below are only provided should you wish to create a custom version, this is not intended to be called by external code. The code link above may be more helpful for this:

  • lhs (Optional): Unused by count, maintained for universality with other aggregate methods.

  • lhsCount (Required): The number of discrete values making up the lhs value.

  • rhs (Optional): Unused by count, maintained for universality with other aggregate methods.

  • rhsCount (Required): The number of discrete values making up the rhs value.

Example:

// Set a predefined series to calculate a count
mySeries.aggregate = dimple.aggregateMethod.count

dimple.aggregateMethod.max(lhs, lhsCount, rhs, rhsCount) [code] - This method is provided to pass to the dimple.series.aggregate property in order to pick maximum data values for the series, rather than the default sum. This method can be used recursively to aggregate a large data set. The property details below are only provided should you wish to create a custom version, this is not intended to be called by external code. The code link above may be more helpful for this:

  • lhs (Required): The first of two values from which to pick the greatest.

  • lhsCount (Optional): Unused by max, maintained for universality with other aggregate methods.

  • rhs (Required): The second of two values from which to pick the greatest.

  • rhsCount (Optional): Unused by max, maintained for universality with other aggregate methods.

Example:

// Set a predefined series to calculate a maximum value
mySeries.aggregate = dimple.aggregateMethod.max

dimple.aggregateMethod.min(lhs, lhsCount, rhs, rhsCount) [code] - This method is provided to pass to the dimple.series.aggregate property in order to pick minimum data values for the series, rather than the default sum. This method can be used recursively to aggregate a large data set. The property details below are only provided should you wish to create a custom version, this is not intended to be called by external code. The code link above may be more helpful for this:

  • lhs (Required): The first of two values from which to pick the smallest.

  • lhsCount (Optional): Unused by min, maintained for universality with other aggregate methods.

  • rhs (Required): The second of two values from which to pick the smallest.

  • rhsCount (Optional): Unused by min, maintained for universality with other aggregate methods.

Example:

// Set a predefined series to calculate a minimum value
mySeries.aggregate = dimple.aggregateMethod.min

dimple.aggregateMethod.sum(lhs, lhsCount, rhs, rhsCount) [code] - This method is provided to pass to the dimple.series.aggregate property in order to sum series values. It is the default option. This method can be used recursively to aggregate a large data set. The property details below are only provided should you wish to create a custom version, this is not intended to be called by external code. The code link above may be more helpful for this:

  • lhs (Required): The first of two values to add together.

  • lhsCount (Optional): Unused by sum, maintained for universality with other aggregate methods.

  • rhs (Required): The second of two values to add together.

  • rhsCount (Optional): Unused by sum, maintained for universality with other aggregate methods.

Example:

// Set a predefined series to calculate a sum
mySeries.aggregate = dimple.aggregateMethod.sum
Clone this wiki locally