How to populate edges and nodes from server-side code?

19 views
Skip to first unread message

Marcelo Carvalho

unread,
Oct 27, 2013, 8:46:59 AM10/27/13
to cytoscape...@googlegroups.com
Hi there,

Im using cytoscape for the first time and was trying to load a simple connection network from database info. I just grabbed demo html code to see if the js was ready to use and then (as the visualization was performed with no problems) I customize the "data: {" portion from function.
Are there any documentation referring to server-side tool usage?

Seems like the problem regards execution time, as network_json variable needs to be ready for call at page load not allowing server side the time to retrieve these values...

  var network_json = {
                        // you need to specify a data schema for custom attributes!
                        dataSchema: {
                    nodes: [ { name: "label", type: "string" },
                            { name: "id", type: "string" }
                    ],
edges: [ { name: "label", type: "string" },
        { name: "bar", type: "string" }
]
                    },
                    // NOTE the custom attributes on nodes and edges
<%
                        objRS.Open strQ, objCon
If Not objRS.eof then
Response.Write "data: {"
Do while not objRS.eof
                         Response.Write "   nodes: [ { id: "&objRS("id")&", label:..........."
                %>
  
                       
                // initialization options
                var options = {
                    swfPath: "swf/CytoscapeWeb",
                    flashInstallerPath: "swf/playerProductInstall"
                };

Max Franz

unread,
Nov 6, 2013, 12:29:48 PM11/6/13
to cytoscape...@googlegroups.com
You need to init cy.js after your data is loaded via an AJAX call (or similar).  Otherwise, you're just passing empty data.  This pattern holds true regardless of the serverside tech you use -M 
Reply all
Reply to author
Forward
0 new messages