spotfiresoftware / spotfire-mods

Spotfire® Mods
https://spotfiresoftware.github.io/spotfire-mods/
Other
56 stars 41 forks source link

Best way to check if axis has been configured #62

Closed hski-github closed 2 years ago

hski-github commented 2 years ago

What is the best and secure way to check if an axis was defined by the user of the mod e.g. Axis.expression is not null? https://tibcosoftware.github.io/spotfire-mods/api-docs/interfaces/axis.html#expression

objerke commented 2 years ago

I would say that the best to see if an axis is empty is to check if the parts array is empty, e.g. axis.parts.length == 0.

The best way to see if an axis has an expression set is to check that the parts array has a length greater than 0.

hski-github commented 2 years ago

Works nice. Thank you! Maybe worth to add to the FAQ.