Jsphylosvg Error
1
0
Entering edit mode
12.4 years ago
Whetting ★ 1.6k

Hi,
I am playing around with the tutorials on jsPhyloSVG I downloaded the code for "3.1 Add Interactive Features"

<html>
<head>
<link type="text/css" rel="stylesheet" href="/js/yui/build/cssfonts/fonts-min.css" /> 
<script type="text/javascript" src="/js/raphael/raphael-min.js" ></script> 
<script type="text/javascript" src="/js/yui/build/yui/yui.js"></script> 
<script type="text/javascript" src="/js/jsphylosvg-min.js"></script> 
<!-- unitip -->
<link rel="stylesheet" type="text/css" href="/js/unitip/css/unitip.css" > 
<script type="text/javascript" src="/js/unitip/js/unitip.js"></script>     
<script type="text/javascript">
window.onload = function(){
    YUI().use('oop', 'json-stringify', 'io-base', 'event', 'event-delegate', function(Y){
        var uri = "/trees/3-coffee.xml";
        function complete(id, o, args) {
            var data = o.responseXML; // Response data.
            var dataObject = {
                        xml: data,
                        fileSource: true
                    };        
            phylocanvas = new Smits.PhyloCanvas(
                dataObject,
                'svgCanvas', 
                800, 800,
                'circular'                
            );
            init(); //unitip
        };
        Y.on('io:complete', complete, Y);
        var request = Y.io(uri);
    });
};
</script>
</head>
<body>
    <div id="svgCanvas"> </div>
</body>
</html>

When I open the html file I get the following error

Please set the format of input data

I do not understand where the error is coming from
As always, any and all help will be appreciated!

phylogeny • 3.1k views
ADD COMMENT
0
Entering edit mode

sorry, why does the html part of the code look all weird?

ADD REPLY
1
Entering edit mode

There's a formatting issue with HTML/XML code at BioStar, unfortunately. I guess the site developers are working on it.

ADD REPLY
0
Entering edit mode

Are you loading this from your computer or are you loading this from a http server? AJAX doesn't work if you are loading it just off your computer's file directory. Read up on browser's same-origin policy. You can try to script inject by converting your data into JSON and load it as a pseudo javascript library.

ADD REPLY
0
Entering edit mode

@DK, I was just loading directly from my local machine. That could be the problem! Thanks! I'll look into that

ADD REPLY
0
Entering edit mode

If that is the issue, you'll need to install a web server on your machine, put the file somewhere in the web root then view it at http://localhost/path/to/myfile.html.

ADD REPLY
0
Entering edit mode

Easiest way to deal with this problem in my experience without much fuss is to just run:

python -m SimpleHTTPServer

That will create a httpserver at the directory that you run the command. Your localhost will now point to that directory.

If you are interested in browser visualizations in javascript. I've written some blog posts on that topic: http://blog.nextgenetics.net/?c=data-visualization

I've just posted an entry on heatmap visualization in javascript today actually.

ADD REPLY
0
Entering edit mode

@DK, that's pretty sweet. I'll check it out!

ADD REPLY
0
Entering edit mode
12.4 years ago
Whetting ★ 1.6k

Turns out that the problem was a lot simpler than that!
I just changed

var uri = "/trees/3-coffee.xml"

to

var uri = "trees/3-coffee.xml"

thanks for all the help!!

ADD COMMENT

Login before adding your answer.

Traffic: 1641 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6