Data Helpers
The following API functions provide common use data manipulation and statistical functionality. For more information on how to use these functions, see the API usage page.
pageStore
- pageStore
- .getValues(data, idx)
- .getDistinctValues(data, idx, map, sort)
- .applyFilterToColumn(filter, column, data, allKey)
- .getMin(data, idx)
- .getMax(data, idx)
- .getMedian(data, idx)
- .getSum(data, idx)
- .getMean(data, idx)
- .getGeometricMean(data, idx)
- .getQuartiles(data, idx)
- .getOutliers(data, idx)
- .removeOutliers(data, idx)
pageStore.getValues(data, idx)
Returns all values in a given data key/attribute, unsorted
Kind: static method of pageStore
Param | Type | Description |
---|---|---|
data | Array/String | an array of data arrays, or a string representing a chart data key |
idx | the key to use for either the object attribute or array column you are trying to get values for |
pageStore.getDistinctValues(data, idx, map, sort)
Returns an array of distinct values from an array of arrays or objects by index. If values are strings or numbers they will be sorted, and if an optional array of values is provided as a map it will be used to sort. Sorting can be disabled by setting sort = false
.
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data arrays, or a string representing a chart data key | |
idx | String/Number |
| the key to use for either the object attribute or array column you are trying to get distinct values for |
map | Array |
| an array of values to use as an ordering map in sort |
sort | Boolean | true | boolean to check whether to sort the returning distinct values |
pageStore.applyFilterToColumn(filter, column, data, allKey)
Applies the value(s) of a harness filter to a column in a given set of data and returns the filtered result
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
filter | String | a key representing a harness filter | |
column | String/Number | the column/attribute in the data to apply the filter to | |
data | Array/String | an array of data arrays, or a string representing a chart data key | |
allKey | String |
| a string representing a potential value for "all". If state is variable is present in the filter, the filter is not applied |
pageStore.getMin(data, idx)
Gets the minimum value from an array of data. If an index is supplied, gets the minimum for that index/attribute in the data. Only includes valid numbers in calculations.
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.getMax(data, idx)
Gets the maximum value from an array of data. If an index is supplied, gets the maximum for that index/attribute in the data. Only includes valid numbers in calculations.
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.getMedian(data, idx)
Gets the median of an array of data
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key. Only includes valid numbers in calculations. | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.getSum(data, idx)
Gets the sum for an array of data. Only includes valid numbers in calculations.
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.getMean(data, idx)
Gets the mean for an array of data. Only includes valid numbers in calculations.
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.getGeometricMean(data, idx)
Gets the geometric mean for an array of data. Only includes valid numbers in calculations.
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.getQuartiles(data, idx)
Gets quartiles for an array of data. Returns in format {minimum, lowerQuartile, median, upperQuartile, maximum, IQR}. Only includes valid numbers in calculations.
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.getOutliers(data, idx)
Returns truncated dataset with outliers for a given array of data. Outliers are identified as any values that equal or lower than the lower quartile - (1.5 x IQR) or equal to or higher than the upper quartile + (1.5 x IQR).
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |
pageStore.removeOutliers(data, idx)
Returns truncated dataset minus outliers for a given array of data. Outliers are identified as any values that equal or lower than the lower quartile - (1.5 x IQR) or equal to or higher than the upper quartile + (1.5 x IQR).
Kind: static method of pageStore
Param | Type | Default | Description |
---|---|---|---|
data | Array/String | an array of data/data arrays, or a string representing a chart data key | |
idx | String/Number |
| the optional index/attribute in the data to apply the filter to |