Params on neovis.js

Hello,
I wonder if it is possible in NeoVis to include $param in the initial cypher query something like this:

MATCH (p) WHERE id(p)=toInteger($idParam1) RETURN (n), {
idParam1: id1
}
To fetch the variable id of my web app.
Thank you

Hello arturo,
NeoVis does NOT accept params, or better the Javascript driver (neo4j-web.js) doesn't. The params are usable only in the Neo4j-Browser. But you can emulate params by simply using a node label, like (n:param), giving it your value:
merge (n:param{value:25}) with n.value as idParam1 MATCH (p) WHERE id(p)=toInteger(idParam1) RETURN p
Use merge to be able to reuse the node, you could even preset all your possible params and call them by adequate matches.
BTW, I use NeoVis with my own Javascript code to display also images in the direct neighbourhood of my ontology of 12000-nodes
bye

1 Like

Thank you, Irler! This is very helpful.
What you mentioned about on own Javascript sounds very good, but my Javascript skills are not so advance to do it.
Nevertheless I want to take advantages of this opportunity to ask you how I can affect the "pop-up" displayed with neovis. It would be nice to change the format, add an images o maybe hide some data too.

Thank you in advance

Arturo,
you should:

  1. include events.js from some example, look for CompletionEvent = 'completed';
  2. viz = new NeoVis(config0);
  3. viz.registerOnEvent('completed', render_completed);
  4. in function render_completed(param), call function format(param)
  5. in format(param): ... viz._data.nodes.getDataSet().forEach(item => {
    let node=format_node({node:item});...
  6. in format_node(param) you can change param.node properties as you like (if(node.shape==="image"... etc)
  7. you should examine visjs parameters, since now it's only visjs
    BTW, I use frequent console.log(..) to control, and then the browser console
    hope that helps, good luck
    WJI