Skip to content

Commit 2989223

Browse files
author
Alfie Hopkin
authored
Fixed positioning of legend box
Fixed the position of the legend box, when using custom point sizes.
1 parent 1c2857f commit 2989223

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/plugins/plugin.legend.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,8 @@ var Legend = Element.extend({
370370
// Recalculate x and y for drawPoint() because its expecting
371371
// x and y to be center of figure (instead of top left)
372372
var radius = boxWidth * Math.SQRT2 / 2;
373-
var offSet = radius / Math.SQRT2;
374-
var centerX = x + offSet;
375-
var centerY = y + offSet;
373+
var centerX = x + (fontSize / 2);
374+
var centerY = y + (fontSize / 2);
376375

377376
// Draw pointStyle as legend symbol
378377
helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY);

0 commit comments

Comments
 (0)