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.

ResponsiveBar in production build - Y axis tick values not updating on setstate

See original GitHub issue

Describe/explain the bug I’m using ResponsiveBar to visualize simple grade percentage data. In development everything works as expected however, in production the tick values don’t seem to update on setstate.

Code

          <ResponsiveBar
            data={gradePrecentage}
            keys={["A", "B", "C", "D", "F", "O"]}
            indexBy="id"
            margin={{ top: 0, right: 60, bottom: 50, left: 50 }}
            padding={0.1}
            valueScale={{ type: "linear" }}
            indexScale={{ type: "band", round: true }}
            label={(d) => `${d.value}%`}
            colors={[
              "#41ab5d",
              "#7fc97f",
              "#f16913",
              "#ef3b2c",
              "#e41a1c",
              "#e41a1c",
            ]}
            itemHeight={"120px"}
            axisTop={null}
            axisRight={null}
            axisBottom={{
              tickSize: 5,
              tickPadding: 5,
              tickRotation: 0,
              legend: "Grade",
              legendPosition: "middle",
              legendOffset: 32,
            }}
            axisLeft={{
              tickSize: 5,
              tickPadding: 5,
              tickRotation: 0,
              legend: "% of Students",
              legendPosition: "middle",
              legendOffset: -40,
            }}
    />

data = [{id: key, data: value}]

Expected behavior Y axis Tick values should update as data changes on setstate in production build.

Screenshots If applicable, add screenshots to help explain your problem. Screen Shot 2021-02-01 at 1 30 44 PM

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser chrome 88.0, safari 14.0.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

3reactions
mehulmshahcommented, Feb 17, 2021

I should have updated – I was able to fix it using this solution

Essentially due to an issue with react-spring, you have to set sideEffects: false in your config – like @monzilnepali says above.

2reactions
wyzecommented, Apr 23, 2021

We’ve update to the latest react-spring and this workaround won’t be needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

d3 Axis Ticks Not Updating - Stack Overflow
That is all working fine and the data is plotted correctly. But, the tick marks remain 0 to 1 on the Y axis...
Read more >
Integrating D3 with React
The idea behind declarative visualization is that you can focus on building your logic, not how to render something. Same as we discussed...
Read more >
Top React Chart Libraries to Visualize your Data in 2023
Best React Chart Libraries help you to build user-friendly, responsive charts for your web App: Checkout most popular React Chart ...
Read more >
React debugging session - Why is this function called ...
Your code seems to work. Until it doesn't. Either it's not working as expected at all or only in some situations.
Read more >
7 React Chart Libraries For Your Web Projects
Meaning that you can focus on producing the actual data and leave the heavy-lifting of designing the graphs and charts on the library...
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