Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.5 (build 3282) - 23 February 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Server Generated Graphs for MX

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

jlmr731
Posts: 225
Joined: Sat 27 Aug 2016 12:11 am
Weather Station: Davis vantage pro 2
Operating System: Debian
Location: Wickliffe, Ohio
Contact:

Re: Server Generated Graphs for MX

Post by jlmr731 »

Thank you so much for the help.
This was all on me too, and it was not the graphSettings.php it turned out to be my db_ro_details.php that i copied and pasted off mysql site so there was a few extra lines at the end, I would have never guessed that it would effect the script in that way.
so it is working great now and looks great.
Now after i get more data off my new weather station ill have to learn how you did your graphs_historic.php on your site. That is a work of art and probably one of the best graphs i have seen anywhere.

Thanks again
Cheers
Jeff
User avatar
SJG1976
Posts: 365
Joined: Wed 21 Dec 2011 11:04 am
Weather Station: Davis WLL, with Airlink
Operating System: Raspberry Pi3 MX on USB Drive
Location: Glemsford, Suffolk
Contact:

Re: Server Generated Graphs for MX

Post by SJG1976 »

I'm also having problems getting this to work.

I keep getting an Error about the

Fatal error: Uncaught Error: Class 'WindroseGraph' not found in

(The Class is refering to whatevere Graph I'm trying to do)

I've found it relates to the line on the (for example on graphWindrose.php)

Code: Select all

$graph = new WindroseGraph($GRAPH['roseSize'], $GRAPH['roseSize'], $name, $GRAPH['cachetime']);
Also running nay examples from the JPGrapgs I get a similar Error.

I've probably missed a Script somewhere, but can't see where.

I've done the following.

./images/SQL
Copied all the SQL Files Across
Added the JPGraphs Download Here as well

When trying to run the file direct I get an error about the missing class.
Have I missed a script file to be installed somewhere?

I'm not very good at this, only just managed to get my SQL Upload working yesterday..
User avatar
SJG1976
Posts: 365
Joined: Wed 21 Dec 2011 11:04 am
Weather Station: Davis WLL, with Airlink
Operating System: Raspberry Pi3 MX on USB Drive
Location: Glemsford, Suffolk
Contact:

Re: Server Generated Graphs for MX

Post by SJG1976 »

Think I've worked it out.

I needed to change the path to my in my graphsettings.php file from

Code: Select all

$GRAPH['jpgraphloc']     = '/homepages/directory/directory/htdocs/images/SQL/'; // Path to jpgraph, or put it in your PHP path
the

Code: Select all

$GRAPH['jpgraphloc']     = '/images/SQL/'; // Path to jpgraph, or put it in your PHP path
I'm also struggling to get the .htaccess file to work as expected, so changing the various .pngs in the gauges.js to be the .php files instead.

I'm sure there is an easier way, but at the moment I'm not getting anywhere fast.
Any pointers helpfully recieved
User avatar
SJG1976
Posts: 365
Joined: Wed 21 Dec 2011 11:04 am
Weather Station: Davis WLL, with Airlink
Operating System: Raspberry Pi3 MX on USB Drive
Location: Glemsford, Suffolk
Contact:

Re: Server Generated Graphs for MX

Post by SJG1976 »

Finally got them working to a fashion.

In all my messing around I changed the PHP Version on the Web Host.
Which then knocked out my SQL Uploads.

So the Realtime table has a large chunk of data missing from it.

Anyway all sorted now.

Should have been more patient.
Still didn't manage to get the .htaccess file to work though.

On to the next next thing for me to break now..... :)
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Server Generated Graphs for MX

Post by Phil23 »

water01 wrote:I think so. I have got all the others working once I got my head around the .htaccess and what it did and more importantly where it should be!!
I'm in the same boat, not understanding .htaccess and also where it should be placed.
It didn't help that I set up a directory called jgraph rather than jpgraph!!!!! Couldn't understand why it couldn't find the code, my eyes just did not see the missing p. Sat there for nearly 20 minutes trying to figure out why it couldn't find the includes!!!!!!
Fell into the dame trap here, named mine jpgraphs, with an "S".

For now it's working, but I have edited gauges.js, which will mean it will break at the next update & need editing again.

Can someone please explain what I need to do with .htaccess so I can use the default gauges.js again?

Thanks

Phil.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Server Generated Graphs for MX

