]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Do not use line defaults in legend (#7649)
authorEvert Timberg <evert.timberg+github@gmail.com>
Sun, 19 Jul 2020 16:52:59 +0000 (12:52 -0400)
committerGitHub <noreply@github.com>
Sun, 19 Jul 2020 16:52:59 +0000 (12:52 -0400)
src/plugins/plugin.legend.js

index 2a507755669b908a942b017b09ff65780c0e92f6..ad32e47c718c6aeea64e75b3109d24761ed9e683 100644 (file)
@@ -292,7 +292,6 @@ export class Legend extends Element {
                const opts = me.options;
                const labelOpts = opts.labels;
                const defaultColor = defaults.color;
-               const lineDefault = defaults.elements.line;
                const legendHeight = me.height;
                const columnHeights = me.columnHeights;
                const legendWidth = me.width;
@@ -332,17 +331,17 @@ export class Legend extends Element {
                        // Set the ctx for the box
                        ctx.save();
 
-                       const lineWidth = valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth);
+                       const lineWidth = valueOrDefault(legendItem.lineWidth, 1);
                        ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor);
-                       ctx.lineCap = valueOrDefault(legendItem.lineCap, lineDefault.borderCapStyle);
-                       ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, lineDefault.borderDashOffset);
-                       ctx.lineJoin = valueOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle);
+                       ctx.lineCap = valueOrDefault(legendItem.lineCap, 'butt');
+                       ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, 0);
+                       ctx.lineJoin = valueOrDefault(legendItem.lineJoin, 'miter');
                        ctx.lineWidth = lineWidth;
                        ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);
 
                        if (ctx.setLineDash) {
                                // IE 9 and 10 do not support line dash
-                               ctx.setLineDash(valueOrDefault(legendItem.lineDash, lineDefault.borderDash));
+                               ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));
                        }
 
                        if (labelOpts && labelOpts.usePointStyle) {