cloudy cloudy

Author Topic: How to setup jpgraphs and wxgraphs  (Read 179975 times)

0 Members and 1 Guest are viewing this topic.

Offline Tim Hanko

  • Posts: 1,108
  • Grand Rapids, Michigan, USA
    • Walker, MI Weather
How to setup jpgraphs and wxgraphs
« on: November 02, 2007, 03:01:36 AM »
I just typed up an email to someone explaining all the steps to get jpgraphs working.

If anyone is interested:

1. Copy test.php (in the attached zip) to your web server root. Browse to it. It will tell you what version of php your web server supports, if any.

2. Scroll down the resulting page and make sure GD Support is enabled.

3. Go to the JPGraph home page and download the version appropriate to the version of PHP on your server, ie, 1.22 for PHP4 or 2.2 for PHP5.

4. Go to Broadstairs' home page to download the wxgraphs.zip file.

5. Edit graphsconf.php in the wxgraphs folder:
   a. Make sure these two lines point to the correct folders:

$hostloc = "${WEBROOT}/";                   //must have trailing slash
$jploc = "${WEBROOT}/jpgraph-1.22/src/";   //must have trailing slash

   b. Make any necessary changes to reflect the units you want to use. Directions are in the graphsconf.php file.

6. Create a new folder under jpgraph-x.xx called ttf.

7. Upload hardpath.php (in the attached zip) to the jpgraph-x.xx/ttf folder on your web server and browse to it.
   a. You'll get a line that looks something like:

/homepages/24/d87962498/htdocs/jpgraph-1.22/ttf/

8. Copy this line to the clipboard.

