javascript - cytoscape.js & meteor simple example doesnt work -


  1. i added meteor cytoscape : infinitedg:cytoscape
  2. i have basic meteor app:

hello.js http://pastebin.com/2frshc9g hello.html http://pastebin.com/10eyyj74

but not able make work

here error can see in console of web browser:

on rendered zavolana hello.js:9 ss [object object] debug.js:41 exception tracker afterflush function: debug.js:41 typeerror: cannot read property 'addeventlistener' of undefined @ canvasrenderer.registerbinding (infinitedg_cytoscape.js:17127) @ canvasrenderer.load (infinitedg_cytoscape.js:17283) @ new canvasrenderer (infinitedg_cytoscape.js:13419) @ $$.fn.core.initrenderer (infinitedg_cytoscape.js:7527) @ new $$.core (infinitedg_cytoscape.js:6592) @ function.$$.init (infinitedg_cytoscape.js:75) @ cytoscape (infinitedg_cytoscape.js:58) @ htmldivelement. (infinitedg_cytoscape.js:2808) @ function.jquery.extend.each (jquery.js:384) @ jquery.fn.jquery.each (jquery.js:136)

do have please "hello world" of combination of cytoscape , meteor ?

problem wrong library installed via meteor

after installed correct cytoscape library, working

correct cytoscape:cytoscape

here minimal , working example:

js

sit = "" //hlavni objekt  if (meteor.isclient) {         template.graf.rendered = function() {          // meteor.defer(function() {         //settimeout(function(){          console.log("on rendered called");         //var divcy = $('#cy');         // console.log("ss " + divcy);         sit = cytoscape({             container: document.getelementbyid('cy'),               ready: function() {                 console.log("network ready");                 updatenetworkdata(sit); // load data when cy ready             },              style: cytoscape.stylesheet()                 .selector('node')                 .style({                     'content': function(e) {                         return e.data("name")                     },                      'font-size': 12,                     'text-valign': 'center',                     'color': 'white',                     'text-outline-width': 2,                     'text-outline-color': function(e) {                         return e.locked() ? "red" : "#888"                     },                     'min-zoomed-font-size': 8                         // 'width': 'mapdata(score, 0, 1, 20, 50)',                         // 'height': 'mapdata(score, 0, 1, 20, 50)'                 })                 .selector('edge')                 .style({                     'content': function(e) {                         return e.data("name") ? e.data("name") : "";                     },                     'target-arrow-shape': 'triangle',                 })           });          //})     }     }  if (meteor.isserver) {     meteor.startup(function() {         // code run on server @ startup     }); }    function updatenetworkdata(net) {      // init data      var nodes = [{ // node             group: 'nodes',             data: {                 id: 'a',                 name:'a'             }         }, { // node b             group: 'nodes',             data: {                 id: 'b',               name:'b'             }         }      ]     var edges = [{ // edge ab             group: 'edges',             data: {                 id: 'ab',               name:'ab',                 source: 'a',                 target: 'b'             }         }      ]      net.elements().remove(); // make sure evything clean      net.add(nodes);     net.add(edges);      net.reset() // render layout } 

css

#cy {   width : 70vw;   height: 50vw;   position: absolute; } 

html

<head>   <title>hello</title> </head>  <body>   <h1>welcome meteor!b</h1>   {{>graf}} </body>  <template name="graf">   <div id="cy"></div> </template> 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -