Dashboard Class
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Api. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
- Inherits
- Document
Object - Dashboard
- Document
Stable dashboard handle. Access fails after deletion or replacement of the owning document.
Syntax
public class Dashboard
Members
Properties
| Property | Description |
|---|---|
| Id | Stable dashboard identity within the document. |
Methods
| Method | Description |
|---|---|
| AddWidgetAsync | Adds a validated widget in one undoable workbook transaction. |
| DrillToAsync | Returns to a zero-based ancestor level (0 is the root), clearing descendant filters without changing worksheets. A deeper or invalid level fails. |
| DrillUpAsync | Returns one level up a widget's configured hierarchy. The root is unchanged. |
| GetSnapshotAsync | Reads detached widget definitions, independent grid placement, mode and filter context. |
| QueryAsync | Calculates a widget with shared filters without creating an editor UI. |
| RemoveWidgetAsync | Removes one widget from this dashboard. |
| RenderAsync | Renders a detached visualization without an editor; dimensions are 120..4096 CSS pixels. |
| ResetFiltersAsync | Restores persisted default filters. |
| SelectMarkAsync | Selects a dimensional mark, applying configured cross-filtering and drill-down in one undoable operation. Value must be null, text, boolean or a finite number. |
| SetFiltersAsync | Replaces analytics-only filter context; worksheet cells and AutoFilter remain untouched. |
| SourceDataAsync | Reads at most 1,000 underlying rows only when the widget explicitly permits source-data access. |
| UpdateAsync | Applies a partial definition, retaining identity. Properties use the shared camelCase JSON contract. |
| UpdateWidgetAsync | Applies partial widget settings without changing identity. |
Examples
Build a small report using this document API and return its PDF bytes. Pass a live control with a fresh workbook; the caller owns its lifetime.
using TXTextControl.TXSheetControl.Server;
async Task<byte[]> CreateDashboardReportAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Range("A1:B5").SetValuesAsync(new object?[][]
{
[], ["North", 42000], ["South", 38500], ["East", 31200], ["West", 44900]
});
await book.Analytics.SetSourceAsync(new AnalyticsSource { Id = "sales", Name = "Regional sales", SheetId = sheet.Id, Range = "A1:B5", HasHeaderRow = true });
var dashboard = await book.Dashboards.AddAsync("Sales overview");
await dashboard.AddWidgetAsync(new DashboardWidget { Id = "revenue", Type = "bar", Title = "Revenue by region", Placement = new DashboardPlacement { X = 0, Y = 0, Width = 6, Height = 4 }, Query = new AnalyticsQuery { SourceId = "sales", Dimensions = ["Region"], Measures = [new AnalyticsMeasure { Field = "Revenue", Aggregation = "SUM", Alias = "Revenue" }] }, DrillDown = ["Region"], Interactions = new DashboardInteractions { Filter = true, AllowSourceData = true } });
return await control.SaveAsync(StreamType.PDF, new SaveOptions { OmitDashboards = true });
}
See Also
Advanced Dashboard Operations
| Method | Description |
|---|---|
| ApplyThemeAsync | Applies Light 1–8, Medium 1–8 or Dark 1–8 by ID, preserving explicit widget overrides. |
| ArrangeWidgetsAsync | Aligns/distributes all widgets or packs one to four columns. Operations: compact, grid, align-left, align-right, distribute-horizontal, distribute-vertical. |
| GetExplorationAsync | Returns Back/Forward availability. Viewer history is limited to 50 actions, invalidated by design/data changes and never persisted. |
| GoBackAsync | Restores the previous viewer exploration context without reverting dashboard design. |
| GoForwardAsync | Reapplies a viewer exploration action after GoBackAsync. |
| SetParameterAsync | Changes a numeric what-if parameter. Inclusive limits and available choices are enforced atomically. |
| SetMetricAsync | Switches a widget to one of its configured metric queries and number formats. |
| HighlightMarkAsync | Highlights matching marks across source charts; null clears highlighting. |
| NavigateToAsync | Opens a configured drill-through dashboard with a mapped equality filter and Back navigation. |
| ToggleBranchAsync | Expands or collapses an ordered equality-filter path while other hierarchy branches stay summarized. |
| GetKpiAsync | Calculates a KPI value, baseline, absolute/percentage change, target and sparkline using the configured analytics context. |
| ToggleSectionAsync | Collapses or expands a viewer section without changing its cards or worksheet values. Null toggles its current state. |
| RenderSvgAsync | Renders the visible dashboard as SVG with all gradients, charts and KPI comparisons. Width is 480..4096 CSS pixels. |