Add a legend to pie charts

This will probably involve refactoring out the graph widget's legend.