9. Edit jpg-config.inc.php in the jpgraph-x.xx/src folder:
   a. Uncomment the line that begins with DEFINE("TTF_DIR",". (Line 40 in my editor)
   b. Replace the default path with the result of browsing to hardpath.php.

10. Upload the jpgraph-x.xx folder to your web server. You do not need to upload the jpgraph-x.xx/docs folder.

11. Upload the wxgraphs folder to your web server.

12. Upload arialbd.ttf and arial.ttf from your /windows/fonts folder to /jpgraph-x.xx/ttf folder on the web server.

13. You should now be able to insert graphs by including image links to the files in the wxgraphs folder in your web pages.

   a. <img src="wxgraphs/rain_1hr.php /"> for example

14. Delete test.php from your web server when your graphs are working.

See mine at www.thanko.info/rainfall.php and http://www.thanko.info/trend_graphs.php.

hardpath.php is thanks to Pinto from this thread:

http://www.weather-watch.com/smf/index.php/topic,26379.0.html

Any comments, changes or suggestions are welcomed.
« Last Edit: September 06, 2015, 12:32:53 AM by niko »

Offline broadstairs

  • Stuart
  • Posts: 7,009
  • Broadstairs, Kent, UK
    • Broadstairs
Re: jpgraphs setup
« Reply #1 on: November 02, 2007, 09:54:52 AM »
Well done Tim, I was about to do something similar but you beat me to it.

Stuart

Please note the correct location for downloading the zip file is https://www.stella-maris.org.uk/code.phtml
« Last Edit: September 21, 2017, 08:35:25 AM by broadstairs »

Offline daveq

  • Posts: 3,098
  • Hollywood, MD
    • Hollywood - St. Mary's County, Maryland
Re: jpgraphs setup
« Reply #2 on: November 02, 2007, 12:56:12 PM »
Looks like a FAQ that would be helpful.  Maybe someone could make it one.

--Dave

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 27,428
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: jpgraphs setup
« Reply #3 on: November 02, 2007, 01:45:55 PM »
Looks like a FAQ that would be helpful.  Maybe someone could make it one.

--Dave

Funny you should mention that, Stuart and I had been discussing it too. The FAQ is defined as "Frequently Asked Questions about Weather Display", this very useful information doesn't fit that definition. I have made this topic a sticky at the top of this forum.

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 27,428
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: jpgraphs setup
« Reply #4 on: November 02, 2007, 01:52:45 PM »
Tim

I suggest adding a line about deleting test.php after it's used, I believe it's a security risk. You could change the title to something like "How to setup jpgraph" so it's clear this is informational rather than a question.

Offline Tim Hanko

  • Posts: 1,108
  • Grand Rapids, Michigan, USA
    • Walker, MI Weather
Re: How to setup jpgraphs and wxgraphs
« Reply #5 on: November 02, 2007, 01:56:14 PM »
Niko,

I've made the changes you suggested. Let me know if you like it better.

Whatever is appropriate, whether a faq or a sticky, is fine with me.

I'm happy to contribute something worthwhile.

Offline Tim Hanko

  • Posts: 1,108
  • Grand Rapids, Michigan, USA
    • Walker, MI Weather
Re: How to setup jpgraphs and wxgraphs
« Reply #6 on: November 03, 2007, 12:27:15 PM »
Niko,

I just noticed that you use in your avatar one of the coolest words in the English language.  :D

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 27,428
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
Re: How to setup jpgraphs and wxgraphs
« Reply #7 on: November 03, 2007, 02:11:58 PM »
Thanks for noticing  :lol:

Offline kewee

  • Posts: 71
Re: How to setup jpgraphs and wxgraphs
« Reply #8 on: January 04, 2008, 02:17:40 AM »
Could someone tell me where the wxgraph folder is. I have downloaded jpgraph-1.22 and unzipped it but cannot find a wxgraph folder.

Thanks,

Rick #-o

Offline Tim Hanko

  • Posts: 1,108
  • Grand Rapids, Michigan, USA
    • Walker, MI Weather
Re: How to setup jpgraphs and wxgraphs
« Reply #9 on: January 04, 2008, 03:04:29 AM »
You need to download wxgraphs from here:

http://www.stella-maris.org.uk/code.shtml

Probably should add that to the directions...

Offline kewee

  • Posts: 71
Re: How to setup jpgraphs and wxgraphs
« Reply #10 on: January 05, 2008, 02:02:55 AM »
Tim.

Thank you so much....

Rick

Offline kewee

  • Posts: 71
Re: How to setup jpgraphs and wxgraphs
« Reply #11 on: January 05, 2008, 02:37:14 AM »
Can someone give me some help on the coding for this. I am getting the error:

Parse error: parse error, unexpected '.' in /home/content/k/4/r/k4rcb/html/weather/wxgraph/graphsconf.php on line 7

wxgraph/graphsconf.php

$hostloc = "${./WEBROOT}/";                   //must have trailing slash
$jploc = "${./WEBROOT}/jpgraph-1.22.5/src/";   //must have trailing slash

clientraw files and jpgraph-1.22/src are in the ./weather folder.

Thanks again for your help,

Rick

Offline Tim Hanko

  • Posts: 1,108
  • Grand Rapids, Michigan, USA
    • Walker, MI Weather
Re: How to setup jpgraphs and wxgraphs
« Reply #12 on: January 05, 2008, 02:41:56 AM »
Kewee,

Remove the . before WEBROOT in both lines.

Offline kewee

  • Posts: 71
Re: How to setup jpgraphs and wxgraphs
« Reply #13 on: January 05, 2008, 03:18:31 AM »
Tim,

Sorry the ./ was removed. Typo on my part.

These are the errors:

Warning: main(/home/content/k/4/r/k4rcb/html/jpgraph-1.22.5/src/jpgraph.php): failed to open stream: No such file or directory in /home/content/k/4/r/k4rcb/html/weather/wxgraph/baro_24hr.php on line 4

Warning: main(/home/content/k/4/r/k4rcb/html/jpgraph-1.22.5/src/jpgraph.php): failed to open stream: No such file or directory in /home/content/k/4/r/k4rcb/html/weather/wxgraph/baro_24hr.php on line 4

Warning: main(): Failed opening '/home/content/k/4/r/k4rcb/html/jpgraph-1.22.5/src/jpgraph.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/content/k/4/r/k4rcb/html/weather/wxgraph/baro_24hr.php on line 4

Warning: main(/home/content/k/4/r/k4rcb/html/jpgraph-1.22.5/src/jpgraph_line.php): failed to open stream: No such file or directory in /home/content/k/4/r/k4rcb/html/weather/wxgraph/baro_24hr.php on line 5

Warning: main(/home/content/k/4/r/k4rcb/html/jpgraph-1.22.5/src/jpgraph_line.php): failed to open stream: No such file or directory in /home/content/k/4/r/k4rcb/html/weather/wxgraph/baro_24hr.php on line 5

Warning: main(): Failed opening '/home/content/k/4/r/k4rcb/html/jpgraph-1.22.5/src/jpgraph_line.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/content/k/4/r/k4rcb/html/weather/wxgraph/baro_24hr.php on line 5

Fatal error: Cannot instantiate non-existent class: graph in /home/content/k/4/r/k4rcb/html/weather/wxgraph/baro_24hr.php on line 32

The page is http://www.dominion-llc.com/weather/wxgraph/baro_24hr.php

As you can see I am very much a novice at PHP.

Thanks,

Rick

Offline dafuser

  • Posts: 571
  • Granbury, Texas
    • Weather from the shores of Lake Granbury
Re: How to setup jpgraphs and wxgraphs
« Reply #14 on: January 05, 2008, 05:04:20 AM »
Kewee,

Remove the . before WEBROOT in both lines.
I'm also having a problem.  My clientraw files, jpgraph,  and wxgraphs are all located at /wx/
My config files is set as follows:

//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}/wx/jpgraph-1.22/src/";   //must have trailing slash

If I try to load a image from the wxgraphs directory I get a page not found error. I can see the file is there when I ftp to the same directory. Any idea what I did wrong?

http://www.lesdiefenbach.org/wx/wxgraphs/rain_1hr.php


--
Thanks Les  de NA5AA

Microsoft Windows: Proof that P.T. Barnum was correct.

24 inch iMac 2.8GHz, 4 GB Ram (OS X 10.8.3 Mountain Lion) Davis Vantage Vue