fix drawPoints parameter (#6975)

This commit is contained in:
Dominic Jean 2020-01-18 08:32:09 -05:00 committed by Evert Timberg
parent fac507819f
commit 95345d01dc

View 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);