Skip to main content

Charts and dashboards

Any source becomes a chart. Any chart becomes part of a dashboard. There is no per-source setup because charts only need what every source has: field types and the aggregate query.

From source to chart​

  1. Pick a source (a store, a RabbitMQ stream, the customers source, …).
  2. Choose the chart type and configure it: group by a field, pick a metric (count, sum, average, …), add filters.
  3. The Insights app turns that into the same aggregate query your code can send, runs it and draws the result.

Chart types:

ChartFor
Composite (bar, line, area)Compare categories and trends over time
PieParts of a whole
NumberOne key figure
Fact sheetA compact set of facts

Grouping options include terms (by field value), date components and date intervals (day, week, month), geographic regions and missing values. Metrics include count, distinct count, sum, average, minimum, maximum, formulas and lists of values.

Dashboards​

A dashboard combines widgets: charts, tables, maps, filters, text and images. Widgets from different sources sit side by side, so one dashboard can show orders from a store, sensor alarms from a RabbitMQ stream and companies from the customers source.

The same query in code​

What a chart does can be done from your own app. This is revenue per category, as in the dashboard:

const { result } = await sdk.asAdmin().Insights().Source('Orders').aggregate({
aggMode: 'aggregation',
aggs: [
{
id: 'category',
aggregation: 'terms',
field: 'category.keyword',
aggs: [{ id: 'revenue', aggregation: 'sum', field: 'total' }]
}
]
})

The aggregation stages are the same ones the chart editor uses. A practical way to find the right query: build the chart in the app first.

Pre-aggregate large sources​

If a dashboard queries a very large source, create a transform: a derived source that stores the aggregation (for example revenue per day) and stays up to date automatically. Charts on the transform are fast, and it is again a source you can query with the API.

Why this matters​

Nothing has to be built between "data exists" and "someone can see it":

  • New data source? It has charts the moment it has fields.
  • New chart need? No developer is needed.
  • New integration? The API is already there.