fix rounding errors in tooltip and legend