Constructor Summary
Public Constructor | ||
public |
constructor(tf: TableFilter, opts: Object) Creates an instance of ColOps |
Member Summary
Public Members | ||
public |
List of columns' indexes for calculations |
|
public |
List of decimal precision for calculation results |
|
public |
List of row indexes excluded from calculations |
|
public |
List of format objects used for formatting the result - refer to https://github.com/componitable/format-number to check configuration options |
|
public |
|
|
public |
List of DOM element IDs containing column's calculation result |
|
public |
Callback fired after columns operations are completed |
|
public |
Callback fired before columns operations start |
|
public |
List of operations - possible values: 'sum', 'mean', 'min', 'max', 'median', 'q1', 'q3' |
|
public |
Configuration options |
|
public |
List of write methods used to write the result - possible values: 'innerHTML', 'setValue', 'createTextNode' |
|
public |
List of row indexes displaying the results |
Method Summary
Public Methods | ||
public |
calcAll() Calculates columns' values Configuration options are stored in 'opts' property
|
|
public |
Calculate the max value of passed values. |
|
public |
Calculate the mean of passed values. |
|
public |
calcMedian(values: Array): Number Calculate the median of passed values. |
|
public |
Calculate the min value of passed values. |
|
public |
Calculate the lower quartile of passed values. |
|
public |
Calculate the upper quartile of passed values. |
|
public |
Calculate the sum of passed values. |
|
public |
columnCalc(colIndex: Number, operation: String, precision: Number): Number Make desired calculation on specified column. |
|
public |
destroy() Remove extension |
|
public |
init() Initializes ColOps instance |
|
public |
sortColumnValues(values: Array, sorter: Function): Array Sort passed values with supplied sorter function. |
Inherited Summary
From class Feature | ||
public |
TableFilter configuration |
|
public |
TableFilter emitter instance |
|
public |
TableFilter feature setting |
|
public |
Feature name |
|
public |
Field indicating whether Feature is initialized |
|
public |
TableFilter instance |
|
public |
destroy() Destroy the feature |
|
public |
disable() Disable the feature |
|
public |
enable() Enable the feature |
|
public |
init() Initialize the feature |
|
public |
Indicate whether the feature is enabled or not |
|
public |
reset() Reset the feature after being disabled |
Public Constructors
public constructor(tf: TableFilter, opts: Object) source
Creates an instance of ColOps
Override:
Feature#constructorParams:
Name | Type | Attribute | Description |
tf | TableFilter | TableFilter instance |
|
opts | Object | Configuration object |
Public Members
public formatResults: Array source
List of format objects used for formatting the result - refer to https://github.com/componitable/format-number to check configuration options
public initialized: boolean source
Field indicating whether Feature is initialized
Override:
Feature#initializedpublic operations: Array source
List of operations - possible values: 'sum', 'mean', 'min', 'max', 'median', 'q1', 'q3'
Public Methods
public calcAll() source
Calculates columns' values Configuration options are stored in 'opts' property
- 'id' contains ids of elements showing result (array)
- 'col' contains the columns' indexes (array)
- 'operation' contains operation type (array, values: 'sum', 'mean', 'min', 'max', 'median', 'q1', 'q3')
- 'write_method' array defines which method to use for displaying the result (innerHTML, setValue, createTextNode) - default: 'innerHTML'
'tot_row_index' defines in which row results are displayed (integers array)
changes made by Nuovella: (1) optimized the routine (now it will only process each column once), (2) added calculations for the median, lower and upper quartile.
public calcMax(values: Array): Number source
Calculate the max value of passed values.
Params:
Name | Type | Attribute | Description |
values | Array |
|
List of values |
public calcMean(values: Array): Number source
Calculate the mean of passed values.
Params:
Name | Type | Attribute | Description |
values | Array |
|
List of values |
public calcMedian(values: Array): Number source
Calculate the median of passed values.
Params:
Name | Type | Attribute | Description |
values | Array |
|
List of values |
public calcMin(values: Array): Number source
Calculate the min value of passed values.
Params:
Name | Type | Attribute | Description |
values | Array |
|
List of values |
public calcQ1(values: Array): Number source
Calculate the lower quartile of passed values.
Params:
Name | Type | Attribute | Description |
values | Array |
|
List of values |
public calcQ3(values: Array): Number source
Calculate the upper quartile of passed values.
Params:
Name | Type | Attribute | Description |
values | Array |
|
List of values |
public calcSum(values: Array): Number source
Calculate the sum of passed values.
Params:
Name | Type | Attribute | Description |
values | Array |
|
List of values |