jpgraph error - DisplayValue::ApplyFont() in jpgraph_pie.php

3rd party extensions (phpDivingLog, dive computer downloader,...)
Post Reply
ScubaPete
Posts: 5
Joined: Fri Apr 18, 2008 23:08
Contact:

jpgraph error - DisplayValue::ApplyFont() in jpgraph_pie.php

Post by ScubaPete » Sun Apr 20, 2008 17:35

I seem to be having a bit of trouble getting jpgraph to work on drawing the pie chart on the statistics page. The pie chart does not show up at all, and the apache log shows:

Code: Select all

[Sun Apr 20 11:42:39 2008] [error] [client 10.10.10.10] PHP Fatal error:  Call to undefined method DisplayValue::ApplyFont() in /home/.sites/28/site1/web/divelog2.1/includes/jpgraph2/src/jpgraph_pie.php on line 717, referer: http://www.timelordz.com/divelog2.1/divestats.php/list
This is on a CentOS 4.6 server, PHP 5.2.5 with GD, etc.

The weird thing is that jpgraph itself appears to work fine:

http://www.timelordz.com/divelog2.1/inc ... stsuit.php

(I just copied over the Examples directory from a parallel install of jpgrap2.3 into the jpgraph2/src directory included in the phpdivinglog 2.1 install to verify the environment was working and have these to test with.)

So I am a bit confused on where the undefined method DisplayValue::ApplyFont() is breaking down. The error says line 717 in jpgraph_pie.php which is:

Code: Select all

//-----------------------------------------------------------------------
        // Step 2 of the algorithm is use the clusters and draw the labels
        // and guidelines
        //-----------------------------------------------------------------------

        // We use the font height as the base factor for how far we need to
        // spread the labels in the Y-direction.
        $this->value->ApplyFont($img);   ### This is line 717
        $fh = $img->GetFontHeight();
        $origvstep=$fh*$this->iGuideVFactor;
        $this->value->SetMargin(0);

I though it might be due to wrong paths in jpg-config.inc.php or permissions issue, but clearly this seems to be a failed call, I am just having trouble tracking down why.

Although I don't think this is relevant, the paths I have set in jpg-config.inc.php are:

Code: Select all

DEFINE("CACHE_DIR","/tmp/jpgraph_cache/");
DEFINE("TTF_DIR","includes/jpgraph/fonts/");
DEFINE("MBTTF_DIR","includes/jpgraph/fonts/");
But as above, it appears the work fine when pulling up and of the jpgrpah examples and caching is actually not on now too.

I would like to get the pie graph working and if someone could point me in the right direction I would appreciate it.

Thank you,

ScubaPete

gjc999
Posts: 22
Joined: Wed Apr 30, 2008 17:26

Are all the needed fonts in place?

Post by gjc999 » Thu Jul 10, 2008 17:48

Hi,

I'm not 100% sure, but this looks like the same error I get when I install a new JP-Graph setup for someone. Basically, the script is looking for a font file that you don't have installed (I think). The trouble is a lot of the examples are looking for some flavor of the Arial font that comes with windows. But these fonts are not installed with JP-Graph by default most times.

So, I suggest looking in the directory that this line points at:
DEFINE("TTF_DIR","includes/jpgraph/fonts/");
And see if the font files are all there. If not, you'll need to copy the fonts from some windows machine, or download the fonts from microsoft.com (I think they are available still for download). Copy the fonts into that fonts directory above, and that should solve your issue.

dave
Posts: 10
Joined: Fri Jul 18, 2008 16:47

Pie Graph

Post by dave » Fri Jul 18, 2008 16:49

Did anyone solve this problem? I have the same issue - copied all the arial ttf files to jpgraph/fonts but still no joy. Thanks - Dave

dave
Posts: 10
Joined: Fri Jul 18, 2008 16:47

Post by dave » Fri Jul 18, 2008 19:35

I got the pie chart to appear by reverting back to the old jpgraph by changing

Code: Select all

require_once './config.inc.php';
if(version_compare("5.1", PHP_VERSION, "<")){
    require_once 'includes/jpgraph2/src/jpgraph_pie.php';
} else {
    require_once 'includes/jpgraph/src/jpgraph_pie.php';
}
to

Code: Select all

require_once './config.inc.php';
if(version_compare("5.1", PHP_VERSION, "<")){
    require_once 'includes/jpgraph/src/jpgraph_pie.php';
} else {
    require_once 'includes/jpgraph/src/jpgraph_pie.php';
}
in ~/divelog/drawpiechart.php .

Inferno
Posts: 252
Joined: Thu Apr 19, 2007 20:36
Location: The Netherlands
Contact:

Post by Inferno » Mon Aug 18, 2008 13:04

Got some spare time before holiday. So picked up development again.

Could you try to upgrade jpgraph2? Just download the latest version and overwrite the jpgraph2 files.

dave
Posts: 10
Joined: Fri Jul 18, 2008 16:47

Upgrade jpgraph2 files

Post by dave » Tue Aug 19, 2008 16:18

I upgraded the jpgraph2 files to the most recent version at http://www.aditus.nu/jpgraph/jpdownload.php but this did not help.

Thanks for looking into this!
Dave

Post Reply