client/util-crossfilter

Utility functions for crossfilter datasets We roughly follow the crossfilter design of dimensions and groups, but we add extra steps to allow transformations on the data.

  1. a datum is turned into a raw value, ie. string or number etc. by rawValueFn
  2. it is then cast to the correct type value using baseValFn
  3. a further transfrom can be applied with valueFn
  4. a value is grouped using groupFn; this value must be either a number or a string.
Source:
See:
  • rawValueFn, baseValueFn, valueFn, groupFn

Methods

(inner) baseValueFn(facet) → {vaseValueCB}

Base value for given facet, ie. cast to correct type or object.

Source:
Parameters:
Name Type Description
facet Facet
Returns:
Type:
vaseValueCB

Base value function for this facet

(inner) groupFn(partition) → {cb}

Create a function that returns the group value for a partition

Source:
Parameters:
Name Type Description
partition Partition
Returns:
Type:
cb

Group function for this partition, taking a Data

(inner) rawValueFn(facet) → {rawValueCB}

Raw value for given facet

Source:
Parameters:
Name Type Description
facet Facet
Returns:
Type:
rawValueCB

Raw value function for this facet

(inner) reduceFn(facet) → {cb}

/** Returns a function for further reducing the crossfilter group to a single value, depending on sum/count/average settings of the Aggregate class.

Source:
Parameters:
Name Type Description
facet Aggregate

The Aggregate class for which to create the reduction function

Returns:
Type:
cb

The required reduction function

(inner) valueFn(facet) → {valueCB}

Create a function that returns the transformed value for this facet

Source:
Parameters:
Name Type Description
facet Facet
Returns:
Type:
valueCB

Value function for this facet

Type Definitions

baseValueCB(d) → {Object}

Returns the base value for a datum

Source:
Parameters:
Name Type Description
d Object

Raw data record

Returns:
Type:
Object

base value

groupCB(d) → {Object}

Returns the grouped value for a transformed value

Source:
Parameters:
Name Type Description
d Object

Transformed value

Returns:
Type:
Object

Group

reduceCB(d) → {number}

Reduce a SubgroupValue to a single number

Source:
Parameters:
Name Type Description
d SubgroupValue

SubgroupValue

Returns:
Type:
number

Reduced value

subgroupAverage(d) → {number}

Source:
Parameters:
Name Type Description
d SubgroupValue
Returns:
Type:
number

d.sum/d.count

subgroupCount(d) → {number}

Source:
Parameters:
Name Type Description
d SubgroupValue
Returns:
Type:
number

count

subgroupStddev(d) → {number}

Source:
Parameters:
Name Type Description
d SubgroupValue
Returns:
Type:
number

stddev(d)

subgroupSum(d) → {number}

Source:
Parameters:
Name Type Description
d SubgroupValue
Returns:
Type:
number

sum

SubgroupValue

Properties:
Name Type Description
count number

The count of the number of elements in this subgroup

sum number

The sum of all elements in this subgroup

Source:
Type:
  • Object

valueCB(d) → {Object}

Returns the transformed value from a base value

Source:
Parameters:
Name Type Description
d Object

Base value

Returns:
Type:
Object

Transformed value