YOUSEFUL / DELPHI / COMPONENTS
TAtlasDashboardWidget
One card of a TAtlasDashboard: its definition and the table it currently shows.
Description
Returned by TAtlasDashboard.AddWidget and TAtlasDashboard.Widgets. The dashboard creates, owns and frees widgets; never create or free one yourself.
Data is replaced on every refresh, so read it when you need it rather than keeping a reference.
Members
| Member | Kind | What it does |
|---|---|---|
Destroy | destructor | Frees the card and the current data. |
Definition | property | A copy of the definition the widget was created from. |
Data | property | The table the card shows, owned by the widget, or nil when the dashboard has no source. |
Destructors
Destroy destructor
destructor Destroy; override;Frees the card and the current data. Called by the dashboard in ClearWidgets, LoadJSON and its own destructor; do not call it yourself.
Properties
Definition property
property Definition: TAtlasWidgetDefinition read FDefinition;A copy of the definition the widget was created from.
Data property
property Data: TAtlasTable read FData;The table the card shows, owned by the widget, or nil when the dashboard has no source. For awKPI it has one row and one column named after the title; for awChart one row per dimension value, with the dimension in column 0 and the measure in column 1; for awGrid every column of the filtered rows. Values are in invariant format. Do not free or change it.
if Assigned(Widget.Data) then
Writeln(Widget.Data.Cell(0, 0));Examples
List the KPI values
Reads each KPI card's single value as stored, for example 12216.6666666667 for an average.
uses System.Classes, Atlas.Data, Atlas.Dashboard;
procedure ListKpis(Dashboard: TAtlasDashboard; Lines: TStrings);
var
I: Integer;
Widget: TAtlasDashboardWidget;
begin
for I := 0 to Dashboard.WidgetCount - 1 do
begin
Widget := Dashboard.Widgets[I];
if (Widget.Definition.Kind = awKPI) and Assigned(Widget.Data) then
Lines.Add(Widget.Definition.Title + ': ' + Widget.Data.Cell(0, 0));
end;
end;
Related
TAtlasDashboard · TAtlasWidgetDefinition