react-d3-components icon indicating copy to clipboard operation
react-d3-components copied to clipboard

Bar Graph not ready for negative values

Open diversos opened this issue 7 years ago • 7 comments

How would you recommend fixing negative values in barChar? I can't explain properly, so I'll show you an example:

github_eg

2010: 0+0+0+0 2011: 0+0+0+0 2012: 0+0+0+0 2013: 0+5+8+0 2014: -38+0+13+0 2015: 45+12+130+0 2016: 0+0+0+0

I think that the xAxis should stay in y=0, and the negative values would go under it.

diversos avatar Aug 08 '17 15:08 diversos

That's interesting! I never considered that. Let me ask if I understand you correctly. 13 should be on top of the x-axis and -38 should be below the x-axis? So all negatives stack below and all positives stack above right?

codesuki avatar Aug 09 '17 01:08 codesuki

Exacly! And several negatives would stack bellow each other. I don't think it should be too hard to implement, since you have the concept at the Scatter Graph.

diversos avatar Aug 09 '17 10:08 diversos

Did you have some time to try it?

diversos avatar Sep 25 '17 14:09 diversos

I tried it but there are still some unsolved issues.

  1. What to do with the labels?
  2. Special handling for grouped bar chart

See here: image

codesuki avatar Sep 27 '17 03:09 codesuki

Fixed the grouped chart, but no good idea what to do with the labels.

image

codesuki avatar Sep 27 '17 03:09 codesuki

The only two options I see is either let it in the same place, but over the column bar, or push all the labels down, bellow the graphic.

diversos avatar Sep 27 '17 10:09 diversos

Yep, I can't see a much better way without total customization. I'll change the rendering order, I hope that's good enough.

codesuki avatar Sep 27 '17 12:09 codesuki