For the complete documentation index, see llms.txt. This page is also available as Markdown.

Dashboard cookbook

Recipes for the dashboard shapes people build most often.

Your goal

Get to a working dashboard faster by starting from a shape that already solves your problem.

Before you start

These recipes are advanced-mode JSON. The structure they use - sections, cards, charts, datasets, transformations - is described in Dashboard, and the workflow is in Create a custom dashboard.

Each query_id below is a placeholder: save your own query and use its ID. The comments show the query the recipe assumes.

Friendly dates

@date_histogram queries return timestamps. The format-dates transformation makes them readable.

{
    "title": "Application events (last 6 months)",
    "type": "Bars",
    "dataset": {
        "type": "format-dates",
        "sources": [
            {
                // A @date_histogram query
                "type": "OTQL",
                "query_id": "666"
            }
        ],
        "date_options": {
            "format": "YYYY-MM-DD"
        }
    }
}

The same transformation applies to the result of a join, so you can format the dates of several series at once - for instance monthly events per channel.

Wrap the join dataset in format-dates rather than formatting each source separately.

A collection volume with its history

A good way to show a collection volume is the current number next to a short history. That is two charts in one card:

  • a Metric chart on an OTQL query such as SELECT @count{} FROM UserPoint,

  • a Bars chart on a collection volumes query.

The collection volumes data source is described in Monitor collection volume.

Comparing an audience to the datamart

To answer "do users in this audience behave differently from all users?", build a dashboard at the builders and/or segments scope with the metric for the audience, the same metric for all users, and an index to show what is over- or under-represented.

Names instead of IDs

A chart returning channels, compartments, or segments shows IDs, which nobody recognises. The get-decorators transformation replaces them with names.

Note how transformations nest: the OTQL result goes through to-percentages, and that result goes through get-decorators. Order matters - decorate last, once the values are final.

Setting "format": "percentage" on the chart options is what makes the labels and tooltips read as percentages.

A @cardinality query as a single number

@cardinality queries return a key/value dataset. Even when that dataset holds a single value, it cannot be displayed as a Metric chart as-is. The reduce transformation puts it in the right format.

Habits worth keeping

  • Several small dashboards, not one big one - it avoids executing too many requests at once.

  • Save charts in the Query Tool where you can, so a change propagates to every dashboard using them. Editing a chart in advanced mode breaks that link.

  • Decorate anything that returns an ID.

  • Format dates on every histogram, or your axis shows timestamps.

  • Give every chart a title that states the question it answers.

Last updated

Was this helpful?