-
Notifications
You must be signed in to change notification settings - Fork 474
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
Can we set a fixed width/height? #166
Comments
Hi @hailwood! No, it's currently not possible. |
Is it possible now? |
For anyone wondering, i actually managed to get pretty close to perfect circles thanks to scriptable padding borderRadius: 100,
textAlign: "center",
verticalAlign: "middle",
// POC of making any value a circle
// without scriptable width/height
padding: function(context) {
const dataset = context.dataset;
const value = dataset.data[context.dataIndex];
// doesn't really work for singe digits, using known-good preset
if (value < 10) return {top: 6, bottom: 5, left: 10, right: 10};
const padding = (Math.log(value) * Math.LOG10E + 1 | 0) * 4
return {
top: padding,
bottom: padding - 2, // slightly less on the bottom, otherwise seems off-center
left: 8,
right: 8,
}
}, Doesn't fit piechart all that well on scale cause space is limited, but for other cases should be just fine |
whats the timeline for addition of this feature. |
@ansariadil Depends how quickly you contribute it 😃 |
My client wishes to have a circle drawn behind the labels.
I know the labels are between 1-3 numbers, so I'd like to be able to say draw all the datalabels in a 40x40px circle.
I know how to set the backgrounds etc, just not how to make them a fixed width.
The text was updated successfully, but these errors were encountered: