Unable to render a report using visualize.js in JSFIDDLE

0

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 : https://www.youtube.com/watch?v=xGbcQb1N-gU&feature=youtu.be

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

sadakar's picture
546
Joined: Aug 14 2012 - 3:57am
Last seen: 1 month 1 day ago

Note that my server is running on 8081 and 5433

sadakar - 3 years 2 months ago

are you seeing any errors in the server logs?

mgeise - 3 years 2 months ago

sadakar - 3 years 2 months ago
show 1 more...

Yep, I would like to see more info, like errors in console

nesterone - 3 years 2 months ago

7 Answers:

0

Try using 127.0.0.1 instead of localhost

mgeise's picture
1435
Joined: Mar 5 2007 - 6:18am
Last seen: 1 week 3 days ago

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 .

sadakar - 3 years 2 months ago

We are using special cross-domain transfer for Viz, so it's better to work with viz.html not as with local file but as html serving from a webserver

nesterone - 3 years 2 months ago
0

Hi,  

I see missing double quote (line 9)

should be like

v("#container").report()    instead of      v(#container").report() 
 

I hope it helps

 

Thanks,

Igor N

 

 

 

nesterone's picture
Joined: May 4 2011 - 5:04am
Last seen: 2 years 9 months ago

If you see in the image code.. it's not mistaken.

sadakar - 3 years 2 months ago

every thing enclosed properly.. (as not in image or shared code).. Done exactly as there in tutorial video.

sadakar - 3 years 2 months ago

I would think that either the v(#container") would either be a syntax error, or it would be looking for a label, #container" , that wouldn't match the <div> id. But the v(#container") is definitely wrong.

djohnson53 - 3 years 2 months ago
show 1 more...

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
-----------
<script type='text/javascipt' src="http://127.0.0.1:8081/jasperserver-pro/client/visualize.js?logLevel=debu...

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

sadakar - 3 years 2 months ago
0

Did any one get it working ?

 

sadakar's picture
546
Joined: Aug 14 2012 - 3:57am
Last seen: 1 month 1 day ago
1

Hi, sadakar

I have made it works and it seems like your sample has mistype in HTML markup like:

<script "scr" > instead of <script "src">

Just try my sample but with your URL to vizualize 

http://jsfiddle.net/NesterOne/2Km35/3/

 

nesterone's picture
Joined: May 4 2011 - 5:04am
Last seen: 2 years 9 months ago
0

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


sadakar's picture
546
Joined: Aug 14 2012 - 3:57am
Last seen: 1 month 1 day ago
0

It has worked in Chrome but not in Mozilla.. What would be probable reason for this ???

sadakar's picture
546
Joined: Aug 14 2012 - 3:57am
Last seen: 1 month 1 day ago
0

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.

sadakar's picture
546
Joined: Aug 14 2012 - 3:57am
Last seen: 1 month 1 day ago

IS '/VSoftBI/Reports/DigitalDashboard/BranchStatus' uri to report or to Dashboard ?

nesterone - 3 years 2 months ago

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

sadakar - 3 years 2 months ago

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.

mheck - 3 years 1 month ago
Feedback