Last updated

API / geotoolkit / data / NumericalDataSeries / NumericalDataSeries

Class: NumericalDataSeries

data.NumericalDataSeries.NumericalDataSeries

Define a numerical series of data It has predefined 'sum' and 'avg' formulas to use with NumericalDataSeries.calculate

Hierarchy

Implements

Table of contents

Constructors
Properties
Methods
Css Properties
Name Type Description
idnumber | stringUnique id of the data series
namestringName
typestringType
unitstringUnit of the data series
uristringUnique resource identifier

Contents

Constructors

new NumericalDataSeries(options)

new NumericalDataSeries(options?)

Parameters

Name Type
Optional optionsOptions

Overrides

DataSeries<number>.constructor

Properties

clone

clone: (copyData?: boolean) => NumericalDataSeries

Type declaration

▸ (copyData?): NumericalDataSeries

Parameters
Name Type
Optional copyDataboolean
Returns

NumericalDataSeries

Implementation of

INumericalDataSeries.clone

Overrides

DataSeries.clone

Methods

addChild

addChild(data): NumericalDataSeries

Add a child object

Parameters

Name Type Description
dataDataObject | DataObject[]the child data to be added

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.addChild

Inherited from

DataSeries.addChild


addProperties

addProperties(properties): NumericalDataSeries

Add additional properties

Parameters

Name Type Description
propertiesRecord<string, any>additional properties of the dataobject

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.addProperties

Inherited from

DataSeries.addProperties


addValue

addValue(value): NumericalDataSeries

Adds a value to the data series.

Parameters

Name Type Description
valuenumbera new value

Returns

NumericalDataSeries

this

Overrides

DataSeries.addValue


addValues

addValues(array): NumericalDataSeries

Adds an array of values to the data series.

Parameters

Name Type Description
arraynumber[]an array of values

Returns

NumericalDataSeries

this

Overrides

DataSeries.addValues


calculate

calculate(name): any

Run function. See available formulas list by DataSeries.getFormulas

Parameters

Name Type Description
namestringname

Returns

any

Inherited from

DataSeries.calculate


clearChildren

clearChildren(): NumericalDataSeries

Remove all child data

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.clearChildren

Inherited from

DataSeries.clearChildren


clearValues

clearValues(): NumericalDataSeries

Clears all values of the data series.

Returns

NumericalDataSeries

this

Inherited from

DataSeries.clearValues


convertValues

Protected convertValues<U>(values, fromUnit?, toUnit?): U

Converts values from one unit to another specified unit.

Type parameters

NameType
Uextends number | number[]

Parameters

Name Type Description
valuesUarray of values or a single value
Optional fromUnitstring | AbstractUnitthe original unit of the value(s)
Optional toUnitstring | AbstractUnitthe unit to convert the value(s) to

Returns

U

Implementation of

INumericalDataSeries.convertValues

Overrides

DataSeries.convertValues


copyConstructor

Protected copyConstructor(src, copyData?): NumericalDataSeries

Copy constructor function.
Function used as part of the cloning mechanism.
Implementations should copy the given instance state to this instance.

Parameters

Name Type Description
srcDataSeries<number>Source to copy from
Optional copyDatabooleancopy data

Returns

NumericalDataSeries

Implementation of

INumericalDataSeries.copyConstructor

Inherited from

DataSeries.copyConstructor


dispose

dispose(): void

Dispose data object and all children. Clear all listeners

Returns

void

Implementation of

INumericalDataSeries.dispose

Inherited from

DataSeries.dispose


getChild

getChild(i): DataObject

Return data by index

Parameters

Name Type Description
inumberindex of the data

Returns

DataObject

child

Implementation of

INumericalDataSeries.getChild

Inherited from

DataSeries.getChild


getChildren

getChildren(filter?): Iterator<DataObject>

Return iterator by child data objects

Parameters

Name Type Description
Optional filter(data: DataObject) => booleana filter function. Returns all child data objects if the value is null.

Returns

Iterator<DataObject>

Implementation of

INumericalDataSeries.getChildren

Inherited from

DataSeries.getChildren


getChildrenCount

getChildrenCount(): number

Return number of child data

Returns

number

Implementation of

INumericalDataSeries.getChildrenCount

Inherited from

DataSeries.getChildrenCount


getClassName

getClassName(): string

Returns

string

Implementation of

INumericalDataSeries.getClassName

Inherited from

DataSeries.getClassName


getDataOrder

getDataOrder(): Order

Returns data ordering of the data series.

Returns

Order

Implementation of

INumericalDataSeries.getDataOrder

Inherited from

DataSeries.getDataOrder


getId

getId(): string | number

Returns the identifier of the data series.

Returns

string | number

Implementation of

INumericalDataSeries.getId

Inherited from

DataSeries.getId


getLength

getLength(): number

Returns the number of values in the data series.

Returns

number

Implementation of

INumericalDataSeries.getLength

Inherited from

DataSeries.getLength


getMax

getMax(unit?): number

Returns max value

Parameters

Name Type Description
Optional unitstring | AbstractUnitunit optional output unit to convert the data to (if none specified, data is not converted)

