Closed hantongyou closed 10 months ago
You can use advanved config to put a function in the color that the color would be a function that's get the attribute value and the output would be a color probably from a color Maybe somthing like this https://stackoverflow.com/questions/10848990/rgb-values-to-0-to-1-scale
however my code did not work like I expected. Here is my code:
{
[NeoVis.NEOVIS_ADVANCED_CONFIG]:{
static:{
// group:labels[i],
},
function:{
title:(node)=>{
// console.log(Object.keys(node.properties));
return NeoVis.objectToTitleHtml(node, Object.keys(node.properties))},
label:(node)=>{
if(node.properties.indexName.length>=10)
return (node,node.properties.indexName.substr(0,10)+"...")
else
return (node,node.properties.indexName+"...")
},
color:(node)=>{
return (node,(0,0,255*node.properties.Contribution))
}
}
}
}
It seems like nothing has changed.
The color function should return a string https://visjs.github.io/vis-network/docs/network/nodes.html
Thanks! Now i use opacity instead of color the problem has been fixed perfectly.
For example, I want to use neovis to draw a influence graph of each node. And there is an attribute "influence" which is between 0 and 1, now how to use this attribute to adjust the node color shape? When influence is smaller the color would be lighter.