]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fixes HTML legend string for polar area charts to match doughnut charts. (#3361)
authorEvert Timberg <evert.timberg+github@gmail.com>
Sun, 25 Sep 2016 12:30:39 +0000 (08:30 -0400)
committerGitHub <noreply@github.com>
Sun, 25 Sep 2016 12:30:39 +0000 (08:30 -0400)
Fixes HTML legend string for polar area charts to match doughnut charts

src/controllers/controller.polarArea.js
test/defaultConfig.tests.js

index b27daf4170d7f61f9c7f67867a93a9448fc75246..78234ea59d4ccab8cc4445773798e939df71079f 100644 (file)
@@ -32,11 +32,11 @@ module.exports = function(Chart) {
 
                        if (datasets.length) {
                                for (var i = 0; i < datasets[0].data.length; ++i) {
-                                       text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '">');
+                                       text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '"></span>');
                                        if (labels[i]) {
                                                text.push(labels[i]);
                                        }
-                                       text.push('</span></li>');
+                                       text.push('</li>');
                                }
                        }
 
index fb34d33ec2c0960d6b4acbfcabdf729dfc9cd238..84c9655e6c7c3190561f6919552c3669e099a222 100644 (file)
@@ -219,7 +219,7 @@ describe("Default Configs", function() {
                                options: config
                        });
 
-                       var expectedLegend = '<ul class="' + chart.id + '-legend"><li><span style="background-color:red">label1</span></li><li><span style="background-color:green">label2</span></li></ul>';
+                       var expectedLegend = '<ul class="' + chart.id + '-legend"><li><span style="background-color:red"></span>label1</li><li><span style="background-color:green"></span>label2</li></ul>';
                        expect(chart.generateLegend()).toBe(expectedLegend);
                });