Cloud
Облачный сервис для быстрого и эффективного анализа и визуализации данных для вашего бизнеса без необходимости создания своих приложений и программирования.
StiMvcViewer component to the view and set the necessary options:
@using Stimulsoft.Report.Mvc;
...
@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
Actions =
{
GetReport = "GetReport",
ViewerEvent = "ViewerEvent"
}
})
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. All of these steps can be done in the GetReport action, which should return the dashboard object to the viewer:
public ActionResult GetReport()
{
// Create new dashboard
var report = StiReport.CreateNewDashboard();
// Load dashboard template
report.Load(Server.MapPath("~/Dashboards/Dashboard.mrt"));
// Load a JSON file
var jsonBytes = System.IO.File.ReadAllBytes(Server.MapPath("~/Dashboards/Demo.json"));
// Get DataSet from JSON file
var json = StiJsonConnector.Get();
var dataSet = json.GetDataSet(new StiJsonOptions(jsonBytes));
// Remove all connections from the dashboard template
report.Dictionary.Databases.Clear();
// Register DataSet object
report.RegData("Demo", "Demo", dataSet);
// Return template to the Viewer
return StiMvcViewer.GetReportResult(report);
}
public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult();
}