-
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
Fixed width for ticks #4340
Comments
@rept unfortunately there is no way to easily synchronize this. It could be done with code that uses the axis callbacks to set the width of the axis to be a certain amount in |
Thx, for the pointer in the right direction. I'll play around with that and see where I get. If I get it working I'll post code here. |
Hi @etimberg, Works with the following code:
Which gives this result. One question I got about this: |
Unfortunately css doesn't work because the text renders on the canvas. It would require changing the draw code to ellipsify text when necessary |
Hi Tim, Can you point me a bit in the right direction as to where the labels are drawn? Line number or anything would help a lot. Thanks. |
Hi Tim, Not needed anymore, I just cut the text from the labels, not ideal but it gets the job done. Do I close this issue? Would be nice if it were possible to add css but probably a nice to have... |
Pretty close in v3.0.0-beta.12. The only thing missing is the ellipsis text truncation which I think should be done manually. https://jsfiddle.net/mfpnv47g/ |
For anyone else looking for this with a more recent version of chart.js scales: {
y: {
afterFit(scale) {
scale.width = 90;
},
},
}, |
hello @rept @lobaak , here is my scenario: a chart with 3 subcharts in y scales, with a common x scale. |
afterFit doesn't work if you have to use resize, resize overrides the width after afterFit. |
I have multiple charts in one screen (horizontalBar). Is there a way to make sure the label on the left are always of the same width (and aligned right) so the different charts align nicely? Ideally if too long they could be overflow with ellipsis (that I can probable handle in callback already).
See example of what I'm trying to achieve.
The text was updated successfully, but these errors were encountered: