Reputation: 276
I am using dynamic data as the data props for recharts bar chart. I set the min height of wrapper component of chart component, but the chart height is just like the min height that I set. So when the length of props data is long, then chart looks ugly though I set the barSize, barGap, and etc.
Upvotes: 0
Views: 2065
Reputation: 276
I have resolved this issue by wrapping ResponsiveContainer
and set the height of the container as variable according to the length of data props.
<ResponsiveContainer height={props.data.length * (props.barSize + props.barGap)}>
{chart component}
</ResponsiveContainer>
Upvotes: 1