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.

Negative numbers do not render in bar chart when there is only one key

See original GitHub issue

Take the example here:

http://nivo.rocks/storybook/?selectedKind=Bar&selectedStory=stacked horizontal&full=0&down=1&left=1&panelRight=0&downPanel=storybooks%2Fstorybook-addon-knobs

Change the data to have negative values, and have only one key field:

<Bar
  width={1000}
  height={600}
  margin={{top: {60}, right: {80}, bottom: {60}, left: {80}}}
  data={[{{country: "AD", hot dogs: {-55}}}, {{country: "AE", hot dogs: {7}}}]}
  indexBy="country"
  keys={["hot dogs"]}
  padding={0.2}
  labelTextColor="inherit:darker(1.4)"
  labelSkipWidth={16}
  labelSkipHeight={16}
  layout="horizontal"
  enableGridY={false}
  enableGridX
/>

and the negative value bars do not render.

But adding an extra key makes it work, i.e.

  keys={["hot dogs", "FOO"]}

or

  keys={["hot dogs", ""]}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
20ali20commented, Apr 3, 2018

dont put values inside { }

0reactions
wyzecommented, Jun 4, 2021

Going to close this as it appears to be fixed now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Negative numbers are not displaying in a clustered bar chart
Hi, I have a spreadsheet with the periodic table elements with their melting and boiling points. I have two problems.
Read more >
how to cause negative numbers in a chart … - Apple Community
This seems a simple thing, yet I find no way to do it. I have a chat that shows both positive numbers and...
Read more >
A Complete Guide to Stacked Bar Charts | Tutorial by Chartio
Stacked bar charts extend the standard bar chart by dividing each bar into multiple subcategories. Learn how to best use this chart type...
Read more >
Display of population data without a value or with a negative ...
In some cases, not the objects are shown in the chart, but the sign. This can for example happen in a bar chart...
Read more >
Display negative values in the first quarter of a bar chart but ...
regarding the color yes but the bars should be over 0, not below, like the positive ones. – firmo23. Nov 5, 2020 at...
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