Jump to content
We've recently updated our Privacy Statement, available here ×

Unable to render a report using visualize.js in JSFIDDLE


sadakar

Recommended Posts

In JSFiddle writting below code to test but unable to produce the ouptu.

Installed jasper server pro 5.6 in Cent OS 6.5 and the server is UP with jasperadmin/jasperadmin (in another case with superuser/superuser).

I'm following this tutorial :

HTML:

<!-- Provide URL to Visualize.js -->
<script type="text/javascript" scr="http://localhost:8081/jasperserver-pro/client/visualize.js">
</script>
<!-- Provide container to render your visualization -->
<div id="container"></div>

JAVA SCRIPT

visualize({
    auth: {
        name:"jasperadmin",
        password:"jasperadmin",
        organization:"organization_1"
        }
    },
    function(v){
        //render report from provided resource
            v(#container").report({
                  resource:"/public/Samples/Reports/01._Geographic_Results_by_Segment_Report",
                  error: handleError
              });
    //show error
    function handleError(err){    
        alert(err.message);
     }
    });

 

 

Could you please tell me where I am going wrong with this new conept ?

 

Thanks in Advance.

Sadakar

BI developer

Link to comment
Share on other sites

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

jsfiddle is down now(Jun 12 1:12 P.M IST) .. will test with an hmtl file..

 

 

I have written the same code in HTML file and opened it.. but nothing came.. When opened it has taken file:///home/a1551/Desktop/visualize.html as URL address and on the webpage all the visualize code is coming up..

 

So, how can I call html page after writing the visulize code in html file ?

 

Thank you in Advance .

 

 

Link to comment
Share on other sites

Hi Japser, Still I am struck with it.

 

Need your help on authenticating.

 

Now, just trying to authenticate from your tutorial http://jsfiddle.net/marianol/CK3WW/ in jsfiddle.net and nothing I'm seeing output box when I run the code.

 

My Jasper installed in Cent OS 6.5 in external folder(/home/a1551/jasperreports-server-5.6 i.e, not under opt folder) which is working fine with 8081/5433 port numbers in all the browsers.

I had already 5.5 pro under opt which is shut down in my machine.

 

 

I have tried below from the video tutorial

 

HTML

-----------

 

( I have also tried giving my ip address in a test and in another test as localhost in place of 127.0.0.1 but all the 3 tests didn't give me any result in JSFiddle).

 

 

JavaScript

------------------

visualize({

auth: {

name: "jasperadmin",

password: "jasperadmin",

organization:"organization_1",

//timezone: "Europe/Helsinki"

}

}, function (v) {

//'v' it's a client to JRS instance initialized above

// with a session established for joeuser from organization_1

alert("Welcome! JRS Authentication successful.");

 

}, function (err) {

alert("Auth error! Server said: " + err.message);

});

 

 

Any inputs will be appreciated

 

Thank you.

 

 

 

 

Link to comment
Share on other sites

First of all thank you for the support..

 

I have opened your link and changed port number from 8080 to 8081 where my jasper is running .. While opening the link I've observed there it is showing "Reference Error: visualize is not defined"...

So is it the problem of Mozilla browser ? Version is : 29.0.1..  Find the same in the image..

 

Thank you in Advance


Screenshot-2.thumb.png.81e2492d0d41f535129a7e1c2693418b.png

Link to comment
Share on other sites

How we can do the same in plain html page ?

Tried below

Created a folder "test" and inside it "visualize.html" page and the code for html page is

<!-- Provide URL to Visualize.js -->
<script type="text/javascript" src="http://localhost:8081/jasperserver-pro/client/visualize.js">
visualize({
    auth: {
        name: "superuser",
        password: "superuser"
       // organization: "organization_1"
    }
}, function (v) {
    //render report from provided resource
    v("#container").report({
        /*
        resource:"/VSoftBI/Reports/DigitalDashboard/BranchStatus",
        params:{"Date":["01/03/2014"],"instId":[312]},
        */
          resource: "/public/Samples/Reports/01._Geographic_Results_by_Segment_Report",
        error: handleError
    });
    //show error
    function handleError(err) {
        alert(err.message);
    }
});
</script>
<!-- Provide container to render your visualization -->
<div id="container" style="width:100%;height:500px;background-color:#CCCCCC">Loading</div>

after that placed it in webapps folder of tomcat

for eg : /home/sadakar/jasperreports-server-5.6/apache-tomcat/webapps/test (under test the html is kept)

calling the file in URL as http://localhost:8081/test/visualize.html which has not rendered the report (but the styles for the div tag applied).

 

What is the correct way of writting visualize code in plain html page ?

 

Dear jasper , need your assistance on this ..

 

Thank you.

Link to comment
Share on other sites

It has worked.... I just needed to use the IP address instead of localhost when I call the URL in 3rd party application..

 

That was the location of report only.. (Dashboard reports -my folder structure was like that)..

 

Of course, I have also tried to call a dashboard but visualize.js not for dashobards it seems rather than reports.

What do you say ???

Link to comment
Share on other sites

  • 4 weeks later...

Hi Sadakar,

Glad you found your rendering problem, and please pardon this late reply. You are correct, in JRS 5.6, Visualize can only render reports, not dashboards. Visualize will continue to improve and expand, of course.

 

In the meantime, you can of course instantiate multiple reports within one web page, by rendering reports into different containers.

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...