Dashboard
HTML
<script src="http://build-master.jaspersoft.com:5980/jrs-pro-trunk/client/visualize.js"></script>
<button id="changeAnimation">Animation</button>
<button id="changeZoom">Zoom</button>
<div id="container"></div>
CSS
#container {
width: 100%;
height: 500px;
}
.dashboardCanvas > .content > .body {
background-color: #000 !important;
}
JavaScript
var _dashboard;
visualize({
auth: {
name: "superuser",
password: "superuser"
}
}, function(v) {
_dashboard = v.dashboard({
container: "#container",
resource: "/public/Samples/Dashboards/1._Supermart_Dashboard",
error: function(e) {
alert(e);
}
});
$("#changeAnimation").click(function() {
var reportProps = _dashboard.report();
reportProps.chart.animation = false;
console.log(reportProps);
_dashboard.report(reportProps).run().fail(handleError);
});
$("#changeZoom").click(function() {
var reportProps = _dashboard.report();
reportProps.chart.zoom = "x";
console.log(reportProps);
_dashboard.report(reportProps).run().fail(handleError);
});
handleError = function(err) {
console.log(err);
if (err !== undefined) {
alert("Error in Visualize: " + err.message);
}
};
});