Add pointStyleWidth option for legend#10412
Conversation
src/plugins/plugin.legend.js
Outdated
| labels: { | ||
| color: (ctx) => ctx.chart.options.color, | ||
| boxWidth: 40, | ||
| // boxWidth: default is 40, |
There was a problem hiding this comment.
This would become a breaking change for users
There was a problem hiding this comment.
default value has been transferred to getBoxSize function.
let {boxHeight = fontSize, boxWidth = 40} = labelOpts;
There was a problem hiding this comment.
@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.