Factor out some common code in hover box

between plain arrow and flowmap versions