Auto Height for Charts (height depending upon content) #1759
Unanswered
is-it-ayush
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hey @is-it-ayush, typically the dynamic height with To accomplish what you want, it seems like you don't actually care about the size of the parent container, but you want each of your bar heights to be equal so they match across charts? In that case I would just compute the height of the <svg height={BAR_HEIGHT * data.length + MARGIN} {...} /> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! Is there a way to set the height of a chart automatically if the amount of data is dynamic? I've tried using
<ParentSize />
but on parent I have to manually specify a fixed height for visx to display anything (which makes sense). Now, Suppose I have 3 charts on the same row & each of them have different amount of data. If I specify a fixed height for all them and their data changes. The chart looks strange (having more data on the same range i.e. the same height will cause the svg to be rendered more tightly packed).For example, Both charts on the same row have height of
300px
. The left has 5 x-points, The right has only 3. The right appears to be more spread out.The Parent Code,
The Chart Code,
Beta Was this translation helpful? Give feedback.
All reactions