]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fixed the generateLegend function
authordibsyjr1 <dibsy-jr@hotmail.co.uk>
Wed, 13 Apr 2016 15:03:08 +0000 (16:03 +0100)
committerdibsyjr1 <dibsy-jr@hotmail.co.uk>
Wed, 13 Apr 2016 15:03:08 +0000 (16:03 +0100)
Fixed the generateLegend function to create the colour block next to the text instead of around it.

src/core/core.js

index 174e43b11506706c42e447daa920648c4e9a73a0..5bbdc5db6f233c94291520d995ed93bee7b2f776 100755 (executable)
@@ -86,11 +86,11 @@ module.exports = function() {
                                var text = [];
                                text.push('<ul class="' + chart.id + '-legend">');
                                for (var i = 0; i < chart.data.datasets.length; i++) {
-                                       text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '">');
+                                       text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '"></span>');
                                        if (chart.data.datasets[i].label) {
                                                text.push(chart.data.datasets[i].label);
                                        }
-                                       text.push('</span></li>');
+                                       text.push('</li>');
                                }
                                text.push('</ul>');
 
@@ -101,4 +101,4 @@ module.exports = function() {
 
        return Chart;
 
-};
\ No newline at end of file
+};