Box plot
The box plot widget summarizes the distribution of a metric rather than a single number. Each box shows five statistics — minimum, first quartile (Q1), median, third quartile (Q3), and maximum — so you can see spread, skew, and typical range at a glance.
Use it for:
- Session-duration distribution (per platform, per version)
- Spread of in-app purchase amounts
- Any metric where the median and variance matter more than the total
Query requirements
Section titled “Query requirements”Return one row per category with a label column plus five numeric columns in this order and meaning: minimum, Q1, median, Q3, maximum. Alias them clearly as min, q1, median, q3, max — the widget matches columns by these names and falls back to column order otherwise.
Use ClickHouse quantile() for the quartiles.
SELECT platform, min(d) AS min, quantile(0.25)(d) AS q1, quantile(0.5)(d) AS median, quantile(0.75)(d) AS q3, quantile(0.95)(d) AS maxFROM ( SELECT platform, session_id, dateDiff('minute', min(timestamp), max(timestamp)) AS d FROM {table} WHERE name = 'app_started' GROUP BY platform, session_id)GROUP BY platformResult shape:
| platform | min | q1 | median | q3 | max |
|---|---|---|---|---|---|
| steam | 0 | 4 | 11 | 24 | 65 |
| ios | 0 | 3 | 8 | 18 | 52 |
Single distribution
Section titled “Single distribution”For one overall box, return a constant label:
Select / full SQL: replace platform with 'Sessions' AS label and drop GROUP BY platform (keep the inner per-session computation).
Common examples
Section titled “Common examples”Session duration spread per platform — see the full SQL above.
Purchase amount distribution
SELECT 'Purchases' AS label, min(toFloat64(value.amount)) AS min, quantile(0.25)(toFloat64(value.amount)) AS q1, quantile(0.5)(toFloat64(value.amount)) AS median, quantile(0.75)(toFloat64(value.amount)) AS q3, quantile(0.95)(toFloat64(value.amount)) AS maxFROM {table}WHERE name = 'purchase'