简体   繁体   中英

Responsive height for React Recharts

I am using React LineChart. For the same, I need to have dynamic height as the charts might change in heights based on some other criteria. If I am giving the height to LineChart or using ResponsiveContainer , In cases where the Line Chart is not as long as the height applied to it, There is some gap showing between its above DIV and itself, however if the graphs are long enough, the gap does not exists.

Please suggest if I can do anything for this.

You can get the height of the container element dynamically via clientHeight and set it.

https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM