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
Lines directly on the lower or upper bound of a Y-axis with custom domain and allowDataOverflow gets partially clipped out of view #4458
Comments
I guess to me this is expected? There is a clip path and that clip path is at the edge of the chart - if there is a line exactly at that edge it will clip half of the line. We will have a conundrum if some people want things clipped and some do not. This might be a start of a larger conversation around what |
@ckifer Yeah, I agree this is expected behavior since we don't want any lines past the edges of the chart when using I think this was mainly a "want to have" because I'm mostly using line charts with |
Cool, thanks for the context. It might be reasonable to say "if there is an line that will be clipped horizontally in half, expand the domain slightly but cut off everything after that" but if you had a larger strokeWidth (say 10 or something), one might not want the graph domain expanded by 5 units to accommodate the entire item. Especially if the domain starts at something like 0. Or if you had another shape/line that expanded further down under the domain minimum |
No problem, thank you for taking a look.
Exactly this. Lines on the edges should be fully visible (no longer clipped in half) from the slightly expanded domain and lines that actually cross the edges due to data points going out the top or bottom of the graph should still be clipped/hidden because they will potentially be "behind" the lines strokeWidth directly on the edges and then cut off everything after that. Ya, that's a good point about larger strokeWidths. Definitely agree there should be a limit or rules where this domain expanding doesn't always happen if the strokeWidth is greater than some value. |
Reproduction link
Steps to reproduce
<clipPath>
clipping away part of the lines stroke width which is outside the cartesian gridYAxis with custom domain and allowDataOverflow={true}
YAxis with custom domain and allowDataOverflow={false}
What is expected?
Lines that are directly on the lower or upper bound of a custom domain should have the normal stroke-width as the other lines and not appear halved or "thinner" in stroke width. Essentially, it would be nice if lines on the lower/upper bound could look the same visually when allowDataOverflow is true or false.
What is actually happening?
The
<clipPath>
that gets added from allowDataOverflow on the YAxis clips away everything outside of the cartesian coordinate area as expected, but this cuts lines almost in half when the line is directly on the lower or upper bound. Visually its not super noticeable but when you turn allowDataOverflow={false} you will see how the other half of the line appears again for lines directly on the lower/upper bound.I tinkered around locally in Line.tsx with the demo LineChart but couldn't really find a good way to keep the lines on the lower/upper bound fully visible since it would require changing the position of the clipPath that clips outside the cartesian grid from allowDataOverflow on the YAxis. Altering the position of the to give the lines on the lower/upper bound extra breathing room so the full stroke width is visible works but it allows lines with data points that do overflow the domains upper bound to overflow the cartesian grid by a few pixels which doesn't seem like an option.
I also thought about approaching it in segments where if a sequence of contiguous points are all on the lower or upper bound, do something specifically for these line segments to prevent the
<clipPath>
on the cartesian grid from hiding the full line width.The text was updated successfully, but these errors were encountered: