question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Responsive bar chart height and position

See original GitHub issue

Hi, 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>

chart-top

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ariel-upstreamcommented, Nov 11, 2020

I’ve tried to reproduce it and I don’t get this issue https://codesandbox.io/s/nivo-basic-demo-forked-x7ptv

I upgraded the version from 0.62 to 0.63 and it fixed. Thanks!

1reaction
plouccommented, Nov 11, 2020

I’ve tried to reproduce it and I don’t get this issue https://codesandbox.io/s/nivo-basic-demo-forked-x7ptv

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found