JPGraph-Need help configuring

not sure, I think

$jploc = “${WEBROOT}/jpgraph/src/”; //must have trailing slash

Ok,
I edited the line with $jploc = “${WEBROOT}/jpgraph/src/”; //must have trailing slash …and I believe that is correct.

but now when I go to my index page for all my broadstairs graphs here: http://www.gateway2capecod.com/wxgraphs/

I get this same error: for any of the graphs:

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/X11R6/lib/X11/fonts/truetype/arialbd.ttf) is not within the allowed path(s): (/virtual/users/e14837:/tmp:/usr/lib/php) in /virtual/users/e14837-15290/web/jpgraph/src/jpgraph_ttf.inc.php on line 330
JpGraph Error Font file “/usr/X11R6/lib/X11/fonts/truetype/arialbd.ttf” is not readable or does not exist.

I edited the graphconfig file and replaced the default line of ARIAL text font to this:

//Font specifcations Not used yet!!!
//Use FF_FONT1 if you do not have the ARIAL font but be aware some graphs will not work because the default
//does not allow rotation of text.
//$aFontFamily = “FF_FONT1”;
//$aFontStyle = “FS_BOLD”;
//$aFontSize = 8; // This is the font size for main titles
//$aFontSize1 = 8; // This is font size for the axis (x & y)

But It appears I may need to get the Arial font installed, for the jpgrahs to work correctly

where do I down load the arial font from? shouldnt I have an arial font if I have newest windowsxp editions?

getting closer though…thanks chris

you don’t have ttf fonts on the server

this is not easy to explain for me, but I try

create a folder “ttf” in your jpgraph/src folder
upload arialbd.ttf to it you find it in windows/fonts/Arial bold (True Type)
make sure you rename it (no capitals here)it must be arialbd.ttf not ARIALBD.TTF

open jpg-config.inc.php

find
// DEFINE(“TTF_DIR”,“/usr/X11R6/lib/X11/fonts/truetype/”);
and uncomment that line
change the path to the hardpath to you ttf folder
something like
DEFINE(“TTF_DIR”,“/virtual/users/e14837-15290/web/jpgraph/ttf/”);

I hope I did not forget someting here

you find jpg-config.inc.php in the jpraph/src folder

and to find the correct path of your ttf folder put attachement(after unzipping it) in your ttf folder and browse to it

copy and paste that path and jpgraph must find your fonts


hardpath.zip (151 Bytes)

no luck on any of this…

dont understand why I can use the non arial font?

well I am stuck here:

when trying to view any of my wxgraphs, I get this same error message:

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/X11R6/lib/X11/fonts/truetype/arialbd.ttf) is not within the allowed path(s): (/virtual/users/e14837:/tmp:/usr/lib/php) in /virtual/users/e14837-15290/web/jpgraph/src/jpgraph_ttf.inc.php on line 330
JpGraph Error Font file “/usr/X11R6/lib/X11/fonts/truetype/arialbd.ttf” is not readable or does not exist.

my grapghs index page is here:

http://www.gateway2capecod.com/wxgraphs/

thanks for the help pinto , but I can not get it working…maybe broadstairs has some answers on this

I must have forgotten something,don’t know what

well just to recap on everything I did so faR:

downloaded the jpgraph and checked that I have version 2.2 for php vers 5 support
then uploaded the examples to my server and they are working here:

http://www.gateway2capecod.com/jpgraph/src/Examples/testsuit.php

downloaded the wxgrapghs…and edited only this line inside the graphconfig.php to this:

//where are your clientraw*-files and JPGraph relative to where this file is
//note you should only need to change the jpgraph directory if you do not use standard names
$hostloc = “${WEBROOT}/”; //must have trailing slash
$jploc = “${WEBROOT}/jpgraph/src/”; //must have trailing slash

the wxgraph and jpgraph folders are both uploaded to my server

when going to my index page and trying to view any of the broadstairs graphs, I get the error about the font being misconfigured.

I made a new folder on the server, within the jpgraph/src folder and named ttf and added the arialbd.tff to it

some things I dont understand is why do the example graphs display and not the broadstairs grapghs?

shouldnt the broadstairs grapghs display at least the grapgh itself, even if the font is not avaliable? which would be a grapgh display without any text font’s? or do the broadstairs graph’s need the correct arial font even just to display the actual graph?

