Visualize: Render Adhoc View

Test plugins

by vysohanych

HTML

<script type='text/javascript' src="http://127.0.0.1:8080/jasperserver-pro/client/visualize.js"></script>

<label class="btn btn-default">
  <input id="chartAnimation" type="checkbox" checked>Animations
</label>
<div id="container"></div>

CSS

#container {
  height: 800px;
}

JavaScript

visualize({
  auth: {
    name: "superuser",
    password: "superuser"
  }
}, function(v) {
  var dashboard = v.dashboard({
    resource: "/public/Samples/Dashboards/1._Supermart_Dashboard",
    container: "#container",
    success: function() {
      console.log("rendered");
    },
    error: function(e) {
      alert(e);
    }
  });

 $("#chartAnimation").on("change", function() {
    var reportProps =dashboard.report();
    var val = this.checked;
    reportProps.chart.animation = !val;
    dashboard.report(reportProps).run().fail(function(e) {
      alert(e);
    });
  });

});