Graph legend

I wrote this to address these issues: #43277, #43257, #42625, #43273, #42172, #42025, #42038, #41921, #38788, #38960, #43288 

It doesn't fix the colour problem but it does label the graph (and make the code cleaner), so you can answer the question even without colours, which is how it should be. It would be nice to change the colour of the labels though, but I can't work out how.