Jump to content

Visualize.JS Issue with HighCharts


Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

When I incorporating tablular / crosstab reprort, it is working fine but when I change the report with HighCharts, it gives me error "Uncaught ReferenceError: highchartsOptions is not defined"

Please find my script below.

 

<script type="text/javascript" src="http://127.0.0.1/jasperserver-pro/client/visualize.js"></script>
 
<button id="button" class="hide">Refresh</button>
<button id="export" class="hide">Export</button>
<button id="reload" class="hide">Reload</button>
 
<div id="container">
</div>
 
 
   $(function () {
 
       visualize({
           auth: {
               name: "jasperadmin",
               password: "jasperadmin",
               organization: "organization_1"
           }
       }, function (v) {
           var report = v.report({
               resource: "/public/OccupancyDrillDown",
               container: "#container", 
               error: function (err) {
                   alert("Visualize JS error: " + err.message);
               }
 
 
 
 
           });
 
 
           function buildControl(name, options) {
               function buildOptions(options) {
                   var template = "<option>{value}</option>";
                   return options.reduce(function (memo, option) {
                       return memo + template.replace("{value}", option);
                   }, "")
               }
               console.log(options);
               if (!options.length) {
                   console.log(options);
               }
               var template = "<label>{label}</label><select>{options}</select><br>",
content = template.replace("{label}", name)
.replace("{options}", buildOptions(options));
               $("#container").append($(content));
           }
           $("#export").click(function () {
               //report.run(exportToPdf);
 
               report.export({ outputFormat: "pdf" }).done(function (link) {
                   window.open(link.href); // open new window to download report
               }).fail(function (err) {
                   alert(err.message);
               });
           });
 
           function exportToPdf() {
               report.export({ outputFormat: "pdf" }).done(function (link) {
                   window.open(link.href); // open new window to download report
               }).fail(function (err) {
                   alert(err.message);
               });
           }
 
           $("#button").click(function () {
 
               report.refresh().done(function () { console.log("Report Refreshed!"); }).fail(function () { alert("Report Refresh Failed!"); });
           });
 
           $("#reload").click(function () {
 
               report.refresh().done(function () { console.log("Report Refreshed!"); }).fail(function () { alert("Report Refresh Failed!"); });
           });
 
           $("#reload").show();
           $("#button").show();
           $("#export").show();
 
       });
   });
 
Link to comment
Share on other sites

Looks like for some reason is not Visualize is not able to load the supporting libraries. Can you replicate this on a fiddle? Also I have seen some issues with Visualize and hostname (i.e. localhost vs 127.0.0.1) can you call visualize using our IP address or DNS name instead of the local loopback?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...