Class: SeriesGroup

data. SeriesGroup

A SeriesGroup is a container for Series which have been grouped by a particular Dimension.

A SeriesGroup is obtained by calling the DataSet.createSeries() method.


new SeriesGroup()

Example
var seriesGroup = dataset.createSeries("REF_AREA");
 var groupDimension = seriesGroup.getDimensionAtObs();
 seriesGroup.sortObs(seriesGroup.sortFunctionAsc()); //Sort Observations Ascending
 
 var allRefAreas = seriesGroup.getDistinctGroupValues(); //example UK, FR, DE
 
 
 //Iterate Series
 var series = seriesGroup.getSeries();
 for(var i=0; i < series.length; i++) {
    var currentSeries = series[i];
    var observations = currentSeries.getObservations();
    
    for(var j=0; j < observations.length; j++) {
    	//Iterate Observations in Series
    }
 }

Methods


getDataSet()

Returns the DataSet which was used to build this series grouping.

Returns:
Type
data.DataSet

getDimensionAtObs()

Returns id of the dimension at the observation level. This is the dimenison the the observations are iterating over.

For example the return value would be TIME_PERIOD if the observations were iterating over time.

Returns:
Type
string

getDistinctGroupValues()

Returns a string array containing the unique code ids for the grouping dimension. The ids are returend in ascending order.

For example if the SeriesGroup was created as a time series i.e dataset.createSeries("TIME_PERIOD"), then this method would return all the distinct time values, for example 2002, 2003, 2004, 2005

Returns:
Type
string

getSeries()

Returns the array of Series belonging to this SeriesGroup

Returns:
Type
Array.<data.Series>

sortFunctionAsc()

Returns a sort function to sort the observations in ascending order based on the observation concept value (e.g 2002, 2003, 2004)

Returns:

this can be passed to the seriesGroup.sortObs method

Type
function

sortFunctionDesc()

Returns a sort function to sort the observations in descending order based on the observation concept value (e.g 2004, 2003, 2002)

Returns:

this can be passed to the seriesGroup.sortObs method

Type
function

sortObs(sortFunction)

Sort data.Observation for each series according to the sort function

Parameters:
Name Type Description
sortFunction function

used to sort the observations, options are sortFunctionAsc or sortFunctionDesc or a custom sort function can be used

See:
Example
seriesGroup.sortObs(seriesGroup.sortFunctionAsc());