if the broadstairs graphs need the arial font, why wasnt it included as part of the package download, to make things easier?

well hopefully we cant figure this out and I can get it working, but for now I am stumped on what to do next

chris

I can’t believe you said that.

Here it is; chapter and verse by Mr. Broadstairs himself in a thread he started:

Quote:
"OK now for another fun bit - adding Arial fonts to JPGraph (if they dont already work).

  1. ask your hosting company for the full path to the directory on your server where you have your JPGraph directory (or ask yourself if you run your own server )

  2. create a directory somewhere in your path to contain the font files

  3. copy 4 files called arial.ttf arialbd.ttf arialbi.ttf and ariali.ttf to this directory (you should have them in the fonts directory on your Windows WD PC)

  4. make a backup copy of jpg-config.inc which is in your JPGraph directory do not skip this step

  5. open jpg-config.inc in your favourite editor and look for the section marked “// Directories for cache and font directory.” and in here you will find a line commented out which starts // DEFINE(“TTF_DIR”, you need to remove the // and change the line to look like

DEFINE(“TTF_DIR”,“/home/fhlinux/s/fred.org.uk/user/htdocs/jpgraph/fonts/truetype/”);

where the “/home/fhlinux/s/fred.org.uk/user/htdocs/jpgraph/fonts/truetype/” bit is the full path from 1 above plus the additional part to get to where you created the directory in 2 above. In this example the htdocs directory is where all my webserver files reside and I added fonts/truetype/ directories in my jpgraph directory which is where the 4 files reside from 3 above.

6 save the jpg-config.inc file and upload it back to your webserver in the JPGraph directory.

  1. take a deep breath and try your graphs out - they should work

Now if you run a Windows server either IIS or Apache I’m afraid you need to work out the paths and how to edit them with help from someone else as I only do Linux/Apache web servers

Stuart"

End Quote

some things I don't understand is why do the example graphs display and not the broadstairs graphs?
if you take a look at all of them, you will see some of them are missing => those that use ttf
shouldn't the broadstairs graphs display at least the graph itself, even if the font is not available?
no
if the broadstairs graphs need the arial font, why wasn't it included as part of the package download, to make things easier?
copyright

making graphs with jpgraph is not easy

I noticed

JpGraph Error Font file "/usr/X11R6/lib/X11/fonts/truetype/arialbd.ttf

are you sure you edited the jpg-config.inc.php correct

removed the two slashes in front of Define…path to font folder, because jpgraph is still looking for the font in the standard folder

or maybe there is some caching going on with your ISP

HELLO PINTO,

I found my path, using your hardpath.php…it is here:

http://www.gateway2capecod.com/jpgraph/src/ttf/hardpath.php

I entered that into the jpg-config.inc.php in the jpraph/src folder in the difine area and it looks like this:

/------------------------------------------------------------------------
// DEFINE(“CACHE_DIR”,“/tmp/jpgraph_cache/”);
// DEFINE(“TTF_DIR”,“/virtual/users/e14837-15290/web/jpgraph/src/ttf/”);
// DEFINE(“MBTTF_DIR”,“/usr/share/fonts/ja/TrueType/”);

do I need to remove the 2 slashes still??

(inside the wxgraph folder), inside the graphconfig.php do I leave the font line as this:

//$aFontFamily = “FF_ARIAL”;

or change it to this:

//$aFontFamily = “FF_FONT1”;

well I took a chance and decided to remove the 2 slash’s from below:

/------------------------------------------------------------------------
// DEFINE(“CACHE_DIR”,“/tmp/jpgraph_cache/”);
// DEFINE(“TTF_DIR”,“/virtual/users/e14837-15290/web/jpgraph/src/ttf/”);
// DEFINE(“MBTTF_DIR”,“/usr/share/fonts/ja/TrueType/”);

to look like this:

I entered that into the jpg-config.inc.php in the jpraph/src folder in the define area and it looks like this:

/------------------------------------------------------------------------
// DEFINE(“CACHE_DIR”,“/tmp/jpgraph_cache/”);
DEFINE(“TTF_DIR”,“/virtual/users/e14837-15290/web/jpgraph/src/ttf/”);
// DEFINE(“MBTTF_DIR”,“/usr/share/fonts/ja/TrueType/”);

