You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set `compareTo` on any data-bound widget to add a second query against a
484
+
shifted time window. The renderer derives the comparison automatically;
485
+
no second `filter` is required.
486
+
487
+
| Value | Behaviour |
488
+
|:--|:--|
489
+
|`'previousPeriod'`| Inspect the widget `filter` for date-macro tokens (`{current_month_start}`, `{last_7_days}`, …) and shift the window back by one period of the same kind. |
490
+
|`'previousYear'`| Shift the resolved filter window back by one calendar year. |
491
+
|`{ offset: '7d' }`| Shift by an explicit duration. Units: `d` (days), `w` (weeks), `M` (months), `y` (years). |
492
+
493
+
***Metric widgets** — the prior-period value renders as a small caption
494
+
beneath the headline number, alongside a green/red delta arrow.
495
+
Authors should *not* hand-author `options.trend` when `compareTo` is
496
+
set; the renderer wins and overwrites it.
497
+
***Chart widgets** — the comparison series is appended after the
498
+
primary series with `variant: 'comparison'` and styled as a muted /
499
+
dashed overlay. Single-series charts (bar / line / area) get an
500
+
automatic second series; multi-series pivots are not yet supported.
501
+
***Requirements** — `compareTo` is a no-op when the filter contains no
502
+
resolvable date macros and no global `dateRange` is configured.
0 commit comments