Make legend work in landscape mode

With this change in place, the legend looks fine even when the device is
in landscape mode.

Previously the legend was only usable in portrait orientation.