codesuki / react-d3-components

D3 Components for React
http://codesuki.github.io/react-d3-components/example.html
MIT License
1.63k stars 206 forks source link

Bar Graph not ready for negative values #138

Open diversos opened 6 years ago

diversos commented 6 years ago

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.

codesuki commented 6 years ago

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?

diversos commented 6 years ago

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 commented 6 years ago

Did you have some time to try it?

codesuki commented 6 years ago

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 commented 6 years ago

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

image

diversos commented 6 years ago

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.

codesuki commented 6 years ago

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