Is it possible to create a unique binding that listen different model properties?

Hello
I am having an scenario where I have a panel which the property strokeWidth depens of three different model properties like this…

is it possible to join this in a unique binding? or this is the only way to do it?

Yes, you can use an empty-string binding:

new go.Binding("strokeWidth", "", function(nodeData) {
  if (nodeData.someDataProperty === 5) return "red";
  return "blue";
})

Such a binding will evaluate on every single node data change, so it is not as efficient, but it is an easy way to look at the whole node or link data object and use multiple properties to determine the binding.

but in terms of performance is better to keep it as it is in the image I attached then?

I mean every time you edit the node.data for a node, for instance with

model.set(someNode.data, "someProperty", "someNewValue")

No matter what the property is, every empty-string binding will re-run in case it is relevant.

So for performance, it depends on how often you edit your node.data and how many empty-string bindings you have. It’s probably not a concern if you only have one. You just don’t want to use them for everything.

ok I understand, so the last question here would be, if some of those bindings or in the case of the image two of them are using .ofModel() method the other is listening a node property, I can only join those two and the other I would have to keep it apart? or using the .ofModel() can also listen the node data change? because I inderstand this ofMOdel() is to listen properties in the model.modelData.

yes, you’d have to keep those two separate if you also need information on the model to evaluate the binding.

appreciate your help! thanks