So I created a custom field plugin for JIRA. Everything is working fine except that the $value in the volocity template for 'view' screen is not shown on the view ticket screen.
I implemented this override function:
public Map getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem)
and return a value at end of the function, i.e.:
params.put("calculatedValue", calculatedValue);
return params;