Post by Phil23 »

Phil23 wrote:Can someone please explain what I need to do with .htaccess so I can use the default gauges.js again?
Think I've resolved that. .htaccess in the images directory anlong with the scripts.

Only unresolved thing now is the squashed Wind rose.

Can't find an answer yet on that. Is it related to changing the size of the tip?
If so where do I do that?


Thanks.
Phil.
Capture.JPG
You do not have the required permissions to view the files attached to this post.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
User avatar
ConligWX
Posts: 1565
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Post by ConligWX »

in the OP it mentions:

Note: The get the Wind Rose plot working correctly, I had to add the arial.ttf and verdana.ttf font files to the JPGraphs font folder.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
User avatar
mcrossley
Posts: 12641
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley »

Phil23 wrote:
Phil23 wrote:Can someone please explain what I need to do with .htaccess so I can use the default gauges.js again?
Think I've resolved that. .htaccess in the images directory anlong with the scripts.

Only unresolved thing now is the squashed Wind rose.

Can't find an answer yet on that. Is it related to changing the size of the tip?
If so where do I do that?


Thanks.
Phil.

Capture.JPG
Sorry, been too busy to keep up the forum lately...

Yes, the gauges use a single image size defined in gauges.css for all the graphs. They aren't designed for the MX windrose plot.

edit: content deleted!

Someone documented this on the forum before - but a quick search failed to find it :(

edit: It was me! Here it is! https://cumulus.hosiene.co.uk/viewtopic.p ... 27#p120027
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Server Generated Graphs for MX

Post by Phil23 »

mcrossley wrote: Sorry, been too busy to keep up the forum lately...
No apology required, everyone always has a life outside of forum, & it seems never contain enough hours.
Yes, the gauges use a single image size defined in gauges.css for all the graphs. They aren't designed for the MX windrose plot.

Someone documented this on the forum before - but a quick search failed to find it :(

edit: It was me! Here it is! https://cumulus.hosiene.co.uk/viewtopic.p ... 27#p120027
Yes, I have looked at that thread,
Insert in the ddimgtooltip.init() function almost at the end of the script - after the $targets.each() loop
Is what I am struggling with, due to my lack of knowledge of the structuring of Java; }, ) & ; , I'm still not sure of exactly what they define....

Edit:

Finally got it!

For the benefit of other like me who struggle with javascript, I added it to line 4209 of the current gauges.js, (2.5.18).

It's working for me like this...

Code: Select all

            $targets.each(function () {
                var $target = $(this),
                    tipsuffix, tipid,
                    $tooltip;
                var ind = ($target.attr('id').match(/_(\d+)/) || [])[1] || ''; //match d of attribute id='tip_d'
                tipsuffix = parseInt(ind, 10); //get d as integer
                tipid = this.tipid = ddimgtooltip.tipprefix + tipsuffix; //construct this tip's ID value and remember it
                $tooltip = ddimgtooltip.createtip($, tipid, tiparray[tipsuffix]);

                $target.mouseenter(function (e) {
                    var $tooltip = $('#' + this.tipid);
                    //ddimgtooltip.showbox($, $tooltip, e);
                    ddimgtooltip.delaybox($, $tooltip, e);
                });
                $target.mouseleave(function () {
                    var $tooltip = $('#' + this.tipid);
                    ddimgtooltip.hidebox($, $tooltip);
                });
                $target.mousemove(function (e) {
                    var $tooltip = $('#' + this.tipid);
                    ddimgtooltip.positiontooltip($, $tooltip, e);
                });
                if ($tooltip) { //add mouseenter to this tooltip (only if event hasn't already been added)
                    $tooltip.mouseenter(function () {
                        ddimgtooltip.hidebox($, $(this));
                    });
                }
            });
			$('#imgtip10_img').css({width: 400, height: 400}); //Re-size WindRose tip
        }
    };
Phil.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
User avatar
ConligWX
Posts: 1565
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Post by ConligWX »

Thanks for the tips, Phil23, I've given up on the graphs popups, the scripting is obviously not fully compatible with PP 7.1.1.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Server Generated Graphs for MX

Post by Phil23 »

Though I'd try changing one of these to a Spline.

Turned up not as simple as I thought.

Made these changes, basically changing lineplot to spline.

Code: Select all

