Skip to content

How to make a LinePath with a fill that starts at a specific number or domain min? #1641

Answered by williaster
MarkLyck asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @MarkLyck thanks for checking out visx. For gradients, I don't think that fill for LinePaths is reliable as it likely depends heavily on the shape of the line as you are observing.

To get the behavior you want I think you probably should use a LinePath without a fill for the line, and then use an AreaClosed component to implement the fill – d3 calculates this exact shape but draws it explicitly as a closed shape using whatever baseline you want (76 in your case, 0 in this example) which makes its behavior more deterministic

https://airbnb.io/visx/areas

Hope that helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MarkLyck
Comment options

Answer selected by MarkLyck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants