Creating Dashboard at Runtime
Our sample projects and report templates can help you learn the basics of working with our products.A dashboard can be built entirely from code — pages and elements are objects you create and add.
Building the dashboard. Construct the dashboard hierarchy in code, configure the required objects, add them to the template, and render the result.
Building the dashboard. Construct the dashboard hierarchy in code, configure the required objects, add them to the template, and render the result.
var report = Stimulsoft.Report.StiReport.createNewDashboard();
var dashboard = report.pages.getByIndex(0);
var textElement = new Stimulsoft.Dashboard.Components.Text.StiTextElement();
textElement.backColor = Stimulsoft.System.Drawing.Color.lightGray;
dashboard.components.add(textElement);
var viewer = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
viewer.report = report;
viewer.renderHtml();Dashboard elements — text, tables, charts, gauges — live in the Stimulsoft.Dashboard.Components namespace. Creating them in code and adding them to the dashboard page lets you generate dashboards dynamically.