Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-13-2020 01:51 PM
Hello,
This relates to building a read-only graph visualizer for the common or garden web browser. I've been trying to figure out how to set the multiselect option in the config (or is it options) to true. I see JSON describing the contents of a 'visjs' map, where such a flag can be found, but nowhere is any information provided as to how to get that passed into NeoVis via its default() method / constructor (or other initializer). I see that visjs exists in the library (specifically http_rawgit.com_neo4j-contrib_neovis.js_master_dist_neovis.js), but see no way to override it. So, I step back a bit and look for the M in RTFM. No, not there either. I checked this by going to the documentation (https://neo4j.com/docs/) and doing a simple search for renderWithCypher. No results found. What?? Additionally, I see that this multiselect flag appears to be two different types depending on what sparse and disorganized documentation can be found, either a boolean or a string ("alwaysOn"). In other (good) news, I was finally able to cobble together how to attach event handlers to the graph, I share that here for anyone who is going through the same pain I am with documentation for such...
var viz = new NeoVis.default(config);
viz.registerOnEvent("completed", (e) => {
// attach handlers when rendering is finished
viz["_network"].on("click", (e1) => {
// Triggered if any part of canvas is clicked on
});
viz["_network"].on("selectNode", (e1) => {
if (e1.nodes.length === 1) {
var node = e1.nodes[0];
viz.renderWithCypher("match p = (a2)-[*0..4]-(b2) where id(a2) = " + node + " return p limit 200");
} else {
// Will implement this once figured out multiselect
}
});
});
viz.render();
Thanks,
Matthew
04-14-2020 03:30 AM
Hi Matthew,
Thanks for the feedback, I agree that we are missing the M right now. NeoVis is an open source wrapper for vis.js that's been built by a member of a small/stretched team to make others lives easier. Documentation and improvements for this is something that is on my list personally but I haven't found time yet.
Perhaps you could help us out by writing a blog post on how you achieved or even submit a PR to the repository. I'm sure that would help out other frustrated members of the community that find themselves in your situation?
All the sessions of the conference are now available online