Adding legend to chart

Fixes #189.