Stacked line chart

A stacked line chart (drawn as stacked areas) shows how series add up over an ordered category, usually time. The field mapping is the same as the stacked bar chart.

Category (X-axis)

categoryField should be ordered. Sort the query (ORDER BY month).

Data layout

Wide — multiple value columns

One row per category, one column per series. Map those columns as Values to stack.

Long — series + value columns

One row per category + series. Map Series (stack groups) and Value. Typical SQL:

SELECT
  date_trunc('week', occurred_at) AS week,
  source,
  COUNT(*) AS events
FROM activity
WHERE account_id = :customer_id
GROUP BY 1, 2
ORDER BY 1

Chart options

  • Smooth lines — interpolates the stack. Prefer off for weekly or monthly buckets.
  • Show legend — default on.