-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feature request: margins automatically adjust to tick values #140
Comments
closing ticket since this is pretty specific. I used a third party library to precompute svg width to resize margins called 'svg-text-size' and no longer need this implemented |
Can this be reopened? I think allowing margins to be responsive to the width of the legend is not niche and very useful. |
Bump! |
Yes, this would be very useful! |
While this might be feasible, I'm not planning to implement this, this would be extremely complex to implement with the current approach as axes are typically computed once we already have scales, which depends on those margins. Also I'm not sure it's ideal to have the size of a chart vary depending on the length of its ticks labels, although I can understand that it could be practical in certain situations. Implementing such feature would certainly lead to other problems, like what happens if the labels take all the space and the chart is not visible anymore? We would probably need to introduce new constraints. So IMO the complexity this could introduce, and the potential issues it could lead to, outweigh the benefits. This can maybe be implemented naively in user land by computing the maximum length of the labels and define some kind of fixed width per character, and define margins according to this, but this wouldn't be a robust solution, a proper solution would need to consider the actual computed size of the labels (for both SVG and canvas based implementations). |
Understood. Thanks for the detailed response! |
I have tick values which I do not know the max text size. Long tick values strings cut off if the margin is too small as shown in https://www.webpackbin.com/bins/-KylBOM-OLUpXZ8zOhY-.
It would be nice if we could have it automatically adjust margins so we don't have to eyeball.
The text was updated successfully, but these errors were encountered: