getTimeSeries
A Time Series model is a data model that represents series of labeled numerical values, grouped into equally sized time intervals, such as days or years. Suitable for rendering time series charts.
Usage
Options
The getTimeSeries
model inherits all options from the base options, plus:
column: the name of the column that will be used to get the time intervals. It must be a date/time column.
stepSize: the time interval that the time series will use for grouping data. Accepted values are:
year
,month
,week
,day
,hour
,minute
, andsecond
.stepMultiplier (optional): use this multiplier to increase the bin that will be used within the step size. For example, a
stepSize: day, stepMultiplier: 10
will return values in blocks of 10 days each. By default it's1
.operation: the statistical operation that will be performed on the
operationColumn
to get the numerical value for each time interval. Accepted values are:count
,avg
,min
,max
, andsum
.operationColumn: the name of the column that will be used to calculate the numerical value for each time interval. When using count, you can also use
*
to calculate total row count.
You can generate multiple series in the same model by using the splitByCategory
parameters
splitByCategory (optional): the name of the column that will be used to group the values into multiple series.
splitByCategoryLimit (optional): this is the maximum number of series (values in the
splitByCategory
) column that the model will return. Unless specific values are requested in splyByCategoryValues, the model will return the top highest values for the entire time range, based on the operation used.splitByCategoryValues (optional): this is a list of specific values from the
splitByCategory
column that will be returned as time series in the model. No other values will be returned.
Response
The response is composed of two items:
rows
: A list of rows, where each row is an object that includes the time interval (name
) and the associatedvalue
for that interval.If using categories, it also includes the
category
for that row.
categories
: A list containing the requested categories.
Without categories
With categories
The response can be then mapped to any HTML element, but more commonly it will be mapped to a a charting library to create time series charts.
Last updated