-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bar charts don't support negative values #9
Comments
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 |
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 #669 (comment). 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? |
👍 please include #994 |
I am moving to axis milestone as it may be related |
Moved my PR from #669 to #1094. Working example at https://jsfiddle.net/ahrex/jy8nnaem/. Thanks, |
@tannerlinsley: the negative values overflowing are due to the option being specific to a bar chart, I believe. You have to pass in a bar-specific object during creation in order to get it working. |
@borgar Huzzah! The first alpha of Chart.js 2.0 has landed and should fix this issue. Check out the release and try it out! We've got a lot of momentum right now, so please help us test so we can launch 2.0 Gold by the end of the month. I'm closing this issue for now, but if you have implementation questions or find bugs, please create a jsfiddle and post the link here and we'll reopen this issue and get it fixed. |
starting from this fork of Chart.js chartjs/Chart.js#9 and further modified to add an alwaysShowZero option
Bar charts turn very strange when negative values exist in the data.
Test: http://jsfiddle.net/egMGx/
The text was updated successfully, but these errors were encountered: