You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
Within a LineChart, define YAxis with a specified domain and allowDataOverflow <YAxis data={...} domain={[0, 100]} allowDataOverflow />
Provide data points to the chart so lines will be created directly on the lower/upper bound of the y-axis
See that lines on the lower and upper bound of the YAxis domain are clipped and appear thinner due to the <clipPath> clipping away part of the lines stroke width which is outside the cartesian grid
Set allowDataOverflow={false}
See that lines on the lower/upper bound are not clipped anymore and don't appear thinner in stroke width
Set allowDataOverflow back to true
YAxis 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.
Environment
Info
Recharts
v2.12.6
React
17.0.1
System
MacOS
Browser
Chrome Version 123.0.6312.87
The text was updated successfully, but these errors were encountered:
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 allowDataOverflow actually does and how things are affected based on other settings. I don't really have any great answers or quick fixes at the moment though
@ckifer Yeah, I agree this is expected behavior since we don't want any lines past the edges of the chart when using allowDataOverflow.
I think this was mainly a "want to have" because I'm mostly using line charts with allowDataOverflow on the YAxis (due to variance of some data) and customers mention the lines "looking thinner / halved" on the edges of the chart. No worries on fixes or actions at the moment, just wanted to start the conversation around this in case others were wanting something similar.
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
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"
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: