Utility functions for crossfilter datasets We roughly follow the crossfilter design of dimensions and groups, but we add an extra step to allow transformations on the data.
- a datum is turned into a base value using baseValFn;
- a base value is transformed into a value (possbily using exceedances, percentiles, category remapping etc.) using valueFn;
- a value is grouped using groupFn.
- Source:
- See:
-
- baseValueFn, valueFn, groupFn
Methods
(inner) baseValueFn(facet) → {baseValueCB}
Base value for given facet
Parameters:
| Name | Type | Description |
|---|---|---|
facet |
Facet |
- Source:
Returns:
Base value function for this facet
- Type
- baseValueCB
(inner) groupFn(partition) → {cb}
Create a function that returns the group value for a partition
Parameters:
| Name | Type | Description |
|---|---|---|
partition |
Partition |
- Source:
Returns:
Group function for this partition, taking a Data
- Type
- cb
(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.
Parameters:
| Name | Type | Description |
|---|---|---|
facet |
Aggregate | The Aggregate class for which to create the reduction function |
- Source:
Returns:
The required reduction function
- Type
- cb
(inner) valueFn(facet) → {valueCB}
Create a function that returns the transformed value for this facet
Parameters:
| Name | Type | Description |
|---|---|---|
facet |
Facet |
- Source:
Returns:
Value function for this facet
- Type
- valueCB
Type Definitions
baseValueCB(d) → {Object}
Returns the base value for a datum
Parameters:
| Name | Type | Description |
|---|---|---|
d |
Object | Raw data record |
- Source:
Returns:
base value
- Type
- Object
groupCB(d) → {Object}
Returns the grouped value for a transformed value
Parameters:
| Name | Type | Description |
|---|---|---|
d |
Object | Transformed value |
- Source:
Returns:
Group
- Type
- Object
reduceCB(d) → {number}
Reduce a SubgroupValue to a single number
Parameters:
| Name | Type | Description |
|---|---|---|
d |
SubgroupValue | SubgroupValue |
- Source:
Returns:
Reduced value
- Type
- number
subgroupAverage(d) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
d |
SubgroupValue |
- Source:
Returns:
d.sum/d.count
- Type
- number
subgroupCount(d) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
d |
SubgroupValue |
- Source:
Returns:
count
- Type
- number
subgroupSum(d) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
d |
SubgroupValue |
- Source:
Returns:
sum
- Type
- number
SubgroupValue
Type:
- Object
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:
valueCB(d) → {Object}
Returns the transformed value from a base value
Parameters:
| Name | Type | Description |
|---|---|---|
d |
Object | Base value |
- Source:
Returns:
Transformed value
- Type
- Object