Returns

number

max

Implementation of

INumericalDataSeries.getMax


getMin

getMin(unit?): number

Returns min value

Parameters

Name Type Description
Optional unitstring | AbstractUnitunit optional output unit to convert the data to (if none specified, data is not converted)

Returns

number

min

Implementation of

INumericalDataSeries.getMin


getName

getName(): string

Returns data object name

Returns

string

Implementation of

INumericalDataSeries.getName

Inherited from

DataSeries.getName


getParent

getParent(): DataObject

Gets parent data item

Returns

DataObject

Implementation of

INumericalDataSeries.getParent

Inherited from

DataSeries.getParent


getProperties

getProperties(): OptionsOut

Gets all the properties pertaining to this object

Returns

OptionsOut

JSON options object

Implementation of

INumericalDataSeries.getProperties

Inherited from

DataSeries.getProperties


getProperty

getProperty(name): any

Gets property by name

Parameters

Name Type Description
namestringproperty name

Returns

any

Implementation of

INumericalDataSeries.getProperty

Inherited from

DataSeries.getProperty


getTimeStamp

Protected getTimeStamp(): number

Returns the timestamp of the data series.

Returns

number

Implementation of

INumericalDataSeries.getTimeStamp

Inherited from

DataSeries.getTimeStamp


getType

getType(): string

Returns data type

Returns

string

Implementation of

INumericalDataSeries.getType

Inherited from

DataSeries.getType


getUnit

getUnit(): AbstractUnit

Returns unit of the data series.

Returns

AbstractUnit

unit

Implementation of

INumericalDataSeries.getUnit

Inherited from

DataSeries.getUnit


getUri

getUri(): string

Returns unique resource identifier

Returns

string

Implementation of

INumericalDataSeries.getUri

Inherited from

DataSeries.getUri


getValue

getValue(index): number

Returns the value at given index.

Parameters

Name Type Description
indexnumberthe index should be a number greater than or equal to zero, and less than the number of values as returned by getLength() method.

Returns

number

Implementation of

INumericalDataSeries.getValue

Inherited from

DataSeries.getValue


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Implementation of

INumericalDataSeries.hasEventListener

Inherited from

DataSeries.hasEventListener


hasProperty

hasProperty(name): boolean

Returns whether data object contains specific property

Parameters

Name Type Description
namestringproperty name

Returns

boolean

Implementation of

INumericalDataSeries.hasProperty

Inherited from

DataSeries.hasProperty


indexOfChild

indexOfChild(data): number

Return index of child data ( index of the specified child or -1 if data is not found)

Parameters

Name Type Description
dataDataObjectdata object to check index

Returns

number

Implementation of

INumericalDataSeries.indexOfChild

Inherited from

DataSeries.indexOfChild


insertChild

insertChild(index, item, silent?): NumericalDataSeries

Insert item by index

Parameters

Name Type Description
indexnumberspecified index
itemDataObjectnode
Optional silentbooleanwill not fire any events if true

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.insertChild

Inherited from

DataSeries.insertChild


insertValue

insertValue(index, value): NumericalDataSeries

Inserts a value at the specified index.

Parameters

Name Type Description
indexnumberthe index number where to insert the value.
valuenumberthe value to insert

Returns

NumericalDataSeries

this

Overrides

DataSeries.insertValue


insertValues

insertValues(index, array): NumericalDataSeries

Inserts an array of values at the specified index.

Parameters

Name Type Description
indexnumberthe index number where to insert the values. Values will be added starting at the index number.
arraynumber[]the array of values to insert

Returns

NumericalDataSeries

this

Overrides

DataSeries.insertValues


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Implementation of

INumericalDataSeries.isDisposed

Inherited from

DataSeries.isDisposed


isReadOnly

isReadOnly(): boolean

Returns false

Returns

boolean

false

Implementation of

INumericalDataSeries.isReadOnly

Inherited from

DataSeries.isReadOnly


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Implementation of

INumericalDataSeries.isSilent

Inherited from

DataSeries.isSilent


notify

notify<E>(type, source, args?): NumericalDataSeries

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceAbstractDataSeries<any>of the event
Optional argsEventMap[E]arguments of the event

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.notify

Inherited from

DataSeries.notify


off

off<E>(type?, callback?): NumericalDataSeries

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.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: NumericalDataSeries, args: EventMap[E]) => voidfunction to be called

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.off

Inherited from

DataSeries.off


on

on<E>(type, callback): NumericalDataSeries

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.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: NumericalDataSeries, args: EventMap[E]) => voidto be called

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.on

Inherited from

DataSeries.on


onPropertyChanged

onPropertyChanged(prop): NumericalDataSeries

This method is called if property bag is changed using setProperty method

Parameters

Name Type Description
propObjectproperty
prop.namestring
prop.valueany

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.onPropertyChanged

Inherited from

DataSeries.onPropertyChanged


query

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;
});

Returns

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

Implementation of

INumericalDataSeries.query

Inherited from

DataSeries.query


removeChild

removeChild(data, silent?): NumericalDataSeries

Remove child data object

Parameters

Name Type Description
dataDataObjectdata object to be removed
Optional silentbooleanwill not fire any events if true

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.removeChild

Inherited from

DataSeries.removeChild


removeValues

removeValues(index, count?): NumericalDataSeries

Removes a specified amount of values at the specified index.

Parameters

Name Type Description
indexnumberthe index number where to start removing the values
Optional countnumberthe amount of values to remove

Returns

NumericalDataSeries

this

Inherited from

DataSeries.removeValues


reverseValues

reverseValues(): NumericalDataSeries

Reverse values

Returns

NumericalDataSeries

Inherited from

DataSeries.reverseValues


set

set(index, item): DataObject

Sets item by index

Parameters

Name Type Description
indexnumberindex of the item
itemDataObjectnode

Returns

DataObject

Implementation of

INumericalDataSeries.set

Inherited from

DataSeries.set


setId

setId(id): NumericalDataSeries

Sets the identifier of the data series.

Parameters

Name Type Description
idstring | numbera new identifier

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setId

Inherited from

DataSeries.setId


setName

setName(name): NumericalDataSeries

Sets data object name

Parameters

Name Type Description
namestringdata object name

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setName

Inherited from

DataSeries.setName


setParent

setParent(parent): NumericalDataSeries

Sets parent data item

Parameters

Name Type Description
parentDataObjectparent data item

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setParent

Inherited from

DataSeries.setParent


setProperties

setProperties(properties?): NumericalDataSeries

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptions<any>JSON options object

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setProperties

Inherited from

DataSeries.setProperties


setProperty

setProperty(name, value): NumericalDataSeries

Sets property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setProperty

Inherited from

DataSeries.setProperty


setSilent

setSilent(bool): NumericalDataSeries

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setSilent

Inherited from

DataSeries.setSilent


setType

setType(type): NumericalDataSeries

Sets data object type

Parameters

Name Type Description
typestringdata type

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setType

Inherited from

DataSeries.setType


setUnit

setUnit(unit?): NumericalDataSeries

Sets unit of the data series.

Parameters

Name Type Description
Optional unitstring | AbstractUnitunit to be set

Returns

NumericalDataSeries

this

Inherited from

DataSeries.setUnit


setUri

setUri(uri): NumericalDataSeries

Sets unique resource identifier

Parameters

Name Type Description
uristringunique identifier

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.setUri

Inherited from

DataSeries.setUri


setValue

setValue(index, value): NumericalDataSeries

Sets the value at given index.

Parameters

Name Type Description
indexnumberthe index should be a number greater than or equal to zero, and less than the number of values as returned by getLength() method.
valuenumbervalue to set

Returns

NumericalDataSeries

this

Overrides

DataSeries.setValue


setValues

setValues(array, copy?): NumericalDataSeries

Sets an array of values to the data series.

Parameters

Name Type Description
arraynumber[]an array of values to set
Optional copybooleanmake a deep copy of the values

Returns

NumericalDataSeries

this

Overrides

DataSeries.setValues


toArray

toArray(copy?, unit?): number[]

Returns an array of objects in the data series.

Parameters

Name Type Description
Optional copybooleanwhether creating a copy of data
Optional unitstring | AbstractUnitunit optional output unit to convert the data to. if not specified, data will not be converted

Returns

number[]

Implementation of

INumericalDataSeries.toArray

Inherited from

DataSeries.toArray


update

update(args?): NumericalDataSeries

Notifies the data series has been updated. The timestamp will be updated and Events.Updated event will be fired.

Fires

Events.Updated

Parameters

Name Type Description
Optional argsObjectevent args
args.countnumber
args.indexnumber
args.typeStateChanges

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.update

Inherited from

DataSeries.update


updateTimeStamp

Protected updateTimeStamp(): NumericalDataSeries

Updates timestamp of the data series.

Returns

NumericalDataSeries

Implementation of

INumericalDataSeries.updateTimeStamp

Inherited from

DataSeries.updateTimeStamp


updating

updating(args?): NumericalDataSeries

Notifies the data series has been started updating. The Events.Updating event will be fired.

Fires

Events.Updating

Parameters

Name Type Description
Optional argsObjectevent args
args.countnumber
args.indexnumber
args.typeStateChanges

Returns

NumericalDataSeries

this

Implementation of

INumericalDataSeries.updating

Inherited from

DataSeries.updating


getClassName

Static getClassName(): string

Returns

string

Inherited from

DataSeries.getClassName


getFormulaDescription

Static getFormulaDescription(name?): string

Get formula's description

Parameters

Name Type Description
Optional namestringname of function

Returns

string

Inherited from

DataSeries.getFormulaDescription


getFormulas

Static getFormulas(): string[]

List formulas

Returns

string[]

Inherited from

DataSeries.getFormulas


setFormula

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'

Parameters

Name Type Description
namestring | FormulaDescriptionname of function or parameters object
Optional funcFormulahandler, use null to unset
Optional descstringdescription

Returns

void

Inherited from

DataSeries.setFormula