Page 12 of 18

Re: Server Generated Graphs for MX

Posted: Fri 16 Sep 2016 8:52 pm
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

Re: Server Generated Graphs for MX

Posted: Thu 29 Dec 2016 4:22 pm
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..

Re: Server Generated Graphs for MX

Posted: Thu 29 Dec 2016 9:08 pm
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

Re: Server Generated Graphs for MX

Posted: Fri 30 Dec 2016 12:52 am
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..... :)

Re: Server Generated Graphs for MX

Posted: Mon 30 Jan 2017 6:01 am
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.

Re: Server Generated Graphs for MX

Posted: Mon 30 Jan 2017 7:03 am
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

Re: Server Generated Graphs for MX

Posted: Mon 30 Jan 2017 8:29 am
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.

Re: Server Generated Graphs for MX

Posted: Mon 30 Jan 2017 7:26 pm
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

Re: Server Generated Graphs for MX

Posted: Mon 30 Jan 2017 8:27 pm
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.

Re: Server Generated Graphs for MX

Posted: Tue 31 Jan 2017 8:36 am
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.

Re: Server Generated Graphs for MX

Posted: Fri 03 Feb 2017 9:23 pm
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.

Re: Server Generated Graphs for MX

Posted: Sat 18 Mar 2017 5:20 pm
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?

Re: Server Generated Graphs for MX

Posted: Sat 18 Mar 2017 5:28 pm
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?

Re: Server Generated Graphs for MX

Posted: Sat 18 Mar 2017 11:53 pm
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.

Re: Server Generated Graphs for MX

Posted: Mon 26 Jun 2017 1:29 pm
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.