Merge legends

Extending only HorizontalLegend to cover Legend functionality.

Orignal PR #1415.
We do not have access to `this` inside `each` loop.