Constructor
new Measure(name, data, schema)
Creates new Measure field instance.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the field. |
data |
Array | An array containing the field data. |
schema |
Object | The schema for the field. |
- Source:
Extends
Methods
clone(data) → {PartialField}
Creates brand new copy of current field instance. To avoid optimization issue
pass the required data otherwise current data would be copied which might
be expensive.
Parameters:
Name | Type | Description |
---|---|---|
data |
Array | The input data, if provided current data will not be cloned. |
- Inherited From:
- Source:
Returns:
Returns the cloned field instance.
- Type
- PartialField
defAggFn() → {function}
Getter for aggregation function of the field.
- Source:
Returns:
Returns aggregation function of the field.
- Type
- function
description() → {description}
- Inherited From:
- Source:
Returns:
Name of the field
- Type
- description
domain()
Generates and returns the domain for the field.
- Overrides:
- Source:
fieldName() → {string}
- Inherited From:
- Source:
Returns:
Name of the field
- Type
- string
numberFormat() → {string}
Getter for number format value of the field.
- Source:
Returns:
Returns number format of the field.
- Type
- string
parse(val) → {number|null}
A hook which is called for every entry(cell) of the column.
Parameters:
Name | Type | Description |
---|---|---|
val |
* | The current entry present in the column while iteration. |
- Overrides:
- Source:
- To Do:
-
- Fix the null data e.g. NaN value.
Returns:
Returns the parsed number value of content of cell or null.
- Type
- number | null
parsed(val) → {*}
The post parsing hook for field instance.
Parameters:
Name | Type | Description |
---|---|---|
val |
* | The value to be parsed. |
- Inherited From:
- Source:
Returns:
Returns the parsed value.
- Type
- *
sanitize() → {PartialField}
Sanitizes the field data.
- Inherited From:
- Source:
Returns:
- Returns the instance of the current context for chaining.
- Type
- PartialField
scale() → {string}
Getter for scale value of the field.
- Source:
Returns:
Returns scale of the field.
- Type
- string
type() → {string}
- Inherited From:
- Source:
Returns:
Type of the field
- Type
- string
unit() → {string}
Getter for unit value of the field.
- Source:
Returns:
Returns unit of the field.
- Type
- string