ResponsiveContainer not resizing
See original GitHub issueHey guys,
I’m currently building an app for a NGO and i’m using Recharts. So far it looks great however when I try to go into responsive mode the charts won’t resize.
Code I’m using:
Where it is rendered:
` <div className="row">
<div className=" col-md-6 col-sm-12 col-xs-12">
<Chart />
</div>
</div>
`
And the component itself: ` <div style={{height:‘300px’, width: ‘600px’}}>
<ResponsiveContainer width="100%">
<BarChart data={data}
margin={{ top: 5, right: 30, left: 20, bottom: 5 }}>
<XAxis dataKey="estadoCivil" />
<YAxis />
<CartesianGrid strokeDasharray="3 3" />
<Tooltip />
<Legend />
<Bar dataKey="cantidad" fill="#8884d8" />
</BarChart>
</ResponsiveContainer>
</div>`
I’m using React 16.0 and Recharts 1.0.0
I’ve tried a few solutions I found online but none is working so far. My lastest attempt was wrapping the component inside a div with fixed height and width just as a test, but still not working.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
ResponsiveContainer does not respond to resizing from large ...
Screen rotation on mobile devices does not resize chart from bigger to smaller height. My solution is to use height equals 94% on ......
Read more >Recharts Responsive Container does not resize correctly in ...
It seems rather hacky but a viable fix is to set width to 99% with a height or aspect ratio. <ResponsiveContainer width="99%" aspect={3}>....
Read more >Recharts Responsive Container does not resize correctly in ...
So far I have found no downsides to this, but YRMV. It seems rather hacky but a viable fix is to set width...
Read more >Recharts Responsive Container does not resize correctly in ...
I'm trying to create a custom collapsable legend for my data visualization app. It uses react and recharts. the component renders nicely the...
Read more >ResponsiveContainer | Recharts
The minimum height of the container. debounceNumber. If specified a positive number, debounced function will be used to handle the resize event. DEFAULT ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ericdcobb Yes, it turned out to be CSS from redux-form that was causing this issue. I removed the CSS (and redux-form altogeather) and it works fine now. So most likely contributor is some rogue CSS somewhere.
@knro did you happen to figure this out?