add formatting function for chart legend to prevent NaN from showing, use "--" when no value exists