mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
fix drawPoints parameter (#6975)
This commit is contained in:
parent
fac507819f
commit
95345d01dc
@ -389,12 +389,17 @@ class Legend extends Element {
|
|||||||
if (labelOpts && labelOpts.usePointStyle) {
|
if (labelOpts && labelOpts.usePointStyle) {
|
||||||
// Recalculate x and y for drawPoint() because its expecting
|
// Recalculate x and y for drawPoint() because its expecting
|
||||||
// x and y to be center of figure (instead of top left)
|
// 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 centerX = rtlHelper.xPlus(x, boxWidth / 2);
|
||||||
var centerY = y + fontSize / 2;
|
var centerY = y + fontSize / 2;
|
||||||
|
|
||||||
// Draw pointStyle as legend symbol
|
// Draw pointStyle as legend symbol
|
||||||
helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY, legendItem.rotation);
|
helpers.canvas.drawPoint(ctx, drawOptions, centerX, centerY);
|
||||||
} else {
|
} else {
|
||||||
// Draw box as legend symbol
|
// Draw box as legend symbol
|
||||||
ctx.fillRect(rtlHelper.leftForLtr(x, boxWidth), y, boxWidth, fontSize);
|
ctx.fillRect(rtlHelper.leftForLtr(x, boxWidth), y, boxWidth, fontSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user