This example shows how to create a simple dashboard at runtime.

For example, let's create a dashboard with table. First, you need to add the StiBlazorViewer component to the view page.
@using Stimulsoft.Report.Blazor;

...

<StiBlazorViewer Report="@Report" />

...

Next, create a new dashboard object - use the CreateNewDashboard() method for this. After that, read and register data:
...

// Create dashboard Object
this.Report = StiReport.CreateNewDashboard();
var dashboard = this.Report.Pages[0] as StiDashboard;

// Read data
var dataPath = Path.Combine("Data/Demo.xml");
var data = new DataSet();
data.ReadXml(dataPath);

// Register data
this.Report.RegData(data);
this.Report.Dictionary.Synchronize();

...

Next, create a new StiTableElement() object, specify its position, size and fill it with data:
...

// Create table
var tableElement = new StiTableElement();
tableElement.Left = 0;
tableElement.Top = 0;
tableElement.Width = 700;
tableElement.Height = 500;
tableElement.Name = "Example";

// Fill table
var dataBase = new StiDimensionColumn();
dataBase.Expression = "Products.ProductID";
tableElement.Columns.Add(dataBase);

var dataBase1 = new StiDimensionColumn();
dataBase1.Expression = "Products.ProductName";
tableElement.Columns.Add(dataBase1);

var dataBase2 = new StiDimensionColumn();
dataBase2.Expression = "Products.UnitPrice";
tableElement.Columns.Add(dataBase2);

...

Then, apply filters:
...

// Apply filters
var filter1 = new StiDataFilterRule();
filter1.Condition = StiDataFilterCondition.BeginningWith;
filter1.Path = "Products.ProductID";
filter1.Value = "1";
tableElement.DataFilters.Add(filter1);

var filter2 = new StiDataFilterRule();
filter2.Condition = StiDataFilterCondition.EndingWith;
filter2.Path = "Products.UnitPrice";
filter2.Value = "1";
tableElement.DataFilters.Add(filter2);
		
...

Finally, add table to the dashboard:
...

// Add table to dashboard
dashboard.Components.Add(tableElement);

...

In the screenshot below you can see the result of the sample code:

Creating Dashboard at Runtime

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.