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

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", ""]}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

dont put values inside { }