Creating Dashboard at Runtime
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.A dashboard can be built entirely in code — data, a table element, dimension columns and filters — then shown in the viewer with no designed template.
Create the dashboard and register data.
How it works. Building the element tree in code is equivalent to designing it visually, so the dashboard renders identically to a template-based one.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

Create the dashboard and register data.
this.Report = StiReport.CreateNewDashboard();
var dashboard = this.Report.Pages[0] as StiDashboard;
var data = new DataSet();
data.ReadXml("Data/Demo.xml");
this.Report.RegData(data);
this.Report.Dictionary.Synchronize();Add a table element with columns and filters.var table = new StiTableElement { Left = 0, Top = 0, Width = 700, Height = 500, Name = "Example" };
table.Columns.Add(new StiDimensionColumn { Expression = "Products.ProductName" });
table.Columns.Add(new StiDimensionColumn { Expression = "Products.UnitPrice" });
table.DataFilters.Add(new StiDataFilterRule {
Condition = StiDataFilterCondition.BeginningWith, Path = "Products.ProductID", Value = "1" });
dashboard.Components.Add(table);report.Pages[0] as StiDashboard— the dashboard surface to add elements to.StiTableElementwithStiDimensionColumn— a table and the fields it displays;StiDataFilterRulefilters its data.
How it works. Building the element tree in code is equivalent to designing it visually, so the dashboard renders identically to a template-based one.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
