This example shows how to register data in the dashboard from code.

For example, we will load and register a JSON data file. To display a ready-made dashboard, we need a viewer. Add the StiBlazorViewer component to the page.
@using Stimulsoft.Report.Blazor;

...

<StiBlazorViewer Report="@Report" />

...

To register data in the dashboard, it is enough to call the special RegData() method, and specify the name of the data source, its alias, and pass the prepared DataSet object as parameters. To load a JSON file into a DataSet object, you can use a special StiJsonConnector class, which contains the necessary set of methods for conversion.
...

// Create empty dashboard object
this.Report = StiReport.CreateNewDashboard();

// Load dashboard template
this.Report.Load("Dashboards/Dashboard.mrt");

var jsonBytes = System.IO.File.ReadAllBytes("Dashboards/Demo.json");

var json = StiJsonConnector.Get();
var dataSet = json.GetDataSet(new StiJsonOptions(jsonBytes));

this.Report.Dictionary.Databases.Clear();
this.Report.RegData("Demo", "Demo", dataSet);

...

Auf dem Screenshot unten Sie können das Ergebnis des Beispiel-Codes ansehen:

Registering a Data for the Dashboard

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.