TX Sheet Control

AnalyticsData Constructor

Constructor
Namespace
TXTextControl.TXSheetControl.Server
Package
TXTextControl.TXSheetControl.Server as TXTextControl.TXSheetControl.Api.dll from the private NuGet feed or the supplied NuGet folder
Also in
TXTextControl.TXSheetControl.Blazor as TXTextControl.TXSheetControl.Api.dll

Syntax

public AnalyticsData()

Return Value

AnalyticsData.

Examples

Create a working report from bounded HTTP sales data. Supply an application-owned HttpClient and service URL; scope cached data to its actual audience.

using TXTextControl.TXSheetControl.Server;

async Task<AnalyticsResult> BuildAnalyticsDataConstructorAsync(ServerSheetControl control)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    await book.Analytics.SetSourceAsync(new AnalyticsSource { Id = "sales", Name = "Regional sales", ConnectionId = "sales-service", QueryId = "regional-sales" });

    var snapshot = new AnalyticsData { Columns = ["Region", "Revenue"], Rows = [["North", 42000], ["South", 38500]] };
    await book.Analytics.SetDataAsync("sales", snapshot);
    return await book.Analytics.QueryAsync(new AnalyticsQuery { SourceId = "sales", Dimensions = ["Region"], Measures = [new AnalyticsMeasure { Field = "Revenue", Aggregation = "SUM", Alias = "Revenue" }] });
}

Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

See Also