Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to access novias node relationships data in the labels function?#345

Answeredbyra-haik
ra-haik asked this question inQ&A
Discussion options

labels:{ID:{label:"name",identifier:"ID",[NeoVis.NEOVIS_ADVANCED_CONFIG]:{static:{color:"#97c2fc",shape:"dot",size:5,},function:{size:(node)=>{return// how to access node.reletioships so that I can count the properties.visits.length like below?}},},},},relationships:{TRAFFIC:{[NeoVis.NEOVIS_ADVANCED_CONFIG]:{static:{width:1,},function:{width:(node)=>{returnnode.properties.visits.length;}},},},},
You must be logged in to vote

Thank you very much for your help, here is the code that is working.

constviz=newNeoVis(config);viz.render();viz.registerOnEvent('completed',()=>{console.log("Graph visualization completed.");viz.nodes.forEach((node)=>{letnewSize=0;if(node.group=='ActiveDirectoryDomain'){viz.nodes.update({id:node.id,size:10});}elseif(node.group=='User'){viz.nodes.update({id:node.id,size:5});}else{viz.edges.forEach((edge)=>{

Replies: 1 comment 29 replies

Comment options

You should do it in the cypher as neo4j doesn't return a way to get to the relationships in the object

I didn't touch cypher in a long time so need to search how I did it back than

You must be logged in to vote
29 replies
@thebestnom
Comment options

Umm... Not really, but after the complete event you can to use it directly and if you get stuck you can continue ask here 😅 the tests kinda use it to get data, andneovis.nodes.update{id: id, newdata} should be pretty much the api to update it

@ra-haik
Comment options

complete event

"complete event"

Umm... Not really, but after the complete event you can to use it directly and if you get stuck you can continue ask here 😅 the tests kinda use it to get data, andneovis.nodes.update{id: id, newdata} should be pretty much the api to update it

For some reason it is not working for me, theviz.node does not contain anything when the event is raised

constviz=newNeoVis(config);viz.render();viz.registerOnEvent('completed',()=>{console.log("Graph visualization completed.");// Update node size based on relationship dataconsole.log(viz.edges);console.log(viz.nodes);for(letnodeIdinviz.nodes){// noting here}});
@thebestnom
Comment options

Thats... Really weird, it makes no sense (I think maybe you can't iterate over it but it is not empty?)
https://visjs.github.io/vis-data/data/dataset.html maybe tryvis.nodes.forEach?

@ra-haik
Comment options

Thank you very much for your help, here is the code that is working.

constviz=newNeoVis(config);viz.render();viz.registerOnEvent('completed',()=>{console.log("Graph visualization completed.");viz.nodes.forEach((node)=>{letnewSize=0;if(node.group=='ActiveDirectoryDomain'){viz.nodes.update({id:node.id,size:10});}elseif(node.group=='User'){viz.nodes.update({id:node.id,size:5});}else{viz.edges.forEach((edge)=>{if(edge.from===node.id||edge.to===node.id){newSize+=JSON.parse(edge.raw.properties.visits??'[]').length;}});viz.nodes.update({id:node.id,size:newSize});}});});
Answer selected byra-haik
@thebestnom
Comment options

That's really weird you need to parse the array, but other than that Im glad managed, also you can use vis.edges.get({to: node.id}) to get all edges instead of iterating over all of it 😅

@ra-haik
Comment options

That's really weird you need to parse the array, but other than that Im glad managed, also you can use vis.edges.get({to: node.id}) to get all edges instead of iterating over all of it 😅

Is it possible to use array type in neo4j, I don't see it on the list?

image

@thebestnom
Comment options

Not sure what app are you using, but in the cypher you can do things like

MATCH (a)SETa.a= [1,2,3,4]

And it should work

@ra-haik
Comment options

Not sure what app are you using, but in the cypher you can do things like

MATCH (a)SETa.a= [1,2,3,4]

And it should work

Thanks, was able to fix it, the issue was with the data loading tool.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@ra-haik@thebestnom

[8]ページ先頭

©2009-2025 Movatter.jp