-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pointStyleWidth option for legend #10412
Conversation
src/plugins/plugin.legend.js
Outdated
@@ -622,7 +622,7 @@ export default { | |||
|
|||
labels: { | |||
color: (ctx) => ctx.chart.options.color, | |||
boxWidth: 40, | |||
// boxWidth: default is 40, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would become a breaking change for users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default value has been transferred to getBoxSize function.
let {boxHeight = fontSize, boxWidth = 40} = labelOpts;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@touletan that is a breaking change, because that default is no longer configurable.
What if we use a new option? |
Just revert the move of default value? But the drawPoint is a public function, so change in its signature is also a breaking change. |
I think the signature change in this case is OK since the code handles it being unset. I suppose Typescript users would see a difference if we've provided a type for this helper |
I added a new function 'drawPointLegend', so drawPoint signature is not impacted |
is there a way to ignore the codeclimate issues? The complexity of the new function is the same as it was with drawPoint. |
We can ignore it when we merge. It's not a blocker |
@kurkle @etimberg Can you please help me with this option? I want to see 'circle' in the legend by default but I'm getting 'ellipse'. Is it a bug or expected behavior? I'm using the next config const config = {
type: "line",
data: data,
options: {
plugins: {
legend: {
labels: {
usePointStyle: true
}
}
}
}
} And here a link to codesadbox for your quick review of current behavior |
This pull request should be able to fix this bug: |
When I'm using 'usePointStyle' for legend option, I want to be able to control the width of the pointStyle for Line and Rect options. For now the width is restricted to font size.