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 (Neo4j documentation - Neo4j Documentation) 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