new AggregatedDataSet()
Example
var aggregatedDataSet = dataset.aggregate(["REF_AREA", "SEX"], 1);
Methods
-
createSeries(dimensionAtObservation)
-
Returns SeriesGroup which is a container used to group Observations.
The grouping is based on the dimensionAtObservation grouping parameter.
Parameters:
Name Type Description dimensionAtObservation
string the id of the Dimension to group by
Returns:
- Type
- data.SeriesGroup
Example
To create SeriesGroup with Series that iterate Observations over Time: var seriesGroup = dataSet.createSeries("TIME_PERIOD");
-
filterObs(obsQuery)
-
Returns a flat Array of all the AggregateObservations which match the filter parameters.
The filter must be a JSON Object which contains one or more Dimension id to Dimension Code Id pairs.
Note: A Dimension can not map to more then one Code Id
Parameters:
Name Type Description obsQuery
object A JSON Object of dimension values example:
{ "FREQ":"A", "REF_AREA":"UK" }Returns:
- Type
- Array.<data.AggregateObservation>
Example
function onDataQueryResponse(dataset) { var filter = { "REF_AREA", "UK", "SEX", "M", } var observations = dataset.filterObs(filter); }
-
getAggregationFunction()
-
Returns the aggregation function, which is either.
1 - sum
2 - arithmetic mean
3 - min
4 - max
5 - standard deviation
6 - standard deviation population
7 - varience
8 - variance population
9 - countReturns:
- Type
- string
-
getDataEndDate()
-
Returns the latest date for this DataSet (based on the reported Observation times)
Returns:
- Type
- date
-
getDatasetTitle()
-
Returns the title of the DataSet, this will be the Dataflow name
Returns:
- Type
- string
-
getDataStartDate()
-
Returns the earliest date for this DataSet (based on the reported Observation times)
Returns:
- Type
- date
-
getDimension(dimId)
-
Returns the DataSetComponent with the given id, or null if no DataSetComponents exist with the given id
Parameters:
Name Type Description dimId
string The Dimension id, e.g FREQ
Returns:
-
getDimensionId(dimIndex)
-
Returns the DataSetComponent Id for the given array index as it appears in the dataset.getDimensionIds method (zero indexed).
Parameters:
Name Type Description dimIndex
number the index of the DataSetComponent in the array
Returns:
- Type
- string
-
getDimensionIds()
-
Return the DataSetComponent ids as a string array in the same order that the DataSetComponents appear in the dataset.getDimensions() method
Returns:
- Type
- Array.<string>
-
getDimensionIndex(dimId)
-
Return the data.DataSetComponent index in the data.DataSet#getDimensions array from the given data.DataSetComponent Id
Parameters:
Name Type Description dimId
string The dimension id, e.g FREQ
Returns:
zero indexed, -1 is returned if it does not exist
- Type
- number
-
getDimensions()
-
Returns an array of DataSetComponent for each Dimension in this DataSet
Returns:
- Type
- Array.<data.DataSetComponent>
-
getDimensionSize(dimId)
-
Returns number of distinct DataSetCodes for the DataSetComponent with the given id.
Parameters:
Name Type Description dimId
string The Dimension id, e.g FREQ
Returns:
the number of codes values for the dimension in this DataSet
- Type
- number
-
getDimensionSizes()
-
Returns a count of the number of distinct DataSetCodes for each DataSetComponent.
The order of the returned array is in the same sequence as the dataset.getDimensions() method
Returns:
- Type
- Array.<number>
-
getMetadata(callback)
-
Returns any linked ReferenceMetadata to the callback function
Parameters:
Name Type Description callback
function to be called with ReferenceMetadata[]
-
getMetadataDefs()
-
Returns an array of metadata.ReferenceMetadataLink, or an empty array if there are none
Returns:
-
getObs()
-
Returns an array of all the AggregateObservation for this DataSet
Returns:
- Type
- Array.<data.AggregateObservation>
-
getObsByShortCode(shortCode)
-
Returns a AggregateObservation with the given Shortcode
Parameters:
Name Type Description shortCode
string Observation Short Code
Returns:
-
getObsByUid(uid)
-
Returns a AggregateObservation with the given UID
Parameters:
Name Type Description uid
string Observation UID
Returns:
-
getRequestURI()
-
Returns the data query URI that was used to retrieve this dataset, for example:
"/data/WB,WDI_ECON_POL_DEBT,1.0/.BN_KLT_DINV_CD."Returns:
- Type
- string
-
getUid()
-
Returns a unique identifier for this dataset.
Returns:
- Type
- string
-
hasMetadata()
-
Returns true if there are metadata.ReferenceMetadata attached to this object, if this is true then the dataset.getMetadataDefs() method will return a non-empty array
Returns:
- Type
- boolean
-
hasObs()
-
Returns true if the DataSet has one or more Observations
Returns:
- Type
- boolean
-
setAggregationFunction(func)
-
Sets the aggregation function which is either
1 - sum
2 - arithmetic mean
3 - min
4 - max
5 - standard deviation
6 - standard deviation population
7 - varience
8 - variance population
9 - countParameters:
Name Type Description func
number the aggregation function