-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[charts] Having the legend on the left crop the axis values #16383
Comments
This was a conscious decision. I opted to have the "default" behaviour be visually pleasant, rather than have a somewhat bad experience for everyone. I believe we could decouple the margin from the axis rendering, eg: the margin should contain solely This way we can have a reasonable single default for every side, and if there is an issue with how the user renders their axis, they can change their data/axisconfig instead of messing with margins. It might create an issue with rendering though, if we need to know the size of the rendered axis before being able to plot the chart 🤔 An option would be to have |
Maybe we need to define what we are talking about because I hunderstood the opposite from #16315 (comment) My issue is that if a legend is added to the left, the left margin is reduced. For me the default behavior would to always reduce the right margin. Like what currently happened in RTL mode |
I think I get your point. My point is that there is a bigger issue in which the axes render inside the margin. Which is the real underlying issue here. The idea would be to simply render the axis in it's own designated area, and only render/calculate that area when the axis is rendered, rather than have a "global margin" |
I agree with the idea. I would be amazing. But I've doubts about the feasibility |
What are your concerns? |
It's also a question of dev exp. The drawing area is a notion of the context and axes are part of the rendering. When writing the initial version, I preferred to have a dumb feature for margin and keep the data flow from context to rendering, than trying to create something that depending on how you render the chart impacts the context. For me the presence of ChartsXaxis should not impact the margin. Otherwise it looks like black magic and we are never sure what is a feature or a bug when user do customization <ChartContainer>
<ChartsXaxis axisId="..." />
</ChartContainer> |
Applying the
DEFAULT_LEGEND_FACING_MARGIN
to the left or bottom results in a too small space to ds)lay axis contentI played a bit with it in codesandbox The red are LtR and the blue are RtL mode.
I agree it would be better if the left margin was not impacted by the legend such that 2 digits number can still be displayed. Might even be worst with axil label
Originally posted by @alexfauquette in #16315 (comment)
The text was updated successfully, but these errors were encountered: