Class: Series

data. Series

A Series groups together Observation which have the same Dimension values with the exception of the dimension that is being iterated over.

For example if the dimension that is being iterated over is TIME_PERIOD then all the Observations in the Series will differ only by the observation time.

A Series should not be constructed directly, and should be obtained via the data.SeriesGroup


new Series()

Example
//Group Series by Reference Area
 var seriesGroup = dataset.createSeries("REF_AREA");

 var series = seriesGroup.getSeries();
 var firstSeries = series[0];
 var observations = firstSeries.getObservations();
    
 for(var j=0; j < observations.length; j++) {
   //Iterate Observations in Series
   //Each Observation for this series will only differ by the reported REF_AREA
 }

Methods


getDataSet()

Returns the DataSet to which this Series belongs.

Returns:
Type
data.DataSet

getDimensionValue(dimId)

Returns the DataSetCode which contains the reported value for the given dimension id.

If the dimId is the same as the SeriesGroup.getDimensionAtObs() value, then this will return null, as this dimension value is not fixed for the entire series.

Parameters:
Name Type Description
dimId string

the dimension id

Returns:
Type
data.DataSetCode

getObservation(dimIdVal)

Returns the Observation where the reported value for the data.SeriesGroup#getDimensionAtObs matches the passed in value

Parameters:
Name Type Description
dimIdVal string

the reported value of the dimension at observation to return the observation for

Returns:

or null if there is no match

Type
data.Observation
Example
var obs = series.getObservationByReportedDimId("2002"); //returns the Observation for 2002 from a time series Series

getObservations()

Returns an Array of Observations for this series

Returns:
Type
Array.<data.Observation>

getSeriesAttributeById(attributeId)

Returns the reported series level attribute as a DataSetCode with the given attributeId.

Returns null if there is no attribute with the given id

Parameters:
Name Type Description
attributeId string
Returns:
Type
data.DataSetCode

getSeriesAttributes()

Returns the reported attributes which are the same for each Observation that belongs to this Series.

The returned attributes are returned as an array of DataSetCodes - which contain both the code id, and name, and links back to the parent DataSetComponent.

Returns:
Type
Array.<data.DataSetCode>

getSeriesGroup()

Returns the data.SeriesGroup to which this series belongs

Returns:
Type
data.SeriesGroup

getShortCode()

Returns the series key as a String with colon separators between the dimension values, for example

 A:UK:FR:IVGH
Returns:
Type
string

sortObs(sort)

Sort observations according to the function.

Parameters:
Name Type Description
sort function

function

See: