MattR Posted January 7, 2010 Share Posted January 7, 2010 I'm using phpMyGraph and I've run into a problem. I'm making a graph for temperatures over the day, and filling in any missing data with blanks (i.e. if it's only 12 noon, 13:00 - 23:00 get inserted with empty data/empty bars so the bars are all proportionate). Array for the actual data I've got: Array ( [00] => -1.4 [01] => -1.2 [02] => -1.5 [03] => -2.3 [04] => -3.2 ) Basically just data from midnight to 04:00. It draws fine like this, all the bars are below the 0 line, but they're all very thick and take up the entire width of the graph, as that's all the data there is; see first attachment, (ignore the chopped off title), it's spreading it out and it isn't very clear. So, for the other hours I just loop through and populate it with 0, just so there's an empty space for each one: Array ( [00] => -1.4 [01] => -1.2 [02] => -1.5 [03] => -2.3 [04] => -3.2 [05] => 0 [06] => 0 [07] => 0 [08] => 0 [09] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 ) What I'd expect to see is the bars from before with the bars from 05-23 there as well, but empty. This method works fine, other graphs are OK, the problem is that if the first value is a negative, and there is a 0 anywhere in the data after that, no bars will show at all, see second attachment. If I put a positive number at the start, they show fine, if I have a negative at the start and replace the 0 with 0.0000001, it's fine, it's only if it starts with a negative and contains a 0. Putting 0.0000001 instead of 0 is not a solution as then the value on the bar is 1E-12 or something. I've looked at the code and can't see why it happens, if anyone can I'd be very grateful. Apart from this issue the class is very good. Unfortunately though there doesn't seem to be a clear way of contacting the author via their website. Thanks. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/187550-phpmygraph-error-with-negative-numbers/ Share on other sites More sharing options...
vorlox Posted July 11, 2010 Share Posted July 11, 2010 Hi, I stumbled on this posting and was not aware of this bug in my graph class. The problem is now fixed in version 5.0.4 I also added my e-mail adres on the top of my phpMyGraph page, so next time send me a bugreport. Thanks for using my software and reporting the bug. Quote Link to comment https://forums.phpfreaks.com/topic/187550-phpmygraph-error-with-negative-numbers/#findComment-1084518 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.