Nivo: Nivo bar bug introduced in 0.64

Created on 6 Nov 2020  路  6Comments  路  Source: plouc/nivo

Describe/explain the bug
The bar crashed in new v0.64, it worked in previous version 0.63.1

To Reproduce
Here is an example, you can switch dependency between versions to see difference.
https://codesandbox.io/s/bar-custom-color-forked-zm065?file=/src/index.js

Expected behavior
It should not crash

Desktop (please complete the following information):

  • OS: Mac
  • Browser Chrome
bar bug

Most helpful comment

Correct, I opened #1291 to fix it. I tested it out in grouped/stacked, horizontal/vertical, and it matches output of 0.63, before I introduced valueScale prop. I am going to add a couple tests to prevent regression again.

All 6 comments

Hi @codler, thank you for opening an issue and including a CodeSandbox. The issue is with your data, specifically the last item in the array, it is missing the compareCount key. For now, you can add it with a zero value, but I have a fix incoming.

@wyze It is intentionally "missing"/undefined on the last compareCount key, I dont want the bar to show 0 on that item

Okay, no worries, it is something I didn't account for in my refactor.

@codler, thank you for creating the CodeSandbox I have this exact same problem. When I generate my data, I only add the data that is pertinent so this failed starting with 0.64.0 for the exact reason you showed in your example.

@wyze This is still a bug if you use groupMode: 'stacked' or remove groupMode which defaults to 'stacked'. Here's an example with 0.65.1 where you can see it work with groupMode: 'grouped', and comment it to see it fail https://codesandbox.io/s/bar-custom-color-forked-n7re4?file=/src/index.js

Correct, I opened #1291 to fix it. I tested it out in grouped/stacked, horizontal/vertical, and it matches output of 0.63, before I introduced valueScale prop. I am going to add a couple tests to prevent regression again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

p45mark picture p45mark  路  3Comments

knackjax picture knackjax  路  3Comments

PattieC4ke picture PattieC4ke  路  3Comments

KENNYSOFT picture KENNYSOFT  路  3Comments

barnapisti1994 picture barnapisti1994  路  3Comments