Skip to content

Commit 1c2857f

Browse files
author
Alfie Hopkin
authored
Allow custom pointStyle size
Allow for users to add in an extra parameter to the label options which changes the size of the legend box separate to the font size. This doesn't affect current functionality, but adds to it.
1 parent 8b110fd commit 1c2857f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/plugins/plugin.legend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ defaults._set('global', {
9191
*/
9292
function getBoxWidth(labelOpts, fontSize) {
9393
return labelOpts.usePointStyle ?
94-
fontSize * Math.SQRT2 :
94+
(labelOpts.circleSize || fontSize * Math.SQRT2) :
9595
labelOpts.boxWidth;
9696
}
9797

@@ -369,7 +369,7 @@ var Legend = Element.extend({
369369
if (opts.labels && opts.labels.usePointStyle) {
370370
// Recalculate x and y for drawPoint() because its expecting
371371
// x and y to be center of figure (instead of top left)
372-
var radius = fontSize * Math.SQRT2 / 2;
372+
var radius = boxWidth * Math.SQRT2 / 2;
373373
var offSet = radius / Math.SQRT2;
374374
var centerX = x + offSet;
375375
var centerY = y + offSet;

0 commit comments

Comments
 (0)