API / geotoolkit / charts / NumericalObjectDataSeries / NumericalObjectDataSeries
charts.NumericalObjectDataSeries.NumericalObjectDataSeries
Define a numerical data interface
Interface
ObjectDataSeries<number>↳
NumericalObjectDataSeries
Constructors
Properties
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
id | number | string | Unique id of the data series |
name | string | Name |
type | string | Type |
unit | string | Unit of the data series |
uri | string | Unique resource identifier |
Constructors
• new NumericalObjectDataSeries(options)
| Name | Type |
|---|---|
options | Options<number> |
ObjectDataSeries<number&gt;.constructor
Properties
• clone: (copyData?: boolean) => NumericalObjectDataSeries
▸ (copyData?): NumericalObjectDataSeries
| Name | Type |
|---|---|
Optional copyData | boolean |
Methods
▸ addChild(data): NumericalObjectDataSeries
Add a child object
| Name | Type | Description |
|---|---|---|
data | DataObject | DataObject[] | the child data to be added |
this
▸ addProperties(properties): NumericalObjectDataSeries
Add additional properties
| Name | Type | Description |
|---|---|---|
properties | Record<string, any> | additional properties of the dataobject |
this
INumericalDataSeries.addProperties
ObjectDataSeries.addProperties
▸ addValue(value): NumericalObjectDataSeries
Does nothing
| Name | Type | Description |
|---|---|---|
value | number | a new value |
this
▸ addValues(array): NumericalObjectDataSeries
Does nothing
| Name | Type | Description |
|---|---|---|
array | number[] | an array of values |
this
▸ calculate(name): any
Run function. See available formulas list by DataSeries.getFormulas
| Name | Type | Description |
|---|---|---|
name | string | name |
any
▸ clearChildren(): NumericalObjectDataSeries
Remove all child data
this
INumericalDataSeries.clearChildren
ObjectDataSeries.clearChildren
▸ clearValues(): NumericalObjectDataSeries
Does nothing
this
▸ Protected convertValues<U>(values, fromUnit?, toUnit?): U
Converts values from one unit to another specified unit.
| Name | Type |
|---|---|
U | extends number | number[] |
| Name | Type | Description |
|---|---|---|
values | U | array of values or a single value |
Optional fromUnit | string | AbstractUnit | the original unit of the value(s) |
Optional toUnit | string | AbstractUnit | the unit to convert the value(s) to |
U
INumericalDataSeries.convertValues
ObjectDataSeries.convertValues
▸ Protected copyConstructor(src, copyData?): NumericalObjectDataSeries
Copy constructor function.
Function used as part of the cloning mechanism.
Implementations should copy the given instance state to this instance.
| Name | Type | Description |
|---|---|---|
src | NumericalObjectDataSeries | Source to copy from |
Optional copyData | boolean |
this
INumericalDataSeries.copyConstructor
ObjectDataSeries.copyConstructor
▸ dispose(): void
Dispose data object and all children. Clear all listeners
void
▸ getChild(i): DataObject
Return data by index
| Name | Type | Description |
|---|---|---|
i | number | index of the data |
child
▸ getChildren(filter?): Iterator<DataObject>
Return iterator by child data objects
| Name | Type | Description |
|---|---|---|
Optional filter | (data: DataObject) => boolean | a filter function. Returns all child data objects if the value is null. |
INumericalDataSeries.getChildren
▸ getChildrenCount(): number
Return number of child data
number
INumericalDataSeries.getChildrenCount
ObjectDataSeries.getChildrenCount
▸ getClassName(): string
string
INumericalDataSeries.getClassName
▸ getDataOrder(): Order
Returns data ordering of the data series.
INumericalDataSeries.getDataOrder
▸ getId(): string | number
Returns the identifier of the data series.
string | number
▸ getLength(): number
Returns the number of values in the data series.
number
INumericalDataSeries.getLength
▸ getMax(unit?): number
Returns max value
| Name | Type | Description |
|---|---|---|
Optional unit | string | unit optional output unit to convert the data to (if none specified, data is not converted) |
number
max
▸ getMin(unit?): number
Returns min value
| Name | Type | Description |
|---|---|---|
Optional unit | string | unit optional output unit to convert the data to (if none specified, data is not converted) |
number
min
▸ getName(): string
Returns data object name
string
▸ getParent(): DataObject
Gets parent data item
INumericalDataSeries.getParent
▸ getProperties(): OptionsOut
Gets all the properties pertaining to this object
JSON options object
INumericalDataSeries.getProperties
ObjectDataSeries.getProperties
▸ getProperty(name): any
Gets property by name
| Name | Type | Description |
|---|---|---|
name | string | property name |
any
INumericalDataSeries.getProperty
▸ Protected getTimeStamp(): number
Returns the timestamp of the data series.
number
INumericalDataSeries.getTimeStamp
▸ getType(): string
Returns data type
string
▸ getUnit(): AbstractUnit
Returns unit of the data series.
unit
▸ getUri(): string
Returns unique resource identifier
string
▸ getValue(index): number
Returns the value at given index.
| Name | Type | Description |
|---|---|---|
index | number | the index should be a number greater than or equal to zero, and less than the number of values as returned by getLength() method. |
number
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
INumericalDataSeries.hasEventListener
ObjectDataSeries.hasEventListener
▸ hasProperty(name): boolean
Returns whether data object contains specific property
| Name | Type | Description |
|---|---|---|
name | string | property name |
boolean
INumericalDataSeries.hasProperty
▸ indexOfChild(data): number
Return index of child data ( index of the specified child or -1 if data is not found)
| Name | Type | Description |
|---|---|---|
data | DataObject | data object to check index |
number
INumericalDataSeries.indexOfChild
▸ insertChild(index, item, silent?): NumericalObjectDataSeries
Insert item by index
| Name | Type | Description |
|---|---|---|
index | number | specified index |
item | DataObject | node |
Optional silent | boolean | will not fire any events if true |
this
INumericalDataSeries.insertChild
▸ insertValue(index, value): NumericalObjectDataSeries
Does nothing
| Name | Type | Description |
|---|---|---|
index | number | the index number where to insert the value. |
value | number | the value to insert |
this
▸ insertValues(index, array): NumericalObjectDataSeries
Does nothing
| Name | Type | Description |
|---|---|---|
index | number | the index number where to insert the values. Values will be added starting at the index number. |
array | number[] | the array of values to insert |
this
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
INumericalDataSeries.isDisposed
▸ isReadOnly(): boolean
Returns true
boolean
true
INumericalDataSeries.isReadOnly
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ notify<E>(type, source, args?): NumericalObjectDataSeries
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | AbstractDataSeries<any> | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ off<E>(type?, callback?): NumericalObjectDataSeries
Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: NumericalObjectDataSeries, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): NumericalObjectDataSeries
Attach listener on event that will be called whenever the specified event is delivered to the target
If the callback function is already in the list of event listeners for this target, the function is not added a second time.
If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: NumericalObjectDataSeries, args: EventMap[E]) => void | to be called |
this
▸ onPropertyChanged(prop): NumericalObjectDataSeries
This method is called if property bag is changed using setProperty method
| Name | Type | Description |
|---|---|---|
prop | Object | property |
prop.name | string | |
prop.value | any |
this
INumericalDataSeries.onPropertyChanged
ObjectDataSeries.onPropertyChanged
▸ query(): QueryBuilder<any>
Query data item and child items by different conditions
Example
// Select by function
import {DataObject} from '@int/geotoolkit/data/DataObject';
const dataobject = new DataObject({'name': 'test', 'uri': 'testuri', 'type': 'testtype'});
const item1 = new DataObject({'name': 'item1', 'uri': 'item1', 'type': 'test'});
const item2 = new DataObject({'name': 'item2', 'uri': 'item2', 'type': 'test'});
dataobject.addChild([item1, item2]);
const item5 = new DataObject({'name': 'item5', 'uri': 'item5', 'type': 'test'});
item2.addChild(item5);
let founditem = null;
dataobject.query()
.where( (item: DataObject) => item.getParent() === dataobject)
.where( (item: DataObject) => item.getUri() === 'item2')
.select((item: DataObject) => {
founditem = item;
});Example
// Select by expression
dataobject.query()
.where( 'item => uri(item) == "item5"')
.select((item: DataObject) => {
founditem = item;
});QueryBuilder<any>
query object which has methods 'where' tp specify conditions, 'select' to run query, 'selectToArray' select results to array Expressions syntax: "item => expression", where expression:
- logical and arithmetic operators
- embedded functions: name(item) - gets name of the data object url(item) - gets url of the data object type(item) - gets type of the data object
▸ removeChild(data, silent?): NumericalObjectDataSeries
Remove child data object
| Name | Type | Description |
|---|---|---|
data | DataObject | data object to be removed |
Optional silent | boolean | will not fire any events if true |
this
INumericalDataSeries.removeChild
▸ removeValues(index, count?): NumericalObjectDataSeries
Does nothing
| Name | Type | Description |
|---|---|---|
index | number | the index number where to start removing the values |
Optional count | number | the amount of values to remove |
this
▸ reverseValues(): NumericalObjectDataSeries
Reverse values
ObjectDataSeries.reverseValues
▸ set(index, item): DataObject
Sets item by index
| Name | Type | Description |
|---|---|---|
index | number | index of the item |
item | DataObject | node |
▸ setId(id): NumericalObjectDataSeries
Sets the identifier of the data series.
| Name | Type | Description |
|---|---|---|
id | string | number | a new identifier |
this
▸ setName(name): NumericalObjectDataSeries
Sets data object name
| Name | Type | Description |
|---|---|---|
name | string | data object name |
this
▸ setParent(parent): NumericalObjectDataSeries
Sets parent data item
| Name | Type | Description |
|---|---|---|
parent | DataObject | parent data item |
this
INumericalDataSeries.setParent
▸ setProperties(properties?): NumericalObjectDataSeries
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options<any> | JSON options object |
this
INumericalDataSeries.setProperties
ObjectDataSeries.setProperties
▸ setProperty(name, value): NumericalObjectDataSeries
Sets property by name
| Name | Type | Description |
|---|---|---|
name | string | property name |
value | any | property value |
this
INumericalDataSeries.setProperty
▸ setSilent(bool): NumericalObjectDataSeries
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
INumericalDataSeries.setSilent
▸ setType(type): NumericalObjectDataSeries
Sets data object type
| Name | Type | Description |
|---|---|---|
type | string | data type |
this
▸ setUnit(unit?): NumericalObjectDataSeries
Sets unit of the data series.
| Name | Type | Description |
|---|---|---|
Optional unit | string | AbstractUnit | unit to be set |
this
▸ setUri(uri): NumericalObjectDataSeries
Sets unique resource identifier
| Name | Type | Description |
|---|---|---|
uri | string | unique identifier |
this
▸ setValue(index, value): NumericalObjectDataSeries
Does nothing
| Name | Type | Description |
|---|---|---|
index | number | the index should be a number greater than or equal to zero, and less than the number of values as returned by getLength() method. |
value | number | value to set |
this
▸ setValues(array, copy?): NumericalObjectDataSeries
Does nothing
| Name | Type | Description |
|---|---|---|
array | number[] | an array of values to set |
Optional copy | boolean | make a deep copy of the values |
this
▸ toArray(copy?, unit?): number[]
Returns an array of objects in the data series.
| Name | Type | Description |
|---|---|---|
Optional copy | boolean | whether creating a copy of data |
Optional unit | string | AbstractUnit | unit optional output unit to convert the data to. if not specified, data will not be converted |
number[]
▸ update(args?): NumericalObjectDataSeries
Notifies the data series has been updated. The timestamp will be updated and Events.Updated event will be fired.
Fires
| Name | Type | Description |
|---|---|---|
Optional args | Object | event args |
args.count | number | |
args.index | number | |
args.type | StateChanges |
this
▸ Protected updateTimeStamp(): NumericalObjectDataSeries
Updates timestamp of the data series.
INumericalDataSeries.updateTimeStamp
ObjectDataSeries.updateTimeStamp
▸ updating(args?): NumericalObjectDataSeries
Notifies the data series has been started updating. The Events.Updating event will be fired.
Fires
| Name | Type | Description |
|---|---|---|
Optional args | Object | event args |
args.count | number | |
args.index | number | |
args.type | StateChanges |
this
▸ Static getClassName(): string
string
▸ Static getFormulaDescription(name?): string
Get formula's description
| Name | Type | Description |
|---|---|---|
Optional name | string | name of function |
string
ObjectDataSeries.getFormulaDescription
▸ Static getFormulas(): string[]
List formulas
string[]
▸ Static setFormula(name, func?, desc?): void
Set function which can be used to calculate some value (e.g. sum, avg etc.)
Example
DataSeries.setFormula('concat', (series) => {
return series.toArray().join(' ');
});
const series = new DataSeries({
'type': 'string',
'data': ['just', 'some', 'text']
});
console.log(series.calculate('concat')); // 'just some text'| Name | Type | Description |
|---|---|---|
name | string | FormulaDescription | name of function or parameters object |
Optional func | Formula | handler, use null to unset |
Optional desc | string | description |
void