class anychart.data.TableComputer Improve this Doc
Stock table computer constructor.
Methods Overview
Data | |
addOutputField() | Adds output field to the computer with the given name. |
getFieldIndex() | Returns field index by the field name. |
setCalculationFunction() | Sets function that is executed for each row of the table storage. |
setContext() | Sets computer context. If not set - defaults to Window. |
setStartFunction() | Sets function that will be executed on each calculation start. |
Methods Description
addOutputField
Adds output field to the computer with the given name.
Detailed description
The field is available in the computing functions by this name. Returns an index that can be used
to map this field in the table. You can also pass a uid for this field - in this case the field will be available
for mapping by this name also.
Params:
Name | Type | Description |
---|---|---|
name | string | Name of field. |
uid | string | Unique identifier for field. |
Returns:
number - Returns a negative number of column. This number of the column can use for data mapping.Try it:
getFieldIndex
Returns field index by the field name.
Params:
Name | Type | Description |
---|---|---|
name | string | Field name. |
Returns:
number - Returns negative field index.Try it:
setCalculationFunction
Sets function that is executed for each row of the table storage.
Detailed description
The context is set by setContext method is passed to this function both as this and as the second parameter.
Params:
Name | Type | Description |
---|---|---|
calculationFunction | function(rowProxy:anychart.data.TableComputer.RowProxy, context:Object) | Function that looks like: function(anychart.data.TableComputer.RowProxy, context){ // this: context - The context value from anychart.data.TableComputer#setContext method } |
Try it:
setContext
Sets computer context. If not set - defaults to Window.
Params:
Name | Type | Description |
---|---|---|
value | Object | Context of the calculator |
Try it:
setStartFunction
Sets function that will be executed on each calculation start.
Detailed description
The context is set by the setContext method is passed to this function both as this and as the first parameter.
This function is performed before each cycle calculation - before calculation of the full data range and the selected data grouping.
Params:
Name | Type | Description |
---|---|---|
startFunction | function(context:Object) | Function that looks like: function(context){ // this: context - The context value from anychart.data.TableComputer#setContext method } |
Try it: