Responsive bar chart height and position
See original GitHub issueHi, I’m using the responsiveBar component and I did wrap it with a div with specific width and height, My issue is that the chart adjacent to the top of the div container and doesn’t stretch to all of the container.
I tried to change the position with styles on the div parent (flex and justify-content) but it doesn’t help.
chartContainer: {
height: "4rem",
width: "5rem",
margin: "0 auto",
padding: "0.5rem 0",
textAlign: "center",
}
<div className={classes.chartContainer}>
<ResponsiveBar
data={data}
keys={keys}
indexBy={getIndex}
colors={colors}
margin={{ top: 0, right: 0, bottom: 20, left: 0 }}
enableLabel={false}
enableGridX={false}
enableGridY={true}
gridYValues={0.5}
isInteractive={false}
padding={0.1}
labelFormat=".0s"
minValue={0}
axisBottom={{
tickValues: [`f1`, `f2`],
}}
axisTop={null}
axisRight={null}
axisLeft={null}
animate={true}
/>
</div>
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Responsive Charts - Chart.js
Chart.js provides a few options to enable responsiveness and control the resize behavior of charts by detecting when the canvas display size ......
Read more >Set height and width for responsive chart using recharts ...
I am trying to use recharts to implement a BarChart. But the width={600} and height={300} causes the Barchart to be absolute, not responsive...
Read more >Create a responsive Bar Chart with d3.js - Marc Wiedermann
Append an svg object for the bar chart with specified width and height to the body or a div in your webpage; Use...
Read more >How to Keep the Chart Size Consistent While Changing ...
The chart js responsive settings hinders your width and height. ... With chart js you can make line chart, bar chart, pie chart, ......
Read more >Responsive charts with d3.js - The D3 Graph Gallery
Like every other element of a webpage, charts deserve to be responsive: their size must adapt to the device size. This post describes...
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
I upgraded the version from 0.62 to 0.63 and it fixed. Thanks!
I’ve tried to reproduce it and I don’t get this issue https://codesandbox.io/s/nivo-basic-demo-forked-x7ptv