I have done a major rework of the graphs which have been circulating. At present I’m still doing a bit of testing and would like views on how they look now.
Major change under the covers is that there is now a config file which allows not only file paths to be set but also all of the value conversions for USA/Metric changes in one place. It also allows several other things to be configured in one place. The other significant change is that the 24 hour graphs now use the time values from the clientraw files as these graphs change every 10 minutes. Also the standard font is now Arial since the in built fonts do not allow for rotation. It is quite easy to setup JPGraph to use this font if the standard JPGraph installation does not find it.
Please take a look here and let me know what you think, also if you would be interested in my providing the source.
Thanks for all the comments. I decided to change the time axis on the 24hr graphs because WD updates these values (yes actually re-calculates them) every ten minutes when the clientrawextra.txt is uploaded, so having just the hour is very misleading. Changing the angle is easy for these times, I’ll try it and see what it looks like. I did not want to remove the minutes and have it as it was before because of this constant updating.
Tom I will indeed zip and upload them but I still have a bit more testing to do and a bit more clean up of the code (also adding a few more comments) once this is done I’ll post the source. There may be one or two more options I can move to the config file also.
Note that you do have to have the Arial font family installed to use these graphs, and that means editing the JPGraph config file if they are not already installed in the correct place for JPGraph. Using internal fonts is NOT an option.
Also at present JPGraph (neither V1 or V2) does not work with variables for the font family and font style names, I did want to have these as options in the config file but at present they will not work. If anyone can find out a way of doing this I’d be very interested.
Take another look here as I have tilted the times on the 24hr graphs. The angle and how many ticks you show on the x axis labels are now options in the config file.
According to the docs for JPGraph you should be able to use the internal fonts at 0 and 90 degrees, but they would not work for me! Anyway I prefer the Arial font
It’s quite interesting to note that the 24hr graphs appear to take (on my slow WD PC) nearly 3 minutes to recalculate all the values every ten minutes which shows the load this puts on the PC. I’m not convinced that WD should really do the calculations this way, but that today is the way it works…
OK guys here are the files. Please remember a few things:-
the default font family in all these graphs is ARIAL, so you need this to work with your JPGraph installation. If it cannot find the font you need to read the JPGraph docs carefully and modify your installation to add the relevant font files.
edit the graphconf file to at least select your correct path to the clientraw and JPGraph files for you system.
dont change it all at once unless you are sure you know what you are doing
let me know if you have problems and I’ll do my best to help (remember its nearly my bed time now so I might not reply till morning)
OK now for another fun bit - adding Arial fonts to JPGraph (if they dont already work).
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 :roll:)
create a directory somewhere in your path to contain the font files
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)
make a backup copy of jpg-config.inc which is in your JPGraph directory do not skip this step :roll: :roll:
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
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.
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 :roll:
Hi Stuart…I am having no luck at all.
My old graphs worked fine. I changed the graphsconf.php to the appropriate $hostloc and $jploc to match the appropriate locations (the same as my other graph files) and no good.
I have the arial font installed.
I even went through a couple of the graph files changing ARIAL to FF_FONT1.
I just get a heap of red crosses. #-o
Well try pointing at one graph file directly from the address bar on the browser rather than trying to use the test page. You may then see an error message. There is also a useful thing in the jpgraph jpg-config.inc which turns on showing php errors within a graph window (cant remember what its called) but I have that turned on on my test server and sometimes that helps as you get a graphic image with the php error displayed as text within it.
Also if you have access to the web server log files you might see an error there, if its a catastrophic error it may never get back to the browser.
I have narrowed the problem down further…
I have been editing the month_baro.php file so that I do not need this line…
All the variables in the month_baro.php file that would have come from graphsconf.php have been replaced with the appropriate values. I also added the function (function get_raw…etc) in so that it could read the clientraw file and it works!
I just can’t get it to work when using Include (“graphsconf.php”).
Another thing I tried, which might give a clue is, copy the entire contents of the graphsconf.php file to the beginning of month_baro.php file in replace of the Include (“graphsconf.php”) line. This should work, should it not?
I get the error as attached.
HTTP Error 401.5 - Unauthorized: Authorization failed by an ISAPI/CGI application.
Internet Information Services (IIS)
Ah well you are using Windows and IIS and I suspect you have a problem with your permissions. This is an area I have no experience of I avoid Windows/IIS like the plague! Sorry :roll:
At a guess (and it is only a guess) it could in part be to do with where you decided to place your files. In an Linux/Apache install I would not place PHP files in a CGI directory since these are usually more protected, I usually place all PHP files in with the normal web page directory structure. Your problem does sound like an issue with permisions which moving the files MIGHT bypass.
Anyone with Windows/IIS experience care to chime in here and dig me out of a hole #-o
Had a few minutes and google’d on this error, it does indeed seem to be a permissions thing, but I’m afraid IIS is beyond me I’ve never even looked at it… just one example result here …
I was also getting problems displaying the graphs on a linux/apache setup. Individual graphs would give a jpgraph error message saying that headers had already been sent by graphsconf.php. Copying the contents of graphsconf.php into individual files worked.
I could not see any problem with graphsconf.php, but I thought it might be worth reinstalling all the files again - hey presto! it worked. I must have introduced an extra character or space when originally editing graphsconf.php. It might be worth a try. IIS may be interpreting the “double headers” as an authentication problem. (Just a guess)