I get an error when trying to use such logic in a chart, but in the test drive it works without problems.
Groovy libs are a feature of the FormulaEngine, so from that perspective they should work all over the place.
What could help then is to verify:
Your target date – make sure your lib is valid at that date.
Your calculation target date – make sure the target date on the chart is not before the validity starts.
Found an issue in documentation? Write to us.