Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.0

Request #5985 Logarithmic Axis Minimum Value
Submitted: 2005-11-16 15:26 UTC
From: adirotea Assigned: nosey
Status: Closed Package: Image_Graph
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-11-16 15:26 UTC] adirotea
Description: ------------ Because the log10(0) is infinite i think you should enforce the minimum value to 1. Therefore in file 'Image/Graph/Axis/Logarithmic.php' line 83 should change from: <code> /** * Forces the minimum value of the axis. * * For an logarithimc axis this is always 0 * * @param double $minimum The minumum value to use on the axis */ function forceMinimum($minimum) { parent::forceMinimum(0); } /** * Gets the minimum value the axis will show. * * For an logarithimc axis this is always 0 * * @return double The minumum value * @access private */ function _getMinimum() { return 0; } </code> to: <code> /** * Forces the minimum value of the axis. * * For an logarithimc axis this is always 0 * * @param double $minimum The minumum value to use on the axis */ function forceMinimum($minimum) { parent::forceMinimum(1); } /** * Gets the minimum value the axis will show. * * For an logarithimc axis this is always 0 * * @return double The minumum value * @access private */ function _getMinimum() { return 1; } </code>

Comments

 [2005-11-16 18:35 UTC] nosey
You are right that log(0) is infinite, but I see justification to forcing minimum to be 1. You may just as well have a plot of values ranging of 2-3 orders of magnitude less than 1 that would be appopriate to plot in a logarithmic plot. The forceMinimum(0) and getMinimum() = 0 was done, because there is no way we can assign an interval of ]0; max]. Therefor it is set to [0; max] and the handling of the special case log(0) is (should be) performed elsewhere. It's true, it might not be the best way to handle things, but setting min = 1 is not either. Therefor I have taken the liberty of changing your bug-report to a Feature/Request of making it possile to set a minimum value (i.e. $Axis->setMinimum(10))
 [2005-11-16 20:13 UTC] adirotea
Hi, Thanks for your quick reply. I think you are right making this a feature request and planning to allow overwriting the axis minimum. I am new to Image_Graph. I only used it in the last 2 days and I am not aware of all the functionality. I will try to explain what happened in the case of my graph, this way you will figure if the above is the right solution. I made a Bar Plot for a ping monitoring app showing the response times. I made Y axis logarithmic to show less details for higer response times and more details for lower response times. But when the graph was plotted it coloured the bars from top to bottom, because of the infinite result of the minimum 0 value. If is not clear enough I can paste the code sample. Regards, Adrian
 [2005-11-17 12:00 UTC] adirotea
ok
 [2006-02-28 22:12 UTC] nosey
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.