ucsd-ccbb / visJS2jupyter

visJS2jupyter is a tool to bring the interactivity of networks created with vis.js into jupyter notebook cells
MIT License
78 stars 17 forks source link

Invalid vis.js options #27

Open Chaoste opened 5 years ago

Chaoste commented 5 years ago

Hey,

I just want to report a warning raised by vis.js sinve this module tends to pass invalid parameters.

vis.js:3664 Invalid type received for "container". Expected: dom. Received [undefined] "undefined"

Problem value found at:
options = {
  configure: {
      container
  }
}
vis.js:3664 Invalid type received for "code". Expected: string. Received [undefined] "undefined"

Problem value found at:
options = {
  nodes: {
    icon: {
      code
    }
  }
}

vis.js:42587 Errors have been found in the supplied options object.

For parameter code the solution was simply passing "undefined" with extra quotes so it becomes a string after parsed by vis.js. For parameter container this simple fix didn't work, even though their code should be able to accept undefined.

I was able to fix it like this:

visJS_module.visjs_network(
    nodes_dict, edges_dict, [...],
    graph_id=title, container=f'mynetwork{title}',
    node_icon_code="'undefined'")

Would be nice to have this fixed ;)

Greetings, Thomas