Bar charts don't support negative values
Bar charts turn very strange when negative values exist in the data.
Test: http://jsfiddle.net/egMGx/
I'll take a look at nice ways of showing negative scales for both bar and line charts.
Could, we enhance the bar charts for the horizontal look and provide it also as an option?? I would also like to know how to contribute to the library with new chart types as an option.
anything new on this?
In my fork (https://github.com/WimAtIHomer/Chart.js) I have made changes to support negative values
Did you do a pull-request? It would be awesome to have it for everybody in the main chartjs!
The changes are part of my pull-request "BarAndLine Chart added". Don't know if will ever be part of the main chartjs, never had a reply on that pull-request. The project looks kind of dead.
Any progress on this? PS. Thank you WimAtIHomer, your version works great.
Edit: I had to remove ".toFixed(getDecimalPlaces(stepValue))" from the populateLabels function in order to set correct labels on -1, 0, 1, etc values.
still no progress with negative numbers?
Bars with negative numbers works on the alternative version available at https://github.com/FVANCOP/ChartNew.js . This version is down compatible with nnnick version.
thank you very much!
Haven't had a chance to put that into the new version just yet. I'll leave this open as an enhancement, if anyone wants to take a look at incorporating their changes into the Chart.Scale class that'd be winning.
I've proposed a fix, and wrapped it up as a pull request. This change works for my use case, but feel free to take it and generalize it.
Hey guys, how is this going? is @ahrex 's pull request good to go? I'm looking to use a lot of these charts in production soon, and this is one of the biggies ;)
Hey @tannerlinsley,
There's a bug with my proposed fix where the scale will look wonky upon resize (responsive == true). I'm testing out @3xmo's potential fix he provided at https://github.com/nnnick/Chart.js/pull/669#issuecomment-60125767. I'll let you know how it goes.
EDIT: fixed.
@ahrex Awesome. If you need some help, let me know.
I've not tested with responsive: true, but the previous PR is a win.
@tannerlinsley, @chrisfromredfin,
I've cleaned up my pull request. The tip of ahrex/Chart.js now has the alternative origin wrapped up in a method, and I've replaced all areas that were calling the old origin with this method. It works for me, but I haven't tested all cases so feel free to comment on anything unusual you see.
Everything so far seems to look amazing with @ahrex 's modifications. I'd love to see this merged in asap.
@ahrex - I checked out the pending pull request here, and changed some of the bar values to negative values, but this resulted in the negative bar flowing outside of the scale and canvas. Can you confirm?
:+1: please include #994