How to setup jpgraphs and wxgraphs

Stuart,

Do you want me to send you my old 1 hr graphs to take a look at. Let me know.

Chuck

WDL doesn’t use a real timestamp, the axis runs from -60 to 0.

Well in that case WDL is showing an invalid x axis on my graphs because my clientrawhour.txt is only updated once per hour at 59 minutes past the hour, so I’ll raise a thread for Julian to look at. As for the graphs I’ll look later at how I might do it.

Stuart

Please see this thread for Julian’s comments on the clientrawhour.txt problem. Since we are using data which Brian creates for WDL I’m inclined to leave the jpgraph code as is for now and wait for the outcome of this other thread. Julian seems to feel a timestamp is needed.

Stuart

Yes, I agree, a time stamp would be the best solution.

Im getting there on setting up these graphs…

http://www.snoqualmieweather.com/wxgraphs/rain_1hr.php

There error Im getting is for the fonts. But I cant seem to find in what file to change the path to my folder where the fonts are. If anyone knows off hand, that would be great. Thanks, Mark.

UPDATE: I got it fixed…Now onto other issues…lol

Got to your jpgraph.php under the src folder and look for this. See the last line DEFINE(‘TTF_DIR’,‘/virtual/users/e14497-14796/web/graphs/jp/ttf/’); thats where you configure your fonts. This is the way I have it set up. Mine is around line 46 or so.

if (!defined('TTF_DIR')) {
    if (strstr( PHP_OS, 'WIN') ) {
	$sroot = getenv('SystemRoot');
        if( empty($sroot) ) {
	    $t = new ErrMsgText();
	    $msg = $t->Get(12,$file,$lineno);
	    die($msg);
        }
	else {
	  DEFINE('TTF_DIR', $sroot.'/fonts/');
        }
    } else {
	DEFINE('TTF_DIR','/virtual/users/e14497-14796/web/graphs/jp/ttf/');

Chuck

Thanks Chuck…I got that figured out…Now im trying to get them all aligned on my page…The bottom graphs are shifting to the left…So thats what Im fighting with now…Then Id like to work on changing the backgrounds on the graphs themselves.

a temp page

http://www.snoqualmieweather.com/pagetemplate.php

I had JPGraphs on my old site…Graphweather makes much better looking ones without all the hassle. Just my humble opinion :smiley:

trying to set these graphs back up on php v5 and I’m getting a weird error. They worked no prob on v4. i did download the files for v5, so thats not a problem. Heres the link with the error…

http://www.snoqualmieweather.com/wxgraphs/baro_7days.php


if ($family >= FF_MINCHO && $family <= FF_PGOTHIC) {                      <<<<<<Line 386
	    $f = MBTTF_DIR.$f;
	} else {
	    $f = TTF_DIR.$f;


I have all the fonts and folders in the right place, just like how they were when I had v4.

Any ideas would be great…Thanks, Mark.

Mark,

I took a look at your page source and the the graphs path are different on a couple not sure if that is the issue. I assume they are all in the same directory.

[b] [/b] [b] [/b] <[b]td>[/b] [b] [/b]
<td><img src="./wxgraphs/solar_24hr.php /"></td>

Chuck

I did that yesterday messing with it cause of a directory change, but that didnt affect anything. The link I provided in my previous post is a direct link to a graph. if it works there, then it should work on the page.

Did you check your jpg-config.inc.php and set the directories. I assume that you did. Sorry if I am repeating things. It could be something to do with the new file because I do not have it jpgraph_ttf.inc.php.

// Directories for cache and font directory.
//
// CACHE_DIR:
// The full absolute name of the directory to be used to store the
// cached image files. This directory will not be used if the USE_CACHE
// define (further down) is false. If you enable the cache please note that
// this directory MUST be readable and writable for the process running PHP.
// Must end with ‘/’
//
// TTF_DIR:
// Directory where TTF fonts can be found. Must end with ‘/’
//
// The default values used if these defines are left commented out are:
//
// UNIX:
// CACHE_DIR /tmp/jpgraph_cache/
// TTF_DIR /virtual/users/e14497-14796/web/graphs/jp/ttf/
// MBTTF_DIR /usr/share/fonts/ja/TrueType/
//
// WINDOWS:
// CACHE_DIR $SERVER_TEMP/jpgraph_cache/
// TTF_DIR $SERVER_SYSTEMROOT/fonts/
// MBTTF_DIR $SERVER_SYSTEMROOT/fonts/
//
//------------------------------------------------------------------------
// DEFINE(“CACHE_DIR”,“/tmp/jpgraph_cache/”);
// DEFINE(“TTF_DIR”,“/virtual/users/e14497-14796/web/graphs/jp/ttf/”);
// DEFINE(“MBTTF_DIR”,“/usr/share/fonts/ja/TrueType/”);

Chuck

i do have this under the main section where it says to change it…

// define(“TTF_DIR”,“/virtual/users/e16108-17165/web/jpgraph-2.3.4/ttf/”);

But I didnt change the windows or unix section. i never had to do that before.

Here is another repeater probably. Under the jpgraph.php. Just trying to cover everything I can think of. :wink:

if (!defined(‘TTF_DIR’)) {
if (strstr( PHP_OS, ‘WIN’) ) {
$sroot = getenv(‘SystemRoot’);
if( empty($sroot) ) {
$t = new ErrMsgText();
$msg = $t->Get(12,$file,$lineno);
die($msg);
}
else {
define(‘TTF_DIR’, $sroot.‘/fonts/’);
}
} else {
define(‘TTF_DIR’,‘/usr/share/fonts/truetype/’);
}

Chuck

Yeah…thats the same. Im starting to wonder If its the fonts I uploaded from the windows folder. But ive uploaded new font files. But for some reason, i think they may be the problem.

I am sort of stuck on this one. I downloaded the newer version 2.3.4 and there are some new files incorporated.

Chuck

Yeah…I was using the v4 one before, and it worked fine. But this one has me stuck.

Well I just took a look at the error from one of your graphs and it says ‘open_basedir restriction in effect’ which if I’m correct says that anything your web server is going to access has to be within the specified root directory for your wweb server (ie. where you put your pages and stuff) so if you have a path with starts outside of that directory it will fail.

In this case you have /usr/share/fonts/truetype/arialbd.ttf which is a full unix path relative to the absolute root directory and wont open, you have to have a fonts directory within your normal web stuff and point to it. So I think you should try something like making a directory called fonts in your normal structure and just specify it as fonts/.

This is nothing to do with JPGrpahs per se, its caused by a PHP5 restriction and the way you are specifying your path. My JPGraphs work fine on PHP5.

Stuart

Thanks. Then it has to do with e-rice making you upload your files to the /web folder directory. i know it has nothing to do with jpgraphs cause it worked fine on my last host. Im still a bit confused on what you suggested to do to fix this. Just make a new folder called fonts and change the path in what file? Thanks.