{"action":"created","issue":{"url":"https://api.github.com/repos/nnnick/Chart.js/issues/2253","repository_url":"https://api.github.com/repos/nnnick/Chart.js","labels_url":"https://api.github.com/repos/nnnick/Chart.js/issues/2253/labels{/name}","comments_url":"https://api.github.com/repos/nnnick/Chart.js/issues/2253/comments","events_url":"https://api.github.com/repos/nnnick/Chart.js/issues/2253/events","html_url":"https://github.com/nnnick/Chart.js/issues/2253","id":148064986,"number":2253,"title":"generateLegend() not generating a legend correctly","user":{"login":"dibsyjr1","id":9978497,"avatar_url":"https://avatars.githubusercontent.com/u/9978497?v=3","gravatar_id":"","url":"https://api.github.com/users/dibsyjr1","html_url":"https://github.com/dibsyjr1","followers_url":"https://api.github.com/users/dibsyjr1/followers","following_url":"https://api.github.com/users/dibsyjr1/following{/other_user}","gists_url":"https://api.github.com/users/dibsyjr1/gists{/gist_id}","starred_url":"https://api.github.com/users/dibsyjr1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dibsyjr1/subscriptions","organizations_url":"https://api.github.com/users/dibsyjr1/orgs","repos_url":"https://api.github.com/users/dibsyjr1/repos","events_url":"https://api.github.com/users/dibsyjr1/events{/privacy}","received_events_url":"https://api.github.com/users/dibsyjr1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-13T13:41:26Z","updated_at":"2016-04-13T13:44:15Z","closed_at":null,"body":"Hi,\r\n\r\nDon't know if this has been fixed or not (I couldn't see it after doing a search) but currently the generateLegend function is producing strange results:\r\n\r\n![capture](https://cloud.githubusercontent.com/assets/9978497/14494835/c51fd47e-0184-11e6-856c-c3defdcea17b.JPG)\r\n\r\nAs you can see the label has the background color applied to it, when really we want it to be applied to a span next to it. I've looked at the chart js code and realised that it's to do with the way the html is created in the legendCallback. The span is around the text as well when surely it should be next to it to create the colour block? Like so:\r\n\r\n![capture jpg2](https://cloud.githubusercontent.com/assets/9978497/14494987/7a81e802-0185-11e6-8c34-5ecc1d02874f.JPG)\r\n\r\nIn order to fix this I changed the legendCallback function on line 105 to:\r\n\r\n```\r\nlegendCallback: function(chart) {\r\n\t\t\t\tvar text = [];\r\n\t\t\t\ttext.push('<ul class=\"' + chart.id + '-legend\">');\r\n\t\t\t\tfor (var i = 0; i < chart.data.datasets.length; i++) {\r\n\t\t\t\t    text.push('<li><span style=\"background-color:' + chart.data.datasets[i].backgroundColor + '\"></span>');\r\n\t\t\t\t\tif (chart.data.datasets[i].label) {\r\n\t\t\t\t\t\ttext.push(chart.data.datasets[i].label);\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttext.push('</li>');\r\n\t\t\t\t}\r\n\t\t\t\ttext.push('</ul>');\r\n\r\n\t\t\t\treturn text.join(\"\");\r\n\t\t\t}\r\n```"},"comment":{"url":"https://api.github.com/repos/nnnick/Chart.js/issues/comments/209446416","html_url":"https://github.com/nnnick/Chart.js/issues/2253#issuecomment-209446416","issue_url":"https://api.github.com/repos/nnnick/Chart.js/issues/2253","id":209446416,"user":{"login":"etimberg","id":6757853,"avatar_url":"https://avatars.githubusercontent.com/u/6757853?v=3","gravatar_id":"","url":"https://api.github.com/users/etimberg","html_url":"https://github.com/etimberg","followers_url":"https://api.github.com/users/etimberg/followers","following_url":"https://api.github.com/users/etimberg/following{/other_user}","gists_url":"https://api.github.com/users/etimberg/gists{/gist_id}","starred_url":"https://api.github.com/users/etimberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etimberg/subscriptions","organizations_url":"https://api.github.com/users/etimberg/orgs","repos_url":"https://api.github.com/users/etimberg/repos","events_url":"https://api.github.com/users/etimberg/events{/privacy}","received_events_url":"https://api.github.com/users/etimberg/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T13:44:15Z","updated_at":"2016-04-13T13:44:15Z","body":"@dibsyjr1 could you PR this?\r\n\r\nAs a work-around you can change the `legendCallback` in your config so that you don't need to modify the library"}}