Axis values all "0f"

196 views
Skip to first unread message

Ole Wolf

unread,
Apr 30, 2016, 10:53:18 AM4/30/16
to JpGraph
I've just upgraded my computer from Ubuntu 15.10 to Ubuntu 16.04, which replaced PHP5 with PHP7. For some reason, some of my jpgraph graphs now display "0f" instead of the values on the axes. This also occurs in the jpgraph examples, as show in the attached screendump (in this case, the output of Examples/example2.php).

It doesn't always happen, though; sometimes the expected values are displayed on the axes, only to revert to 0f later.

Any ideas why?
jpgraph-0f.png

Melroy van den Berg

unread,
May 16, 2016, 12:18:55 PM5/16/16
to JpGraph
Exactly, I got the same issue. On the X asis I fixed this issue using:
$graph->xaxis->SetTickLabels($datax);

I still have this issue on Y-axis. It's a bug I guess.

Should we report it?
https://github.com/HuasoFoundries/jpgraph/issues

Melroy van den Berg

unread,
May 16, 2016, 12:21:05 PM5/16/16
to JpGraph
Ps. I also updated y-axis!! :D By defining the following code line:
$graph->yaxis->SetLabelFormatCallback('number_format');

Ole Wolf

unread,
May 16, 2016, 1:16:02 PM5/16/16
to JpGraph
Your "SetLabelFormatCallback" did the trick. I wasn't even able to find that function in the jpGraph documentation.

I think it warrants a bug report, but to be entirely honest, I don't think jpGraph is being maintained anymore.

r...@sailbert.com

unread,
Jul 13, 2016, 11:39:22 AM7/13/16
to JpGraph
I think I found the issue.

In the file jpgraph.php line 4486, I changed the > to >=

    function _doLabelFormat($aVal,$aIdx,$aNbrTicks) {
        // If precision hasn't been specified set it to a sensible value
        if( $this->precision==-1 ) {
            $t = log10($this->minor_step);
            if( $t >= 0 ) {  //this was $t > 0
                $precision = 0;
            }
            else {
                $precision = -floor($t);
            }
        }
        else {
            $precision = $this->precision;
        }

dcc

unread,
Jul 24, 2016, 7:51:54 PM7/24/16
to JpGraph
Thank you for this find.  
I had the same problem with Ubuntu 16:04 with the '0f' axis.
I made the change to jpgraph.php and, at least in my own plots, the problem has been resolved.


(posting to ensure this info  is easier to find)
Reply all
Reply to author
Forward
0 new messages