and now have a look at this page:

http://www.gateway2capecod.com/wxgraphs/wxgraphs_test.html

You are still missing the other 3 ttf files in your ttf directory.

hello carseman,

i will get them also, and do the same as i did with the 1 I have there now.
no one said I needed all of them, but I guess I do. will post back later when finished

time for dinner now…thanks for your help also

everything is working now…I got the other arial fonts (all 4 of them)…WOOHOO!!

Have a look:

http://www.gateway2capecod.com/wxgraphs/wxgraphs_test.html

is it now safe to delete from my server… the examples folder?.. from the jpgraphs/src/examples folder? or do I need this?

are there any other folders within the jpgraphs folder I can delete?

hELLO Pinto,

…just wanted to say a Big Thank you for teaching me how to get all this working correctly, also a thank you to others that also helped out.

I think I am begining to understand it (a little bit anyways) and everything is now working nicely. I have mangaed to edit the graphconfig.php file, to change the colors of the grapgh’s to blue, which will match the color scheme of my website, when I eventually add the jpgraphs to it.

I noticed that on the bottom of some of the graph’s the time, set at the angle, which looks like this:

http://www.gateway2capecod.com/wxgraphs/baro_24hr.php

I wanted to know how or what I need to do to make them look like this?:

http://saa.ekiwx.net/clientraw/graphs/baro.php

(The above image is from someone else’s site)…do I need to edit something in the graphconfig.php? or do I need to edit something in the actual baro.php ? to change the bottom time look of the graph?

Thanks again , Chris

To change the orientation of the text on those graphs you need to edit the graph file itself. Not only will you need to change the text angle but you will also have to alter the actual text as well because I tilted it to fit in, your timestamps like 12:41AM will overlap each other, so its not a trivial job you need to get a hand on how JPGrpah works as well as PHP in general.

Stuart

is it now safe to delete from my server.. the examples folder?.. from the jpgraphs/src/examples folder? or do I need this?
it is safe to delete the Examles folder, you need the others

as for changing the look of your graphs, read Stuarts post above

You have to rewrite a part of each graph-file itself

or you can change
$label_angle = 0; // Use this to set the label angle for the 24hr graphs, and value between 0 and 90
$label_interval = 4; //This sets how often the xaxis labels should appear, normally 1 or 2
in graphsconf.php to set the x-axislabels horizontal and play with the interval

Hello Pinto and Broadstairs…thanks for the tip’s and I have managed to change the colors. I have also tested a few angle adjustments and time layout adjustments, and will eventually get the hang of it. so for now I am pretty much all set to go and all is working great. next step will be to incorporate these graphs somewhere on my website, but I know how to do that part, just have not decide where to fit them in on my site yet.one other thing I would also like to know is how I make the temp_humidty Graph display the Humidity with the colored in/light blue colored display, instead of it being two line plots only.

I also wanted to let you know I have made a jpgraph/wxgrapgh instructional/read me with directions from everything I had to do, to get these working. I made this instructional for anyone that wants to use the jpgraph’s/wxgraph’s ,that is unfamiliar with what needs to be done , in order to get them working. hopefully by reading my instructions, they can get theirs working in less time than it took me to figure it all out.
these instructions are meant for any Novice, like myself, and hopefully explain everything to get started.

I have included the instructions as a “txt” file below this message.There are special notes at the bottom also for doing specific thing’s.hopefully I have covered it all.

Perhaps these instructions can be rechecked by broadstairs and or Pinto, and if any thing should be added they can let me know.

It may even be a good idea, in the future, if something like this type of a read me/instructional was included into the actual wxgraph folder.

Thanks again, Chris


JPGraph Help.txt (2.62 KB)

I would also like to know is how I make the temp_humidty Graph display the Humidity with the colored in/light blue colored display, instead of it being two line plots only.
in temp_hum.php, find

// Set the colors for the plots
$lineplot->SetColor("red");
$lineplot->SetWeight(2);
$lineplot2->SetColor("lightblue");
$lineplot2->SetWeight(2);

you can add

 
$lineplot.->SetFillColor("[email protected]");

you can change the 0.8, but it must be between 0 and 1