Skip to content

Commit

Permalink
Fixed positioning of legend box
Browse files Browse the repository at this point in the history
Fixed the position of the legend box, when using custom point sizes.
  • Loading branch information
Alfie Hopkin authored Jan 23, 2019
1 parent 1c2857f commit 2989223
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/plugins/plugin.legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,8 @@ var Legend = Element.extend({
// 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;
var offSet = radius / Math.SQRT2;
var centerX = x + offSet;
var centerY = y + offSet;
var centerX = x + (fontSize / 2);
var centerY = y + (fontSize / 2);

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

0 comments on commit 2989223

Please sign in to comment.