Skip to main content

Use cases

Time Series visualization

Visualize time series data in your apps.

In-app sparklines

Create inline visualizations in your apps.

Features

All the common API features, plus:
Aggregate data by various time granularities.Available granularities:
  • MINUTE: Aggregates values by minute intervals
  • FIVE_MINUTES: Aggregates values by 5-minute intervals
  • TEN_MINUTES: Aggregates values by 10-minute intervals
  • FIFTEEN_MINUTES: Aggregates values by 15-minute intervals
  • HOUR: Aggregates values by hourly intervals
  • DAY: Aggregates values by daily intervals
  • WEEK: Aggregates values by weekly intervals
  • MONTH: Aggregates values by monthly intervals
  • YEAR: Aggregates values by yearly intervals
Group results by specific columns.
Query
query TimeSeriesWithGroupByExample {
  timeSeries(input: {
    ...
    groupBy: ["restaurant_name"]
    ...
  }) {
    labels
    values
  }
}
Automatically zero-fills missing data points to ensure consistent time series.
Calculates time series granules for the given time zone, allowing for accurate representation of data across different geographical locations.
Query
query TimeSeriesWithGroupByExample {
  timeSeries(input: {
    ...
    timeZone: "America/Los_Angeles"
    ...
  }) {
    labels
    values
  }
}

Example

Example 1: Simple time series query

Get the total taco sales for the last 3 days, filtered by the restaurant name.
query TimeSeriesExample1 {
  timeSeries(input: {
    metric: {
      sum: {
        dataPool: {
          name: "TacoSoft Demo Data"
        },
        measure: {
          columnName: "taco_total_price"
        }
      }
    },
    granularity: DAY,
    timeRange: {
      relative: LAST_N_DAYS,
      n: 3
    },
    filterSql: "restaurant_name = 'El Buen Sabor'"
  }) {
    labels
    values
  }
}

Usage

Arguments

The fields for querying a Metric in time series format. A Metric’s time series query returns the values over a given time range aggregated by a given time granularity; day, month, or year, for example.
metric
MetricInput
The Metric to Query. It can be a pre-created one or it can be inlined here.
timeRange
TimeRangeInput
The time range for calculating the time series.
timeZone
String
The time zone to use. Dates and times are always returned in UTC, but setting the time zone influences relative time ranges and granularities.You can set this to “America/Los_Angeles”, “Europe/Berlin”, or any other value in the IANA time zone database. Defaults to “UTC”.
granularity
TimeSeriesGranularity
required
The time granularity (hour, day, month, etc.) to aggregate the Metric values by.
filterSql
String
The Query Filters to apply before retrieving the time series data, in the form of SQL. If no Query Filters are provided, all data is included.
groupBy
[String!]
Columns to group by.

Response

The time series response object. It contains an array of time series labels and an array of Metric values for the given time range and Query Filters.
labels
[String!]
required
The time series labels.
values
[String]
required
The time series values.
groups
[TimeSeriesResponseGroup!]
The time series values for each group in groupBy, if specified.
query
QueryInfo
required
The Query statistics and metadata.

Embeddable UI components

I