Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

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.
master1986
Posts: 16
Joined: Fri Jul 08, 2016 6:14 am
Weather Station: Lacrosse 2350
Operating System: Windows 8.1
Location: Italia

Re: Server Generated Graphs for MX

Postby master1986 » Mon Jul 11, 2016 4:41 pm

mcrossley wrote:
master1986 wrote:hello , I would be interested to save data to MySQL and read .

However, the aim should be to generate a graph of a precise period , then selecting the start and end of the period .

It's possible?

Sounds like it should be, once you have the data in MySQL you can extract pretty much whatever you want.


hello , you have developed something about it ?

BCJKiwi
Posts: 847
Joined: Mon Jul 09, 2012 8:40 pm
Weather Station: Davis VP2 Cabled with Solar
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Server Generated Graphs for MX

Postby BCJKiwi » Mon Jul 11, 2016 9:20 pm

Thanks reply posted.

User avatar
mcrossley
Posts: 5015
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 Jul 11, 2016 10:07 pm

master1986 wrote:hello , you have developed something about it ?

You need to define exactly what it is you want. Server based graphs or client side generated graphs (you will find a thread or two about Highcharts graphs on the forum) like these or these. What time periods you want, selectable or fixed periods etc.

User avatar
HRVistaWeather
Posts: 167
Joined: Mon Apr 09, 2012 2:38 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 7 Ultimate (64bit)
Location: Franklin, Huon Valley, Tasmania
Contact:

Re: Server Generated Graphs for MX

Postby HRVistaWeather » Mon Jul 11, 2016 11:03 pm

Hi Mark,

Thanks for looking at this, due to work and her in doors breaking a rib (badly) been snowed under (maybe snowed under literally in next 48hrs big cold front on way.

I will look at it later in week hopefully. Still running original (it's got regular wind data again so working) though I know not correctly.

Brian, I noticed you added it as I did to the Gauges Tooltip. This requires mods to "wx-gauges-ss.css" and "gauges-ss-wx.js"

For "wx-gauges-ss.css" add new size; Change;
From;

Code: Select all

.ddimgtooltip{
  z-index: 2000;
  box-shadow: 3px 3px 5px #818181; /*shadow for CSS3 capable browsers.*/
  border-radius: 10px;
  display: none;
  position: absolute;
  border: 1px solid black;
  background: white;
  color: black;
  padding: 0 7px 3px 7px;
  font-family: sans-serif;
  font-size: 10px;
}
.tipinfo{
  text-align: left;
  padding: 3px 0 3px 2px;
}
.tipimg{
/*
  width: 438px;
  height: 175px;
*/
  width: 430px;
  height: 215px;
  }

To: Include size for the WindRose; "tipimgx" 400x400 or whatever you want;

Code: Select all

.ddimgtooltip{
  z-index: 2000;
  box-shadow: 3px 3px 5px #818181; /*shadow for CSS3 capable browsers.*/
  border-radius: 10px;
  display: none;
  position: absolute;
  border: 1px solid black;
  background: white;
  color: black;
  padding: 0 7px 3px 7px;
  font-family: sans-serif;
  font-size: 10px;
}
.tipinfo{
  text-align: left;
  padding: 3px 0 3px 2px;
}
.tipimg{
/*
  width: 438px;
  height: 175px;
*/
  width: 430px;
  height: 215px;
  }
.tipimgx{
  width: 400px;
  height: 400px;
}


Then for gauges-ss-wx.js (need to modify createtip section to as per below);
From:

Code: Select all

    createtip : function ($, tipid, tipinfo) {
        if ($('#' + tipid).length === 0) { //if this tooltip doesn't exist yet
            return $('<div id="' + tipid + '" class="ddimgtooltip" />')
                        .html(
                            ((tipinfo[1]) ? '<div class="tipinfo" id="' + tipid + '_txt">' + tipinfo[1] + '</div>' : '') +
                            (tipinfo[0] !== null ? '<div style="text-align:center"><img class="tipimg" id="' + tipid + '_img" src="' + tipinfo[0] + '" /></div>' : '')
                        )
                        .css(tipinfo[2] || {})
                        .appendTo(document.body);
        }
        return null;
    },

To:

Code: Select all

   createtip : function ($, tipid, tipinfo) {
        if ($('#' + tipid).length === 0) { //if this tooltip doesn't exist yet
      var sfx = '';
      if (tipid === 'imgtip10') { sfx = 'x';}
            return $('<div id="' + tipid + '" class="ddimgtooltip" />')
                        .html(
                            ((tipinfo[1]) ? '<div class="tipinfo" id="' + tipid + '_txt">' + tipinfo[1] + '</div>' : '') +
                            (tipinfo[0] !== null ? '<div style="text-align:center"><img class="tipimg' + sfx + '" id="' + tipid + '_img" src="' + tipinfo[0] + '" /></div>' : '')
                        )
                        .css(tipinfo[2] || {})
                        .appendTo(document.body);
      }
        return null;
    },

The above principle is also what I use to display the GFS Map Tooltip for my Ozone Gauge.

Brian, I will email you later this week, as I have some other fixes for other non related pages for you as well - just not had time.

regards,
Tony
https://southfranklinweather.com
Image
Huon River Vista - South Franklin Weather - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Back Online : 2017-11-01

BCJKiwi
Posts: 847
Joined: Mon Jul 09, 2012 8:40 pm
Weather Station: Davis VP2 Cabled with Solar
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Server Generated Graphs for MX

Postby BCJKiwi » Tue Jul 12, 2016 9:22 pm

Mark, Tony,

Thanks for the updates - all good now.

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

Re: Server Generated Graphs for MX

Postby jlmr731 » Mon Sep 12, 2016 3:16 am

Need a bit of help I just downloaded the sql scripts from github, and getting this error
"ERROR - TZ Statement"
looking through graphSetting php i see

Code: Select all

$result = $mysqli->query("SET time_zone='UTC'");
    if (!$result) {
       die("ERROR - TZ Statement");


before i go messing around much more would this be in the setting of mysql? or something else
My database is all done by cumulusMX 3041

Thanks

User avatar
mcrossley
Posts: 5015
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 Sep 12, 2016 1:52 pm

jlmr731 wrote:Need a bit of help I just downloaded the sql scripts from github, and getting this error
"ERROR - TZ Statement"
looking through graphSetting php i see

Code: Select all

$result = $mysqli->query("SET time_zone='UTC'");
    if (!$result) {
       die("ERROR - TZ Statement");


before i go messing around much more would this be in the setting of mysql? or something else
My database is all done by cumulusMX 3041

Thanks

It is probably because the time zone system tables have not been populated on your server. This is only done by default on Windows servers.
http://dev.mysql.com/doc/refman/5.7/en/ ... o-sql.html

If you have problems getting your web server support people to do this, then you may try using

Code: Select all

$result = $mysqli->query("SET time_zone='+00:00'");

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

Re: Server Generated Graphs for MX

Postby jlmr731 » Tue Sep 13, 2016 3:42 am

Thanks for the help and the links and yes mysql is on my linux box and never ran into that issue before so running

Code: Select all

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

fixed it all up.
Now another problem easily solved was the select from realtime, I used the scripts from cumulusMX to create the database table and it names it Realtime
so if others run into that problem just change that line in graphSetting.php

Code: Select all

  $query = "SELECT unix_timestamp(LogDateTime) AS time, $cols
        FROM Realtime  /--------Changed to cap R
        WHERE LogDateTime >= now() - INTERVAL " .$GRAPH['hours']. " HOUR
        ORDER BY time";


Now if i run any of the scripts directly in the browser (like localhost/graph/SQL/graphRain.php) all error's are gone but all i see is a very tiny box with nothing inside well maybe cause its so small, i did try changing
$Graph['width'] and $Graph['height'] but did not change the size, i also edited the jpgraph file as in the README.md file

I would guess i should have an output running this way and yes running the scripts from the json dir work great

User avatar
mcrossley
Posts: 5015
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 » Tue Sep 13, 2016 8:43 am

Have you tried running the query directly in myPHPAdmin (or the SQL command line)?

Code: Select all

SELECT unix_timestamp(LogDateTime) AS time, temp
FROM Realtime
WHERE LogDateTime >= now() - INTERVAL 1 HOUR
ORDER BY time


Have you also tried to generate the jpgraph demo graphs to test your jpgraph install?

Also check your web server error log for a clue.

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

Re: Server Generated Graphs for MX

Postby jlmr731 » Wed Sep 14, 2016 2:58 am

Thanks for your time on this. now i am a bit confused First im not a programmer but i can read code and some what understand it as long as its not long and complex. so here we go. Yes i get the sql query to work and jpgraph examples, well most work and i see file missing errors on some of them but it is not what your graph require. Now i still get a very small outline of a box in chrome about the size of heading letter. Also I have no errors in my apache logs
then i tried firefox and there it shows me something and here is the html source of it first from fire fox and second from chrome

Code: Select all

<img alt="The image ?http://localhost/graph/SQL/graphTempOut.php? cannot be displayed because it contains errors." src="http://localhost/graph/SQL/graphTempOut.php">

<img style="-webkit-user-select: none" src="http://localhost/graph/SQL/graphTempOut.php">


SO what i see is that for some reason its not naming correctly

SO i ran php comand on it "php graphfile.php" and wow i had out put that looked like image stuff as output, so i did a cat to a file and it opens with the image
Image

So we see it does work (sort of) all i see in the script that may be responsible for it is this

Code: Select all

$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');

Now of course i have no idea whats going on within jpgraph or if there is something missing from the script.

Thanks Mark

User avatar
mcrossley
Posts: 5015
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 » Wed Sep 14, 2016 7:02 pm

Any chance of link to the scripts?

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

Re: Server Generated Graphs for MX

Postby jlmr731 » Thu Sep 15, 2016 11:55 pm

Thanks for taking time on this here is the link
jlmr731.duckdns.org/graph/SQL

User avatar
mcrossley
Posts: 5015
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 » Fri Sep 16, 2016 9:56 am

OK, the script is generating a image correctly, but the output has two line feeds 0xA characters before the image.

As it is happening with all the images I suspect the graphSettings.php file has these extra characters in it somewhere. I can't see the source so you'll have to check it yourself - or post the file here so I can take a look.

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

Re: Server Generated Graphs for MX

Postby jlmr731 » Fri Sep 16, 2016 1:44 pm

Here is my graphSettings
Now that you said about the extra line when i used comand line for output i had to remove first 2 lines to get image to work. sorry that slipped my mind
You do not have the required permissions to view the files attached to this post.

User avatar
mcrossley
Posts: 5015
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 » Fri Sep 16, 2016 2:23 pm

Yep, you have two extra line feeds in that file after the closing ?>
Delete those and you should be OK.


Return to “Cumulus MX”

Who is online

Users browsing this forum: No registered users and 7 guests