-
Notifications
You must be signed in to change notification settings - Fork 28
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
Trouble with adpation of your fork for using draw down bar from 0 for negatives value #7
Comments
have you got the link to issue in nnick/chart.js where the modifications are |
I don't get it right now :s i've forgot to add it to my bookmarks :s |
Oh if i remmeber well, i'll probably get some help of that fix too ;) |
ah ok if there are comments i can see what has been added cheers |
so it was just missing some code from one place in your example, where i have the option of drawing stacked bars and normal bars you had only added it to the stacked bars part, also added in checking for showing tooltips when hovering over labels here is an example - http://fiddle.jshell.net/leighking2/6p4fo0tb/ i have added a commit to a dev branch where you can grab the built Chart.js file (07e6e78) as im not entirely happy with this solution, i would like it to automatically detect the need to display in negative values without having to setup the overrides in the options. also when using the overlay and having a fill on the line it doesn't take into account the fact that 0 is no longer at the bottom so fills all the way from the bottom which looks weird. so ill keep having a look at this but for the moment it does now work like the fix from nnick/chart.js's repo. when i have everything ready ill commit this to the master but for now just going to leave it on the dev branch. |
Oh ok that's why it didn't work correctly when i try to use it. Thank you so much for your help ! :) (juste a little question for ask if it's possible to do something ^^ on my graph the two line are both constant define by the user, so it always display a straight line, is it possible for that usecase that the line will be draw from the left side to the right side of canvas without space between the side of canvas ? :) space is due to X label/value and because dot of line graph spawn in the middle of each Bars in the bar graph but will it be possibel to draw the line directly from the y axis to the complete right side of the canvas ? Just for asking ;) ) |
ok ive just pushed a commit to the dev branch again for this issue which makes it so that you do;t have to override the scale and line charts display better with the negative values. you just have to make sure the beginFromZero option is false. I'm going to do some mroe testing on it but then ill merge into the master branch. if you take a look let me know if you spot anything weird with it. |
Ok really thank you ! :) |
ok ive tested it against all the charts and it seems to be working well, im going to merge the dev branch into master so if you do spot anything just add another issue, cheers |
Hi,
i've contact you by mail, and for make the discussion easier, you've aksed me to post a issue here so there it is ! ;)
i've got some trouble to adapt your fork for make it draw down bar from 0 for negatives values.
At first place, I was looking for a fork of Chartjs api wich support negative values correctly. I found a post of nnnick in the issue part where he explains how we can succeed to draw negative value down from 0 so I try to do some modification in the chart.js file to do that (following the indication of nnnick) and I succeed I get this :
http://fiddle.jshell.net/Mokette/x2vy0nvh/2/
(you probably have to run it for make it draw properly -> positifves values draw up from 0 to value and negatives draw down from 0 to value)
(in this fiddle it’s the chartjs file with some modification for drawing negatives values down from 0, it’s work pretty well :) )
Then I’ve been ask to draw multiple graph (a bar and two line) in the same canvas so I look for a fork wich permit these functionality and I found yours !
It work really good for drawing multiple graph with the new overlay extension but it doesn’t work for drawing negatives values.
So I try to do the same modification to the Chart.js file of your fork to add the functionality of drawing bars down from 0 for bar graph but I didn’t succeed to make it work well :s
http://fiddle.jshell.net/Mokette/xL0bdcmb/1/
This is the fiddle where I load your chart.js file from your fork with my modification for drawing bar down :) but didn’t work as the first fiddle for drawing bar down but still work well for multiple graph :)
You can find here http://gnomebusters.fr/jsfiddle/files/ two file, the chart.js file I use in my second fiddle (the Chart.js file is the one from your fork where i add some modification to test drawing negatives bars) and a .txt file where I explain where I’ve added/modify your fork to try to draw negative bars.
The text was updated successfully, but these errors were encountered: