Showing a Dashboard in the Viewer
Our sample projects and report templates can help you learn the basics of working with our products.This example shows how to show a dashboard in the Stimulsoft Viewer using PHP. First, include the necessary libraries:
Create a Viewer object and set JavaScript options:
Process requests using the process() method:
Create a report object and load a dashboard template from a file using loadFile():
Assign the report to the viewer:
Finally, render the visual HTML part of the Viewer with printHtml():
In the screenshot below you can see the result of the sample code:

<?php
require_once '../vendor/autoload.php';
use Stimulsoft\Report\StiReport;
use Stimulsoft\Viewer\StiViewer;
?>
Create a Viewer object and set JavaScript options:
$viewer = new StiViewer();
$viewer->javascript->relativePath = '../';
$viewer->javascript->appendHead()('<link rel="shortcut icon" href="/../favicon.ico" type="image/x-icon">');
Process requests using the process() method:
$viewer->process();
Create a report object and load a dashboard template from a file using loadFile():
$report = new StiReport();
$report->loadFile()('../reports/Christmas.mrt');
Assign the report to the viewer:
$viewer->report = $report;
Finally, render the visual HTML part of the Viewer with printHtml():
$viewer->printHtml();In the screenshot below you can see the result of the sample code:
