Make it possible to toggle legend visibility

This change adds an options menu with a "Show legend" checkbox.