If you use Cumulus, please donate Image

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post 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.
jlmr731
Posts: 88
Joined: Sat Aug 27, 2016 12:11 am
Weather Station: Davis vantage pro 2
Operating System: Linux Ubuntu / windows 10
Location: Youngstown, Ohio
Contact:

Re: Server Generated Graphs for MX

Postby jlmr731 » Fri Sep 16, 2016 8:52 pm

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: 216
Joined: Wed Dec 21, 2011 11:04 am
Weather Station: Oregon WRM200 and Davis VP1
Operating System: Raspberry Pi3, Raspberry Pi
Location: Essex
Contact:

Re: Server Generated Graphs for MX

Postby SJG1976 » Thu Dec 29, 2016 4:22 pm

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..
Image

User avatar
SJG1976
Posts: 216
Joined: Wed Dec 21, 2011 11:04 am
Weather Station: Oregon WRM200 and Davis VP1
Operating System: Raspberry Pi3, Raspberry Pi
Location: Essex
Contact:

Re: Server Generated Graphs for MX

Postby SJG1976 » Thu Dec 29, 2016 9:08 pm

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
Image

User avatar
SJG1976
Posts: 216
Joined: Wed Dec 21, 2011 11:04 am
Weather Station: Oregon WRM200 and Davis VP1
Operating System: Raspberry Pi3, Raspberry Pi
Location: Essex
Contact:

Re: Server Generated Graphs for MX

Postby SJG1976 » Fri Dec 30, 2016 12:52 am

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..... :)
Image

Phil23
Posts: 111
Joined: Sat Jul 16, 2016 11:59 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Win7 Pro
Location: Australia

Re: Server Generated Graphs for MX

Postby Phil23 » Mon Jan 30, 2017 6:01 am

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.

Phil23
Posts: 111
Joined: Sat Jul 16, 2016 11:59 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Win7 Pro
Location: Australia

Re: Server Generated Graphs for MX

Postby Phil23 » Mon Jan 30, 2017 7:03 am

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.

User avatar
Toxic17
Posts: 378
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.0 Stretch
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Postby Toxic17 » Mon Jan 30, 2017 8:29 am

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
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

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

Re: Server Generated Graphs for MX

Postby mcrossley » Mon Jan 30, 2017 7:26 pm

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! viewtopic.php?f=21&t=15503&p=120027#p120027

Phil23
Posts: 111
Joined: Sat Jul 16, 2016 11:59 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Win7 Pro
Location: Australia

Re: Server Generated Graphs for MX

Postby Phil23 » Mon Jan 30, 2017 8:27 pm

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! viewtopic.php?f=21&t=15503&p=120027#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.

User avatar
Toxic17
Posts: 378
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.0 Stretch
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Postby Toxic17 » Tue Jan 31, 2017 8:36 am

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
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

Phil23
Posts: 111
Joined: Sat Jul 16, 2016 11:59 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Win7 Pro
Location: Australia

Re: Server Generated Graphs for MX

Postby Phil23 » Fri Feb 03, 2017 9:23 pm

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.

User avatar
Toxic17
Posts: 378
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.0 Stretch
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Postby Toxic17 » Sat Mar 18, 2017 5:20 pm

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
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image

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

Re: Server Generated Graphs for MX

Postby mcrossley » Sat Mar 18, 2017 5:28 pm

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
Toxic17
Posts: 378
Joined: Mon May 19, 2014 10:45 pm
Weather Station: Davis Vantage Pro2 Plus
Operating System: Debian 9.0 Stretch
Location: Bangor, NI
Contact:

Re: Server Generated Graphs for MX

Postby Toxic17 » Sat Mar 18, 2017 11:53 pm

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
https://www.conligwx.org/pws/
Davis Vantage Pro2+ - CumulusMX v3.0.0 (build 3043) + Saratoga/PWS
Image


Return to “Cumulus MX”

Who is online

Users browsing this forum: HPaukert, Phil23, sutne and 1 guest