Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See the Wiki for download

Server Generated Graphs for MX

Discussion of version 3 of Cumulus, which runs on Windows, Linux, and OS X. All Cumulus MX queries in here, please.
User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Sat Jan 09, 2016 4:34 pm

Great stuff, I have a version that works with MySQL as well now (http://weather.wilmslowastro.com/images/windrose.png)

I think you have one step missing, you need to add an include to graphSettings.php...

Code: Select all

include $GRAPH['jpgraphloc'] . "jpgraph_windrose.php";
I had to add arial.ttf and verdana.ttf to the jpgraphs/fonts folder.

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Sat Jan 09, 2016 9:04 pm

With Marks permission, I have added his WindRose script to the overall package, so you can download from the GitHub repository.

Thanks again Mark.

forestedge
Posts: 49
Joined: Sun Jul 29, 2012 11:46 am
Weather Station: Davis Vantage Pro2 Plus
Operating System: Windows 10 64 bit
Location: Ashurst Bridge, Hampshire UK
Contact:

Re: Server Generated Graphs for MX

Post by forestedge » Tue Jan 26, 2016 8:56 pm

You need to edit the JPGraph config file to enable caching and point it at your cache folder. Then edit the graphSettings.php script and set the cache folder and jpgraph fodler locations in there.
I am struggling to set up the popup graphs and could not see the graphsettings.php script anywhere when downloaded and at the moment no graphs are generated in the cache.
I have uploaded jpgraphs package and defined as below in Windows 7, not sure if this is correct though!

define('CACHE_DIR','/public_html/cache'/');
define('TTF_DIR','/public_html/font'/');
define('USE_CACHE',true);
//('MBTTF_DIR','/usr/share/fonts/TrueType/');//

I also tried changing the website MX gauge colours in the MX gauges.js like I have with Cumulus 1 and they did not display so I had to revert to the default colours.

Any assistance appreciated.

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Tue Jan 26, 2016 9:51 pm

forestedge wrote: I am struggling to set up the popup graphs and could not see the graphsettings.php script anywhere when downloaded and at the moment no graphs are generated in the cache.
graphSettings.php is part of the download from this thread, not JPGraphs.
forestedge wrote: I have uploaded jpgraphs package and defined as below in Windows 7, not sure if this is correct though!

define('CACHE_DIR','/public_html/cache'/');
define('TTF_DIR','/public_html/font'/');
define('USE_CACHE',true);
//('MBTTF_DIR','/usr/share/fonts/TrueType/');//
I'd put the full path in, e.g. something like C:/web/public_html/cache/

But you seem to have an extra quote character before the final / at the end of each path above.

UncleBuck
Posts: 36
Joined: Sat Dec 29, 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

I am stumped! Please help me if you can.

Post by UncleBuck » Fri Jan 29, 2016 1:24 am

I am at a loss getting these to work on my site......

This is what I have:

Code: Select all

jpgraph.php
(as downloaded)

jpg-config.inc.php
 define('CACHE_DIR',$_SERVER["DOCUMENT_ROOT"].'/site-utils/jpgraph/cache/');
 define('TTF_DIR',$_SERVER["DOCUMENT_ROOT"].'/site-utils/jpgraph/Fonts/');
 define('MBTTF_DIR',$_SERVER["DOCUMENT_ROOT"].'/site-utils/jpgraph/Fonts/');

.httaccess
(as downloaded) and placed in the images folder.

gauges.js
imgPathURL        : 'images/',
Now the problem:
Trying the JpGraph examples testsuit.php shows no images (except one) and one error in the server logs which is
PHP Fatal error: require_once(): Failed opening required 'jpgraph/jpgraph_odo.php' (include_path='.:')
(Take a look for yourself at http://www.pcweather.kcsolutions.com.au ... stsuit.php)
Of the 559 tests, only 36 images are created in the cache.
Test 6 result shows an image BUT it is not in the cache.

Trying the gauges-ss-basic.htm file (http://www.pcweather.kcsolutions.com.au ... -basic.htm) produces 9 images in the cache BUT the log file shows an "Undefined index: uom" error in the graphWind.php file.
Calling any image directly from the images folder such as http://www.pcweather.kcsolutions.com.au/images/temp.png results in the image being created in the cache but not displayed on screen (indicating that the .httaccess is working correctly).

Any ideas as to what the problem may be would be greatly appreciated.

Colin.

Further investigation has shown the following:
Even though the image gets created in the cache folder when you call http://www.pcweather.kcsolutions.com.au ... aphhum.php, if you do this using Firefox it displays the message
The image “http://www.pcweather.kcsolutions.com.au ... aphhum.php” cannot be displayed because it contains errors.
If you call the direct link to the cached image using Firefox (i.e. http://www.pcweather.kcsolutions.com.au ... aphhum.png) then it displays the image as it should.
Last edited by UncleBuck on Sat Jan 30, 2016 7:20 am, edited 1 time in total.

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Fri Jan 29, 2016 10:41 am

Very odd, it does look like the web server is doing something odd to the data. As you say, jpgraphs seems to be generating the image correctly, but what the web server is sending out can not be interpreted as an image by the browser. No ideas really!

mwittl
Posts: 3
Joined: Sun Dec 08, 2013 11:51 am
Weather Station: Vantage Vue
Operating System: Windows 10
Location: Roanoke, VA (USA)
Contact:

Re: Server Generated Graphs for MX

Post by mwittl » Fri Jan 29, 2016 10:52 am

What happens if you don't use the JPGraph Cache but instead let each request generate the graph? Have you tried that? I don't even bother with the cache...unless you have thousands of hits/hr on your site, pretty much any web service provider can handle the php load.

- Mark Wittl

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Fri Jan 29, 2016 1:02 pm

After looking at Steve's web site today, I have made a small change to the wind direction graph - it now plots the average direction on top of the instant direction. I made this change to the copy on my web server some time ago and forgot to include it in the distribution. Only the graphWdir.php files have changed.

UncleBuck
Posts: 36
Joined: Sat Dec 29, 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: Server Generated Graphs for MX

Post by UncleBuck » Sat Jan 30, 2016 12:35 am

Well I finally managed to get most things working.
I had to resort to moving the jpgraph folder out of the site-utils folder and putting all the jpgraph files into a SRC folder under that.


Now the only remaining problem seems to be that the fonts are not being recognised for the windrose static graph on the trends page at http://www.pcweather.kcsolutions.com.au/wxtrends.php
They are WAY to small to read.

Any ideas on that one?

Colin.

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Sat Jan 30, 2016 11:42 am

Probably missing fonts - I had to add arial.ttf and verdana.ttf to the jpgraphs/fonts folder to get the Wind Rose working.
(A bit further up the thread)

UncleBuck
Posts: 36
Joined: Sat Dec 29, 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: Server Generated Graphs for MX

Post by UncleBuck » Sat Jan 30, 2016 11:44 am

So I have noticed a couple of other problems that I need some advice with.....

My wind graph (http://www.pcweather.kcsolutions.com.au/images/wind.png) does not show any units in the title. Looking at the original "graphwind.php" file it showed the line

Code: Select all

$graph->title->Set('Wind (' . $GRAPH['uom']['wind']. ')');
whereas all the other files where units were being passed were using this

Code: Select all

$graph->title->Set('Barograph (' . $data['units']. ')');
so I changed it to read

Code: Select all

$graph->title->Set('Wind (' . $GRAPH['units']. ')');
the php log (before the change) was showing "Undefined index: uom in .........." and now it shows an error "Undefined index: units in ............." so obviously this did not resolve the issue.
Question: Is it possible that the problem is caused by using the units km/h?

Next problem.....
Both temp graphs show an extra character in the title (see http://www.pcweather.kcsolutions.com.au/images/temp.png) which is not in the actual php file

Code: Select all

$graph->title->Set('Temperature (°' . $data['units']. ')');
That one I have no idea on why it would do that as it appears before the degree symbol.

Any ideas.... anyone?

Col.

UncleBuck
Posts: 36
Joined: Sat Dec 29, 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: Server Generated Graphs for MX

Post by UncleBuck » Sat Jan 30, 2016 11:45 am

mcrossley wrote:Probably missing fonts - I had to add arial.ttf and verdana.ttf to the jpgraphs/fonts folder to get the Wind Rose working.
(A bit further up the thread)
Sorry, nope, not that.... I have confirmed that are both there.

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Sat Jan 30, 2016 11:59 am

UncleBuck wrote:So I have noticed a couple of other problems that I need some advice with.....

My wind graph (http://www.pcweather.kcsolutions.com.au/images/wind.png) does not show any units in the title. Looking at the original "graphwind.php" file it showed the line

Code: Select all

$graph->title->Set('Wind (' . $GRAPH['uom']['wind']. ')');
whereas all the other files where units were being passed were using this

Code: Select all

$graph->title->Set('Barograph (' . $data['units']. ')');
so I changed it to read

Code: Select all

$graph->title->Set('Wind (' . $GRAPH['units']. ')');
the php log (before the change) was showing "Undefined index: uom in .........." and now it shows an error "Undefined index: units in ............." so obviously this did not resolve the issue.
Question: Is it possible that the problem is caused by using the units km/h?
it should read $data['units'] - I'll change the source code...
UncleBuck wrote:Next problem.....
Both temp graphs show an extra character in the title (see http://www.pcweather.kcsolutions.com.au/images/temp.png) which is not in the actual php file

Code: Select all

$graph->title->Set('Temperature (°' . $data['units']. ')');
That one I have no idea on why it would do that as it appears before the degree symbol.

Any ideas.... anyone?

Col.
If you have edited the file, did you save it as UTF-8 (without MOB)?

UncleBuck
Posts: 36
Joined: Sat Dec 29, 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: Server Generated Graphs for MX

Post by UncleBuck » Sat Jan 30, 2016 12:12 pm

It was showing the weird character before I modified the code. So I don't think that was the issue.

User avatar
mcrossley
Posts: 5209
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley » Sat Jan 30, 2016 12:31 pm

Your solar graph has the same problem, it too has an extended character in it - try sending the files to the web server again, but force your client to send them as binary, it may be sending them as 'text files' and helpfully changing the encoding for you.

Post Reply