<?php
/*!
 * Simple static trend graphs for Cumulus MX
 *
 * Created by Mark Crossley, January 2015
 *
 * Released under GNU GENERAL PUBLIC LICENSE, Version 2, June 1991
 * See the enclosed License file
 *
 * File encoding = UTF-8
 *
 */

require_once 'graphSettings.php';

$name = basename($_SERVER['PHP_SELF'], '.php').'.png';

// Create the graph and set a scale.
$graph = new Graph($GRAPH['width'], $GRAPH['height'], $name, $GRAPH['cachetime']);
$graph->SetScale('datlin');

//fetch the data
$data = get_data('wind');

graph_common($graph);

$graph->title->Set('Wind (' . $data['units'] . ')');

// Create the linear plot
$spline1 = new Spline($data['wspeed'], $data['time']);
$spline1->SetWeight(2);
$spline1->SetLegend('Average speed');

$spline2 = new Spline($data['wgust'], $data['time']);
$spline2->SetWeight(2);
$spline2->SetLegend('Wind Gust');

$graph->xaxis->scale->setAutoMin(0);
$graph->yaxis->scale->SetGrace(5, 0);

// Add the plot to the graph
$graph->Add($spline2);
$graph->Add($spline1);

$spline1->SetColor("#B22222:1.3");
$spline2->SetColor("#2222B2:1.3");

// Display the graph
@unlink(CACHE_DIR . $name);
$graph->Stroke();

?>
Read that you needed to include jpgraph_regstat.inc.php, which doesn't exist, only a jpgraph_regstat.php, so tried that.

Code: Select all

############################################################################
# Includes for JpGraph
############################################################################
include $GRAPH['jpgraphloc'] . 'jpgraph.php';
include $GRAPH['jpgraphloc'] . 'jpgraph_line.php';
include $GRAPH['jpgraphloc'] . 'jpgraph_scatter.php';
include $GRAPH['jpgraphloc'] . 'jpgraph_date.php';
include $GRAPH['jpgraphloc'] . 'jpgraph_plotline.php';
include $GRAPH['jpgraphloc'] . 'jpgraph_windrose.php';
include $GRAPH['jpgraphloc'] . 'jpgraph_regstat.php'; //Added to try & get Spline to work.
But when I try opening http://weather.inverellit.com/images/graphWind2.php I get this message:-
Warning: Division by zero in /home/inv49478/public_html/weather/jpgraph/jpgraph_regstat.php on line 51
JpGraph Error: 19002 Invalid input data for spline. Two or more consecutive input X-values are equal. Each input X-value must differ since from a mathematical point of view it must be a one-to-one mapping, i.e. each X-value must correspond to exactly one Y-value.
Any thoughts? Trying to read the docs, some of the terms don't click with me.

Thanks

Phil.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
User avatar
ConligWX
Posts: 1565
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Post by ConligWX »

Just looking at my graphs, I noticed that the graphsolar.php and graphTempOut.php are not showing the correct Symbols for Temp or W/m

is this due to the Font type perhaps and if so where do I change font for the Graphs?
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
User avatar
mcrossley
Posts: 12641
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Server Generated Graphs for MX

Post by mcrossley »

When you edited the settings file, did you do it with a decent editor that saved it in the same format as the original - UTF8?
User avatar
ConligWX
Posts: 1565
Joined: Mon 19 May 2014 10:45 pm
Weather Station: Davis vPro2+ w/DFARS + AirLink
Operating System: Ubuntu 22.04 LTS
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Post by ConligWX »

Yep all the Graph*.php files are UTF8, and I used Notepad++

Image

as you see Temperature should show (°C) so I was thinking perhaps is it the Font that cannot display certain Ascii Codes.
Regards Simon

https://www.conligwx.org - @conligwx
Davis Vantage Pro2 Plus with Daytime FARS • WeatherLink Live • Davis AirLink • PurpleAir •

Image
Herbaldew
Posts: 113
Joined: Sun 12 Mar 2017 8:33 pm
Weather Station: VP2+
Operating System: Raspberry Pi OS (64-bit)
Location: US Mid-Atlantic

Re: Server Generated Graphs for MX

Post by Herbaldew »

Can one make the popup graphs work on the CMX interface (running on rPi)?

There is enough information here that I think I could bumble my way through setting them up for a web site. Thing is I don't do a web site and just use the interface in house.

Thanks.
Post Reply