]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix zero border width not working (issue #3241)
authorPikamander2 <Pikamander2@gmail.com>
Thu, 1 Sep 2016 06:18:42 +0000 (02:18 -0400)
committerPikamander2 <Pikamander2@gmail.com>
Thu, 1 Sep 2016 06:18:42 +0000 (02:18 -0400)
src/core/core.legend.js

index a13151bd332dc35a01dfa0ab7d52e6a327bc6f92..8d1fb4b7e188ba14299a295f712d5230c16a08b0 100644 (file)
@@ -324,6 +324,7 @@ module.exports = function(Chart) {
                                        ctx.lineJoin = itemOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle);
                                        ctx.lineWidth = itemOrDefault(legendItem.lineWidth, lineDefault.borderWidth);
                                        ctx.strokeStyle = itemOrDefault(legendItem.strokeStyle, globalDefault.defaultColor);
+                                       var isLineWidthZero = (itemOrDefault(legendItem.lineWidth, lineDefault.borderWidth) == 0);
 
                                        if (ctx.setLineDash) {
                                                // IE 9 and 10 do not support line dash
@@ -343,7 +344,10 @@ module.exports = function(Chart) {
                                        }
                                        else {
                                                // Draw box as legend symbol
-                                               ctx.strokeRect(x, y, boxWidth, fontSize);
+                                               if (!isLineWidthZero)
+                                               {
+                                                               ctx.strokeRect(x, y, boxWidth, fontSize);
+                                               }
                                                ctx.fillRect(x, y, boxWidth, fontSize);
                                        }