Add legend panel.
Handle non-image legends, and allow legends to be collapsed.
Merge pull request #343 from NICTA/legend

Legend improvements