Hello,
I have incurred in an annoying issue when trying to style graph nodes and links using the className property.
Specifically, whenever in the dataset there is a node or link whose object contains multiple classes, such as:
var data = {
"nodes":[
{"id":"n1", "className":"classLC classLA"},
{"id":"n2", "className":"classLC classLA classLB"},
],
"links":[
{"id":"l1", "from":"n1", "to":"n2"},
]
};
If in the NetChart's nodeClasses or linkClasses array any of those classNames are missing, for example:
var t = new NetChart({
container: document.getElementById("demo"),
area: { height: 350 },
style:{
nodeClasses:[
{className:"classLC", style:{fillColor:"red"}}
]
},
data: { preloaded: data }
});
I get the following message: Unable to apply item style: class MISSINGCLASSNAME
undefined`. On top of that, in our case there is also a delay in the rendering of the node items icons that are applied using the existing className (in this case, classLC). This makes the NetChart practically unusable for us because of the combination of error message and rendering delay.
I understand that this might not strictly be a bug, but given that the node or link className values come from the dataset, I believe it is reasonable to assume that not all of those classNames are going to be used in the styling process through the style object. In our case, the className values coming from the dataset are dynamically generated based on a specific property of the corresponding entity represented by the node. This means that we cannot just add them all in the style object within the nodeClasses array. We might use one or more to style the nodes, but not necessarily all of them, as we do not even know in advance what they are.
It would be great to hear what your thoughts are on this. Would it be difficult to add a check in the source code to prevent the error message and consequent rendering delay when there is not a corresponding className in the style object compared to the one in the data source?
Let me know, thank you very much. 