A dashboard is a sheet of the workbook with kind: "dashboard". It has a tab, a name, an order and a visibility like a worksheet, but it has no cells, rows or columns. It holds items on a grid of 12 columns.
Each item has an actions menu, where Move and Resize start; both also work with the arrow keys.
Insert › Dashboard › New Dashboard adds a dashboard sheet named Dashboard1, Dashboard2, and so on, and shows it. Hosts can do the same with grid.actions.newDashboard(), or choose the name:
On a dashboard, Insert › PivotTable asks for the table to analyze. It adds a pivot over that table and an item that shows it in the first free place, in one undo step, and opens the field list.
A dashboard snapshot has rowCount: 0, no columns and no cells. Cell, row, column, table and sheet-format operations that target a dashboard leave it unchanged. Its pivots read a table or the data model, not a range, because slicers filter tables.
Column x (0–11) and row y, width w and height h (1–64) in grid units. x+w is at most 12.
kind
What the item shows: "pivot", "slicer", "chart" or "kpi" (a KPI card). The other fields depend on it.
pivot
Pivot items: the ID of a pivot on the same sheet. If that pivot is removed, the item stays and shows #REF!; undo brings the pivot back.
field
Slicers: the table and column IDs whose values the slicer lists.
selected
Slicers: the values that pass, at most 10,000; absent means every value passes.
itemsWithNoData
Slicers: "dim" (the default), "hide" or "show"; see Slicers.
chart
Chart items: the ID of a chart on the same sheet; its pivot names the data. See PivotCharts.
measure
KPI cards: the ID of a measure of the workbook's data model.
numberFormat
KPI cards: the Excel number format code of the value; absent shows it as General.
title
Slicers and KPI cards: the caption; absent shows the column or measure name.
Items do not overlap, and a dashboard holds at most 64 items. They are kept in reading order: by box.y, then by box.x.
The dashboard view
While a dashboard is the active sheet, the grid shows its items over the cells. The toolbar, the side panel and the sheet tabs stay as they are. The view loads as its own chunk the first time a dashboard is shown.
A pivot item shows the pivot's result as a table, with each value field's number format. Pivots on a dashboard compute without placing output in cells. With the default engine, the item says that it needs the full engine.
A slicer item lists the values of its column. A click keeps one value, and Ctrl or Cmd with a click adds or removes a value; a slicer always keeps at least one value. Clear keeps every value. Each change is saved with the item.
Drag an item's header to move it, and drag its bottom-right corner to resize it. With the keyboard, open the item's actions menu, choose Move or Resize, then use the arrow keys; Enter or Escape ends. Each drop or arrow step is one undo step. A place that another item holds is refused, and the view says so.
In a read-only grid, items cannot move, resize or change.
Slicers
A slicer filters from the one side to the many side, never back.
Insert › Filters › Slicer shows on a dashboard. It opens the Insert Slicers list, where each checked table column becomes a slicer in the next free place, in one undo step.
The slicers of a dashboard filter its pivots together. A slicer on a column of table T filters every pivot whose table is T, or a table that reaches T through many-to-one relationships, as an Excel slicer filters the PivotTables connected to it. The filter goes from the one side to the many side, never back. A slicer whose table a pivot cannot reach does not filter it. Slicer filters are added to each pivot's own report filters when the pivot computes; the saved definitions do not change.
In an editable grid, a slicer selection is a saved, synced change of its item, so it is one undo step. In a read-only grid, a slicer filters only that viewer's view: it makes no document change and no undo step.
A slicer dims each value that no row has under the other slicers, and the value stays selectable, as Excel's "Visually indicate items with no data" does. The slicer's actions menu has Dim Items with No Data, Hide Items with No Data and Show Items with No Data, each a saved change. In the API, set itemsWithNoData on the slicer item to "hide" to hide those values (Excel's "Hide items with no data"), or to "show" to show every value plainly.
The dashboard view applies the slicers, so they filter once a dashboard has been shown.
PivotCharts
Insert › Charts › PivotChart shows on a dashboard. It adds a chart of the chosen type over the focused pivot item, or else the first pivot, and an item that shows the chart in the next free place, in one undo step. Removing the item removes its chart too. On a worksheet, the command charts the pivot that holds the active cell; see Charts over pivots.
The chart is a ChartDefinition with pivot set to the ID of a pivot on the same dashboard, and an empty series list. As in Excel, the row items are the categories and each value field, for each column item, is one series. Subtotals and grand totals are not points. The slicers filter the chart as they filter its pivot, and the chart follows each recalculation. Charts need @sheetwrite/charts: without it, the item says so.
A chart plots every value field of its pivot unless pivotValues lists the ones to plot, by position in the pivot's values. In the Chart panel, the Values section lists the pivot's value fields with measures next to fields, as the Field List picks a PivotChart's values in Excel; each change is one undo step, and at least one value stays plotted. A measure point is the pivot's measure cell for the same items, computed in the filter context of that point, so the chart keeps no values of its own.
KPI cards
Insert › Dashboard › KPI Card shows on a dashboard when the data model has a measure. It opens a list of the measures and adds a card for the chosen one in the next free place.
A KPI card (kind: "kpi") shows its measure's value, large, in the filter context of the dashboard's slicers: each slicer whose table the measure's home table reaches filters it, as it filters a pivot over that table. title replaces the measure name as the caption, and numberFormat is the Excel format code of the value; absent shows it as General. A card needs the full engine, as measures do.
Styles
The dashboard view needs @sheetwrite/core/styles/dashboard.css, PivotCharts need @sheetwrite/core/styles/charts.css, and the KPI card and slicer forms need @sheetwrite/core/styles/panels.css. @sheetwrite/core/styles.css includes every part; see Stylesheet parts.
XLSX
Excel has no dashboard sheet. toXlsxWorkbook(grid), from @sheetwrite/core with the XLSX add-on installed (initSheetwrite({ addons: [xlsxAddon()] }), xlsxAddon from @sheetwrite/xlsx), writes each dashboard as a worksheet with the same name. Each worksheet column stands for one grid column, and each row for one grid row. Each item writes its values from the top-left cell of its box:
a pivot item: its name, then the pivot's current result, with each value field's number format,
a slicer: its caption, then the values it keeps,
a KPI card: its caption, then its value in its number format,
a chart item: a native chart over the box, with its data written into the chart, so Excel shows it without source cells.
The values are the ones that the dashboard shows, with its slicer filters. If an item has more values than its box holds, the export writes all of them and warns. Each export with a dashboard warns once that the dashboard is static in Excel. A snapshot exported without a grid has no computed values, so its dashboards are empty worksheets.
The dashboard itself, with its items, pivots and charts, is saved in the Sheetwrite metadata sheet. Sheetwrite opens the file with the dashboard again; the static values are not read. Excel slicers and timelines in other files are not imported.
Undo and collaboration
setDashboardItem (insert or replace by ID) and removeDashboardItem are document operations. Each change is one undo step, and it is saved and synchronized like other sheet metadata. A slicer selection is a change of its item, so it is saved too, as Excel saves slicer state. Two concurrent changes to the same item conflict, and so do two concurrent items whose boxes overlap. A version-history restore brings the items and pivots of a dashboard back in place.
Store method
Result
getDashboard(sheet)
A copy of the items, or null for a worksheet
setDashboardItem(sheet,item)
Inserts it, or replaces the item with its ID
removeDashboardItem(sheet,id)
Removes it
const grid: Gridconst grid:Gridconst grid:GridAPI referenceGrid.addSheet(input: AddSheetInput): SheetLifecycleResultGrid.addSheet(input: AddSheetInput): SheetLifecycleResultGrid.addSheet(input: AddSheetInput): SheetLifecycleResultAdd a sheet with a stable ID. Returns the transaction's outcome, which the host can act on.API referenceAddSheetInput.name: stringinterfaceAddSheetInput{name:string;}interfaceAddSheetInput{name:string;}Name shown in the legend; it wins over nameRange.API referenceAddSheetInput.kind?: SheetKind | undefinedinterfaceAddSheetInput{kind?:SheetKind|undefined;}interfaceAddSheetInput{kind?:SheetKind|undefined;}"dashboard" adds a dashboard, which ignores rowCount and columns.API referencefunction initSheetwrite(options?: InitSheetwriteOptions): Promise<void>functioninitSheetwrite(options?:InitSheetwriteOptions,):Promise<void>functioninitSheetwrite(options?:InitSheetwriteOptions,):Promise<void>Load one WASM engine and install add-ons before createGrid.See also/docs/start/choose-an-engine/, createGrid·ExampleAPI referenceclass SheetwriteStoreclassSheetwriteStoreclassSheetwriteStoreStable public facade and the sole transaction, epoch, policy, and event barrier.See alsoStore.aggregate, createGrid·ExampleAPI referenceinterface WorkbookSnapshotinterfaceWorkbookSnapshotinterfaceWorkbookSnapshotSchema-versioned serializable workbook document.API referenceWorkbookSnapshot.schemaVersion: 1interfaceWorkbookSnapshot{schemaVersion:1;}interfaceWorkbookSnapshot{schemaVersion:1;}Format version of the snapshot; always 1.API referenceWorkbookSnapshot.workbook: {
activeSheet: SheetId;
namedRanges?: NamedRangeSnapshot[];
xlsxSource?: XlsxSourceSnapshot;
calculation?: CalculationSettings;
dataModel?: DataModel;
queries?: SavedQuery[];
externalLinks?: ExternalLink[];
}interfaceWorkbookSnapshot{workbook:{activeSheet:SheetId;namedRanges?:NamedRangeSnapshot[];xlsxSource?:XlsxSourceSnapshot;calculation?:CalculationSettings;dataModel?:DataModel;queries?:SavedQuery[];externalLinks?:ExternalLink[];};}interfaceWorkbookSnapshot{workbook:{activeSheet:SheetId;namedRanges?:NamedRangeSnapshot[];xlsxSource?:XlsxSourceSnapshot;calculation?:CalculationSettings;dataModel?:DataModel;queries?:SavedQuery[];externalLinks?:ExternalLink[];};}Workbook-wide state: the active sheet, named ranges, and kept XLSX parts.API referenceactiveSheet: stringlet activeSheet:stringlet activeSheet:stringStable ID of the sheet shown when the workbook opens.API referenceWorkbookSnapshot.sheets: SheetSnapshot[]interfaceWorkbookSnapshot{sheets:SheetSnapshot[];}interfaceWorkbookSnapshot{sheets:SheetSnapshot[];}Every sheet of the workbook, worksheets and dashboards alike.API referenceSheetSnapshot.id: stringinterfaceSheetSnapshot{id:string;}interfaceSheetSnapshot{id:string;}Stable identifier, unique within the workbook and used by every cell address.API referenceSheetSnapshot.name: stringinterfaceSheetSnapshot{name:string;}interfaceSheetSnapshot{name:string;}User-facing sheet name shown in tabs and workbook exports.API referenceSheetSnapshot.order: numberinterfaceSheetSnapshot{order:number;}interfaceSheetSnapshot{order:number;}Zero-based position of the sheet's tab.API referenceSheetSnapshot.rowCount: numberinterfaceSheetSnapshot{rowCount:number;}interfaceSheetSnapshot{rowCount:number;}Rows in the sheet, empty rows after the last stored cell included.API referenceSheetSnapshot.columns: Column[]interfaceSheetSnapshot{columns:Column[];}interfaceSheetSnapshot{columns:Column[];}Keys are stable, unique document column identities as well as datasource keys.API referenceColumn.key: stringinterfaceColumn{key:string;}interfaceColumn{key:string;}Non-empty key, unique within the sheet, used to map input and datasource values.API referenceColumn.header: stringinterfaceColumn{header:string;}interfaceColumn{header:string;}Schema label used by table exports and data-grid presentation headers.API referenceColumn.width: numberinterfaceColumn{width:number;}interfaceColumn{width:number;}Unzoomed column width in CSS pixels.API referenceColumn.type: CellFormatinterfaceColumn{type:CellFormat;}interfaceColumn{type:CellFormat;}Controls cell input parsing and default value formatting for this column.API referenceSheetSnapshot.tables?: WorkbookTable[] | undefinedinterfaceSheetSnapshot{tables?:WorkbookTable[]|undefined;}interfaceSheetSnapshot{tables?:WorkbookTable[]|undefined;}Workbook tables anchored on this sheet.API referenceWorkbookTable.id: stringinterfaceWorkbookTable{id:string;}interfaceWorkbookTable{id:string;}Stable ID, unique in the workbook; it stays the same when the table is renamed.API referenceWorkbookTable.name: stringinterfaceWorkbookTable{name:string;}interfaceWorkbookTable{name:string;}Workbook-global, case-insensitively unique structured-reference name.API referenceWorkbookTable.range: RangeinterfaceWorkbookTable{range:Range;}interfaceWorkbookTable{range:Range;}Inclusive table rectangle on one stable sheet ID.API referenceRange.sheet: stringinterfaceRange{sheet:string;}interfaceRange{sheet:string;}Stable ID of the sheet the range is on.API referenceRange.start: {
row: number;
col: number;
}interfaceRange{start:{row:number;col:number;};}interfaceRange{start:{row:number;col:number;};}Zero-based row and column of one corner cell, included in the range.API referencerow: numberlet row:numberlet row:numberRow index, counting from 0 at the sheet's first row.API referencecol: numberlet col:numberlet col:numberColumn index, counting from 0 at the sheet's first column.API referenceRange.end: {
row: number;
col: number;
}interfaceRange{end:{row:number;col:number;};}interfaceRange{end:{row:number;col:number;};}Zero-based row and column of the opposite corner cell, also included.API referenceWorkbookTable.columns: WorkbookTableColumn[]interfaceWorkbookTable{columns:WorkbookTableColumn[];}interfaceWorkbookTable{columns:WorkbookTableColumn[];}Ordered stable columns; length is exactly the table rectangle width.API referenceWorkbookTableColumn.id: stringinterfaceWorkbookTableColumn{id:string;}interfaceWorkbookTableColumn{id:string;}Stable ID, unique within the table; it stays the same when the column is renamed.API referenceWorkbookTableColumn.name: stringinterfaceWorkbookTableColumn{name:string;}interfaceWorkbookTableColumn{name:string;}Case-insensitively unique within the table.API referenceWorkbookTable.headerRow: booleaninterfaceWorkbookTable{headerRow:boolean;}interfaceWorkbookTable{headerRow:boolean;}Whether the first range row is the structured-reference header row.API referenceWorkbookTable.totalsRow: booleaninterfaceWorkbookTable{totalsRow:boolean;}interfaceWorkbookTable{totalsRow:boolean;}Whether the last range row is the structured-reference totals row.API referenceSheetSnapshot.cells: CellBlock[]interfaceSheetSnapshot{cells:CellBlock[];}interfaceSheetSnapshot{cells:CellBlock[];}The sheet's non-empty cells, in rectangular blocks.API referenceSheetSnapshot.kind?: SheetKind | undefinedinterfaceSheetSnapshot{kind?:SheetKind|undefined;}interfaceSheetSnapshot{kind?:SheetKind|undefined;}A dashboard holds items and no cells; absent means a worksheet.API referenceSheetSnapshot.pivots?: PivotDefinition[] | undefinedinterfaceSheetSnapshot{pivots?:PivotDefinition[]|undefined;}interfaceSheetSnapshot{pivots?:PivotDefinition[]|undefined;}Pivot tables anchored on this sheet.API referencePivotDefinition.id: stringinterfacePivotDefinition{id:string;}interfacePivotDefinition{id:string;}Stable identity, unique in the workbook.API referencePivotDefinition.name: stringinterfacePivotDefinition{name:string;}interfacePivotDefinition{name:string;}User-facing caption.API referencePivotDefinition.source: PivotSourceinterfacePivotDefinition{source:PivotSource;}interfacePivotDefinition{source:PivotSource;}Data the pivot summarizes.API referencetable: stringlet table:stringlet table:stringHome table, used to organize the field list.API referencePivotDefinition.anchor: {
row: number;
col: number;
}interfacePivotDefinition{anchor:{row:number;col:number;};}interfacePivotDefinition{anchor:{row:number;col:number;};}Top-left output cell on the owning sheet. Deleting the anchor's row or column keeps the pivot and moves the anchor to the first surviving cell at the deletion position.API referencePivotDefinition.rows: number[]interfacePivotDefinition{rows:number[];}interfacePivotDefinition{rows:number[];}Source field indices that group the output rows, outermost first.API referencePivotDefinition.columns: number[]interfacePivotDefinition{columns:number[];}interfacePivotDefinition{columns:number[];}Source field indices that group the output columns, outermost first.API referencePivotDefinition.values: PivotValueField[]interfacePivotDefinition{values:PivotValueField[];}interfacePivotDefinition{values:PivotValueField[];}Aggregated fields, in output order.API referencefield: numberlet field:numberlet field:numberThe table column whose values the slicer lists.API referenceaggregation: PivotAggregationlet aggregation:PivotAggregationlet aggregation:PivotAggregationAPI referenceconst store: SheetwriteStoreconst store:SheetwriteStoreconst store:SheetwriteStoreAPI referenceSheetwriteStore.fromSnapshot(input: unknown, options?: SheetwriteStoreOptions): SheetwriteStoreSheetwriteStore.fromSnapshot(input: unknown, options?: SheetwriteStoreOptions): SheetwriteStoreSheetwriteStore.fromSnapshot(input: unknown, options?: SheetwriteStoreOptions): SheetwriteStoreCreates a store from a saved snapshot, validating it first; an invalid one throws.API referenceconst snapshot: WorkbookSnapshotconst snapshot:WorkbookSnapshotconst snapshot:WorkbookSnapshotAPI referenceSheetwriteStore.setDashboardItem(sheet: SheetId, item: DashboardItem): ApplyTransactionResultSheetwriteStore.setDashboardItem(sheet: SheetId, item: DashboardItem): ApplyTransactionResultSheetwriteStore.setDashboardItem(sheet: SheetId, item: DashboardItem): ApplyTransactionResultInsert an item on the dashboard sheet, or replace the one with its ID. Items stay inside the 12 columns and do not overlap; otherwise the result is a no-op.API referenceDashboardPivotItem.id: stringinterfaceDashboardPivotItem{id:string;}interfaceDashboardPivotItem{id:string;}Stable ID, unique on the dashboard.API referenceDashboardPivotItem.box: DashboardBoxinterfaceDashboardPivotItem{box:DashboardBox;}interfaceDashboardPivotItem{box:DashboardBox;}Where the item sits on the dashboard grid, and its size.API referenceDashboardBox.x: numberinterfaceDashboardBox{x:number;}interfaceDashboardBox{x:number;}First column, 0-based; x + w is at most 12.API referenceDashboardBox.y: numberinterfaceDashboardBox{y:number;}interfaceDashboardBox{y:number;}First row, 0-based.API referenceDashboardBox.w: numberinterfaceDashboardBox{w:number;}interfaceDashboardBox{w:number;}Width in columns, 1 to 12.API referenceDashboardBox.h: numberinterfaceDashboardBox{h:number;}interfaceDashboardBox{h:number;}Height in rows, 1 to 64.API referenceDashboardPivotItem.kind: "pivot"interfaceDashboardPivotItem{kind:"pivot";}interfaceDashboardPivotItem{kind:"pivot";}Tags the item as a pivot in DashboardItem.API referenceDashboardPivotItem.pivot: stringinterfaceDashboardPivotItem{pivot:string;}interfaceDashboardPivotItem{pivot:string;}PivotDefinition.id of a pivot on the same dashboard sheet.API referenceDashboardSlicerItem.id: stringinterfaceDashboardSlicerItem{id:string;}interfaceDashboardSlicerItem{id:string;}Stable ID, unique on the dashboard.API referenceDashboardSlicerItem.box: DashboardBoxinterfaceDashboardSlicerItem{box:DashboardBox;}interfaceDashboardSlicerItem{box:DashboardBox;}Where the item sits on the dashboard grid, and its size.API referenceDashboardSlicerItem.kind: "slicer"interfaceDashboardSlicerItem{kind:"slicer";}interfaceDashboardSlicerItem{kind:"slicer";}Tags the item as a slicer in DashboardItem.API referenceDashboardSlicerItem.field: TableColumnRefinterfaceDashboardSlicerItem{field:TableColumnRef;}interfaceDashboardSlicerItem{field:TableColumnRef;}The table column whose values the slicer lists.API referenceTableColumnRef.table: stringinterfaceTableColumnRef{table:string;}interfaceTableColumnRef{table:string;}Stable WorkbookTable.id.API referenceTableColumnRef.column: stringinterfaceTableColumnRef{column:string;}interfaceTableColumnRef{column:string;}Stable WorkbookTableColumn.id.API referenceDashboardSlicerItem.selected?: CellScalar[] | undefinedinterfaceDashboardSlicerItem{selected?:CellScalar[]|undefined;}interfaceDashboardSlicerItem{selected?:CellScalar[]|undefined;}Values that pass; absent means every value passes.API referenceSheetwriteStore.dispose(): voidSheetwriteStore.dispose(): voidSheetwriteStore.dispose(): voidFrees the engine memory this store holds; do not use the store afterwards.API reference