Automatically determine top or bottom tooltip orientation