Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bar chart is removing keys with falsy values #2253

Closed
GabrielaGuedes opened this issue Mar 1, 2023 · 2 comments
Closed

Bar chart is removing keys with falsy values #2253

GabrielaGuedes opened this issue Mar 1, 2023 · 2 comments
Labels

Comments

@GabrielaGuedes
Copy link

Describe/explain the bug
The objects passed for the prop data in the bar chart have their falsy (undefined, null, 0, etc) keys removed. It is bad because 0 != null, for example. Other reasons for why it is bad can be found in this issue from 2021: #1817, which relates the same problem. Since it was closed due to inactivity and the problem is still happening, I've open this issue again.

To Reproduce
The same test case from the old issue: https://codesandbox.io/s/nivo-playground-forked-p3wlo?file=/package.json

Steps to reproduce the behavior:

  1. Pass an object with falsy keys for the data prop from the chart:
// ...

  const data = [{ amount: 30, date: "01/01", falsyValue: 0, anotherFalsyValue: false, another: null }];
  
  return <ResponsiveBar
      data={data}
      keys={["amount"]}
      // ...
    />

// ...

Expected behavior
I wish that these value were kept, then we could use them on tooltips and extra layers.
An example for an expected behavior can also be found in the last issue: https://codesandbox.io/s/nivo-playground-forked-8dhxye

Screenshots
From the previous issue:
image

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser: chrome
  • Nivo version: 0.80
@stale
Copy link

stale bot commented Jun 10, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Jun 10, 2023
@stale
Copy link

stale bot commented Jul 19, 2023

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@stale stale bot closed this as completed Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant