]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
fix drawPoints parameter (#6975)
authorDominic Jean <touletan@hotmail.com>
Sat, 18 Jan 2020 13:32:09 +0000 (08:32 -0500)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 18 Jan 2020 13:32:09 +0000 (08:32 -0500)
src/plugins/plugin.legend.js

index 5fe836bc2b036c028339360620567b31744790ca..fd014e61cd4a38e962062684a31ab6464bc38861 100644 (file)
@@ -389,12 +389,17 @@ class Legend extends Element {
                        if (labelOpts && labelOpts.usePointStyle) {
                                // Recalculate x and y for drawPoint() because its expecting
                                // x and y to be center of figure (instead of top left)
-                               var radius = boxWidth * Math.SQRT2 / 2;
+                               const drawOptions = {
+                                       radius: boxWidth * Math.SQRT2 / 2,
+                                       pointStyle: legendItem.pointStyle,
+                                       rotation: legendItem.rotation,
+                                       borderWidth: lineWidth
+                               };
                                var centerX = rtlHelper.xPlus(x, boxWidth / 2);
                                var centerY = y + fontSize / 2;
 
                                // Draw pointStyle as legend symbol
-                               helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY, legendItem.rotation);
+                               helpers.canvas.drawPoint(ctx, drawOptions, centerX, centerY);
                        } else {
                                // Draw box as legend symbol
                                ctx.fillRect(rtlHelper.leftForLtr(x, boxWidth), y, boxWidth, fontSize);