Basic Dashboard Embed
Simple initialization of the library, plain text authentication and loading a dashboard
by vysohanych
HTML
<script src="http://127.0.0.1:8080/jasperserver-pro/client/visualize.js"></script>
<!-- JQuery - Latest compiled and minified -->
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<div style="height: 800px;">
</div>
<div id="container">
<div id="dashboard">
<div><p>Loading...</p></div>
</div>
</div>
<div style="height: 400px;">
CSS
/* #container {
width: 1110px;
height: 630px;
}
You can replace the following with your own custom loading indicator
@import "compass/css3";
@keyframes fadeIn {
from { opacity: 0; }
}
p {
position: relative;
top: 50px;
right: 250px;
font: italic bold 1.2em/1 Bodoni, serif;
color: #555;
text-align: center;
animation: fadeIn 1s infinite alternate;
} */
JavaScript
visualize({
auth: {
name: "superuser",
password: "superuser",
}
}, function (v) {
//render report from provided resource
v("#container").dashboard({
resource: "/public/Dashboard_with_all_types",
error: handleError
});
//show error
function handleError(err) {
alert(err.message);
}
});