Analysis
A dashboard that filters together
Filter a dashboard of KPI cards, a PivotChart and a pivot with its slicers, then move, resize and add items. Undo takes back each change.
- Orders
- 200
- Items
- 0
- Layout
- Twelve-column grid
Try it
- Arrange by handDrag an item's header to move it, or its corner to resize it.
How a dashboard works
- A dashboard is a sheet with
kind: "dashboard". Its pivots compute from the Orders table without writing output cells. - A slicer filters every pivot, PivotChart and KPI card whose table reaches its column, as an Excel slicer filters its connected PivotTables. Its selection is saved and undone.
- A KPI card shows a data model measure in the slicers' filter context. Items never overlap: a move or resize into another item's place is refused, and the view says so.
The pivots compute from the Orders table; the slicer's selection is saved and undone.
The code behind it
import "@sheetwrite/core/styles.css";
// An "orders" table with a Region column (B) and a Revenue column (E)
// Pivots and measures need the full engine// The grid fills its host, so the host needs a heightconst host = document.querySelector<HTMLElement>("#grid");if (host === null) throw new Error("Missing #grid host");host.style.height = "480px";
// A dashboard sheet lays out pivots, charts, KPI cards and slicers on twelve columns { }, "dashboard",);
// A KPI card shows a data model measure, defined below // The slicer filters the KPI card and the pivot together { },];
// The measure and the items in one transaction: one undo step, saved and synced// with the workbook { }, ],});
// When the page removes the host: grid.destroy();