TX Sheet Control

Dashboard Class

Class
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server from the private NuGet feed or the supplied NuGet folder
Assembly
TXTextControl.TXSheetControl.Api.dll
Install
dotnet add package TXTextControl.TXSheetControl.Server .NET 10 and later.
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll
Inherits
  1. DocumentObject
  2. Dashboard

Stable dashboard handle. Access fails after deletion or replacement of the owning document.

Syntax

public class Dashboard

Members

Properties

PropertyDescription
IdStable dashboard identity within the document.

Methods

MethodDescription
AddWidgetAsyncAdds a validated widget in one undoable workbook transaction.
DrillToAsyncReturns to a zero-based ancestor level (0 is the root), clearing descendant filters without changing worksheets. A deeper or invalid level fails.
DrillUpAsyncReturns one level up a widget's configured hierarchy. The root is unchanged.
GetSnapshotAsyncReads detached widget definitions, independent grid placement, mode and filter context.
QueryAsyncCalculates a widget with shared filters without creating an editor UI.
RemoveWidgetAsyncRemoves one widget from this dashboard.
RenderAsyncRenders a detached visualization without an editor; dimensions are 120..4096 CSS pixels.
ResetFiltersAsyncRestores persisted default filters.
SelectMarkAsyncSelects a dimensional mark, applying configured cross-filtering and drill-down in one undoable operation. Value must be null, text, boolean or a finite number.
SetFiltersAsyncReplaces analytics-only filter context; worksheet cells and AutoFilter remain untouched.
SourceDataAsyncReads at most 1,000 underlying rows only when the widget explicitly permits source-data access.
UpdateAsyncApplies a partial definition, retaining identity. Properties use the shared camelCase JSON contract.
UpdateWidgetAsyncApplies 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?[][]
    {
        ["Region", "Revenue"], ["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

MethodDescription
ApplyThemeAsyncApplies Light 1–8, Medium 1–8 or Dark 1–8 by ID, preserving explicit widget overrides.
ArrangeWidgetsAsyncAligns/distributes all widgets or packs one to four columns. Operations: compact, grid, align-left, align-right, distribute-horizontal, distribute-vertical.
GetExplorationAsyncReturns Back/Forward availability. Viewer history is limited to 50 actions, invalidated by design/data changes and never persisted.
GoBackAsyncRestores the previous viewer exploration context without reverting dashboard design.
GoForwardAsyncReapplies a viewer exploration action after GoBackAsync.
SetParameterAsyncChanges a numeric what-if parameter. Inclusive limits and available choices are enforced atomically.
SetMetricAsyncSwitches a widget to one of its configured metric queries and number formats.
HighlightMarkAsyncHighlights matching marks across source charts; null clears highlighting.
NavigateToAsyncOpens a configured drill-through dashboard with a mapped equality filter and Back navigation.
ToggleBranchAsyncExpands or collapses an ordered equality-filter path while other hierarchy branches stay summarized.
GetKpiAsyncCalculates a KPI value, baseline, absolute/percentage change, target and sparkline using the configured analytics context.
ToggleSectionAsyncCollapses or expands a viewer section without changing its cards or worksheet values. Null toggles its current state.
RenderSvgAsyncRenders the visible dashboard as SVG with all gradients, charts and KPI comparisons. Width is 480..4096 CSS pixels.