Personal tools

User:Hisa/cytoscape test: Difference between revisions

From FANTOM5_SSTAR

Jump to: navigation, search
No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 10: Line 10:
             Cytoscape Web will replace the contents of this div with your graph.
             Cytoscape Web will replace the contents of this div with your graph.
         </div>
         </div>




Line 22: Line 21:
                  
                  
                                 var xml = '\
                                 var xml = '\
                <graphml>\
<graphml><key id="label" for="all" attr.name="label" attr.type="string"/><key id="weight" for="node" attr.name="weight" attr.type="double"/><graph edgedefault="directed"><node id="FF:0000024"><data key="label">CD14-positive monocyte</data></node>\
                  <key id="label" for="all" attr.name="label" attr.type="string"/>\
</html>{{#ask:[[is_a::FF:0000024]][[name::+]]|?name|link=none|format=template|template=Smw_graphml|userparam=FF:0000024;is_a|limit=1000}}<html>\
                  <key id="weight" for="node" attr.name="weight" attr.type="double"/>\
</graph></graphml>\
                  <graph edgedefault="directed">\
                    <node id="1">\
                        <data key="label">A</data>\
                    </node>\
                    <node id="2">\
                        <data key="label">B</data>\
                    </node>\
                    <node id="3">\
                        <data key="label">C</data>\
                    </node>\
                    <edge source="2" target="1">\
                        <data key="label">A to B</data>\
                    </edge>\
                    <edge source="1" target="3">\
                        <data key="label">A to C</data>\
                    </edge>\
                  </graph>\
                </graphml>\
                 ';
                 ';
                  
                  
// function when click
                 // initialization options
                 // initialization options
                 var options = {
                 var options = {
Line 54: Line 40:
                  
                  
                 var vis = new org.cytoscapeweb.Visualization("ont_tree", options);
                 var vis = new org.cytoscapeweb.Visualization("ont_tree", options);
                // callback when Cytoscape Web has finished drawing
                vis.ready(function() {
               
                    // add a listener for when nodes and edges are clicked
                    vis.addListener("click", "nodes", function(event) {
                        handle_click(event);
                    });
                    vis.addListener("dblclick", "nodes", function(event) {
                      handle_dblclick(event);
                    });
                   
                    function handle_click(event) {
                          // window.open("/resource_browser/"+event.target.data.id);
                    }
                    function handle_dblclick(event) {
                            window.open("/resource_browser/"+event.target.data.id);
                    }
                   
//                    function clear() {
//                      document.getElementById("info").innerHTML = "";
//                    }
//               
//                    function print(msg) {
//                        document.getElementById("info").innerHTML += "<p>" + msg + "</p>";
//                    }
                });


// draw
// draw
Line 63: Line 79:
                     panZoomControlVisible: false  
                     panZoomControlVisible: false  
                 };
                 };
//vis.layout({ name: 'Tree', options: { orientation : {'bottomToTop'} }});
 
                 vis.draw(draw_options);
                 vis.draw(draw_options);
             };
             };

Latest revision as of 13:52, 28 June 2012

Cytoscape Web will replace the contents of this div with your graph.