How to setup jpgraphs and wxgraphs

Could you tell us what you found and how you fixed yours so we can fix ours?

Thanks,

Rick

In the jpg-config.inc.php I did not the WEBROOT variable as suggested above in this thread.

// CACHE_DIR /tmp/jpgraph_cache/
// TTF_DIR /home/content/d/a/f/dafuser/html/wx/jpgraph-1.22/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”,“/home/content/d/a/f/dafuser/html/wx/jpgraph-1.22/ttf/”);
// DEFINE(“MBTTF_DIR”,“/usr/share/fonts/ja/TrueType/”);

//-------------------------------------------------------------------------

I also had a space or two in the line DEFINE(“TTF_DIR”,“/home/content/d/a/f/dafuser/html/wx/jpgraph-1.22/ttf/”);

After I removed the spaces and started using the path information supplied by the hardpath.php in place of the WEBROOT variable it started working.

I will give that a try. Thanks for sharing.

Rick

I have a question, and a bit of advice:

Advice first: I (evidently) have a windows server, and if I call my fonts folder ttf as instructed here, something in the code interprets the “\t” as a tab which results in the path to the font folder becoming corrupt. I renamed ttf to fonts and lots of stuff immediately started to work…

Now the question: Not everything works:
http://www.kingsteignton-weather.co.uk/WXGraphs/wxgraphs_test.html
http://www.kingsteignton-weather.co.uk/jpgraph-1.22/src/Examples/testsuit.php

The error message is truncated so I can’t see exactly what’s going on:
http://www.kingsteignton-weather.co.uk/jpgraph-1.22/src/Examples/bargradex1.php
but there still appears to be something wrong with the fonts.
Does anyone know what I have done wrong?

These are the relevant lines from jpg-config.inc.php:
//------------------------------------------------------------------------
// DEFINE(“CACHE_DIR”,“/tmp/jpgraph_cache/”);
DEFINE(“TTF_DIR”,“e:\domains\k\kingsteignton-weather.co.uk\user\htdocs\jpgraph-1.22\fonts/”);
// DEFINE(“MBTTF_DIR”,“/usr/share/fonts/ja/TrueType/”);

//-------------------------------------------------------------------------

I’ll admit that the Windows path with the wrong slashes looks really dicey - I see everyone else here has Linux servers…

I’m not sure but I don’t think the fonts folders should reference a drive letter.

http://www.kingsteignton-weather.co.uk/jpgraph-1.22/fonts/hardpath.php
I’ve no idea how to supply the path on a windows server then…

I’ve just checked my files (I run Apache on Windows here as a test server) and my paths are defined with forward slashes ‘/’ not the usual backslash and it works, and yes it should reference the drive letter on Windows.

Stuart

Stuart,
Thanks for checking. I’ve replaced the ""s with "/"s but unfortunately that made no difference.
It’s really weird that most of the graphs seem to work, but a few don’t.
I can’t think what I’ve done wrong. If I try to directly access one of the php files that don’t work (in IE6) I get:

Notice: Undefined variable: datat in e:\domains\k\kingsteignton-weather.co.uk\user\htdocs\WXGraphs\winddir_1hr.php on line 81
JpGraph Error: HTTP headers have already been sent.
Caused by output from file winddir_1hr.php at line 81.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it’s image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.

For example it is a common mistake to leave a blank line before the opening “<?php”.

I don’t know what that means, but I haven’t fiddled with any of the files.

At a guess it looks like you dont have jpgraph_scatter.php installed with the other jpgraph stuff as at least a couple of the graphs failing use a scatter plot and need this file. It should be in the JPGraphs package.

Stuart

Nope… I just checked and everything in the downloaded tar file is also there on the server.
It’s probably something really dumb that I’ve done, or not done, but I’m struggling to figure it out…

Hi

I am trying to set this up but get an error I have GD and this has been confirmed by the test.php, The gd version is the php supplied version and not the standalone.

This is a linux server running php 5.2

Any help much appreciated :smiley:

Steve

There’s an option for that, right now I cannot remember where… Oh yes its in the graphconf.php which should be set to false. If that is set correctly then you may need to edit the individual graph files to turn it off.

Stuart

I have turned off the antialias everywhere I could see it but still not much luck :frowning:

Some graphs work and some don’t http://www.stumpey.co.uk/wxgraphs/wxgraphs_test.html which is a bit strange

So still scratching my head #-o

Steve

Your 12 month rain graph works - what is it that’s different about that graph (and one or two others) that makes it not work on my site?

In each graph file there should be a statement saying

$graph->img->SetAntiAliasing(“$antialias”);

and in graphconf.php its should say

$antialias = “false”;

Stuart

I think I may have spotted something here. The message says the function ImageAntiAlias() is not supported in your GD version so I think you will have to comment it out in each of the graph files where it says $graph->img->SetAntiAliasing(“$antialias”); just comment that line out and try again. I’m not sure but its worth a try.

Stuart

Wooo

Thanks Stuart works like a charm :smiley: :smiley: :smiley:

Steve

There have been a few problems recently with the graphs I created and when I fixed them I added some new graphs which I had been working on but forgot about and these had bugs as well :oops: :oops: :oops: #-o #-o #-o

Anyway I have reworked the graph files removing the antialias which seemed to have caused problems for at least one person (its not recommended anyway), and fixed a few others. The new graphs now work and some have also been renamed to make it a bit more logical as to what each one does. There are some new ‘Last Whole Hour’ graphs now built from the clientrawhour file, as well as the original last rolling 60 minutes graphs from the clientraw file. Please review the package and make sure you pick the correct files for inclusion in your websites and modify your HTML as appropriate.

Anyway your can download the zip file here and the test HTML file can be viewed here on my website.

Stuart

Hi Stuart

Could we have temp+hum_24hr.php as it is missing from the new zip :smiley:

Regards
Steve

Try again, I’ve just updated it. It gets quite confusing renaming and rewriting all the graphs #-o

Stuart