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

Highcharts Graphs

Discussion and support for 3rd-party (non-Sandaysoft) tools for Cumulus
User avatar
mcrossley
Posts: 5209
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley » Fri 22 May 2015 1:03 pm

I had hoped that al the information was in the thread - somewhere, it has evolved somewhat from the start - which bits are you missing?

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

Re: Highcharts Graphs

Post by HRVistaWeather » Sun 15 Nov 2015 11:57 am

Hi Mark,

1: Added Australian UV Colour Bands.
2: Displays Variation in UV and Solar Rad (Last 4 Days not Extreme nor Unusual for Franklin) but highlights our variability well.

Thanks again for your underlying core concept.

Regards,

Tony
You do not have the required permissions to view the files attached to this post.
Tony
Huon River Vista - South Franklin Weather - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Image

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

Re: Highcharts Graphs

Post by mcrossley » Wed 23 Dec 2015 7:57 pm

I was playing around some more with Highcharts, I added some 'drill down' ability to couple of my historic graphs. The implementation code is pretty horrible, but as a concept it works. http://weather.wilmslowastro.com/graphs_historic.php

User avatar
steve
Cumulus Author
Posts: 26714
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Highcharts Graphs

Post by steve » Wed 23 Dec 2015 8:06 pm

I get 404s when I click on either of the 'drill down' buttons:

GET http://weather.wilmslowastro.com/utils/ ... yYear2.php 404 (Not Found)
GET http://weather.wilmslowastro.com/utils/ ... yYear2.php 404 (Not Found)
Steve

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

Re: Highcharts Graphs

Post by mcrossley » Wed 23 Dec 2015 8:15 pm

Ahem, well you would! :oops:

Try forcing a refresh now - a slip up on the file renaming front.

User avatar
steve
Cumulus Author
Posts: 26714
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Highcharts Graphs

Post by steve » Wed 23 Dec 2015 8:16 pm

Yes, working nicely now :)
Steve

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

Re: Highcharts Graphs

Post by mcrossley » Sat 02 Jan 2016 2:33 pm

I have played around some more, I have converted the daily graphs to use scrollable StockCharts rather than have fixed time ranges, and added a couple of new graphs. The 'comfort zone' chart is a bit of a kludge, but I found MySQL was a bit slow doing all the work in query, so there is some post processing in PHP. Now I just need another 15 years data to smooth the curves out!

http://weather.wilmslowastro.com/graphs_historic.php

Edit: I forgot to say, that the comfort zone chart was inspired by the WeatherSpark presentation.

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

Re: Highcharts Graphs

Post by HRVistaWeather » Sun 03 Jan 2016 10:08 pm

Hi Mark,

Brilliant new features (Love them).

I hope it's ok as usual to use the scripts. Interesting (and obvious) the reverse display on Comfort Graph between yours and mine :D

I am unable to sort out the "sunbyhour" graph, is this an additional table you upload to or is it a mysql view ?

New: http://hrvistaweather.com/weather/wxhis ... rtsAll.php
Old: http://hrvistaweather.com/weather/wxhistoricCharts.php

Kind Regards,
You do not have the required permissions to view the files attached to this post.
Tony
Huon River Vista - South Franklin Weather - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Image

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

Re: Highcharts Graphs

Post by mcrossley » Sun 03 Jan 2016 11:03 pm

Hi Tony, yes feel free to use the scripts, I wouldn't put the src view function in if I wanted to keep them secret.

The sun by hour query is quite expensive and the data doesn't change very dynamically, so I run it once a day and save the result in a separate table. I have a post insert trigger on my daydata table (because that only gets updated at rollover) that removes the existing data and repopulates it from the full logtable.

Edit: My post insert trigger looks like this (you will need to do some editing to match your dates, and convert to a suitable 'standard' timezone without DST)...

Code: Select all

BEGIN
    DELETE FROM `sunbyhour`;
    INSERT INTO `sunbyhour`
			SELECT  hour,
					sum(sun),
					round(sum(sun) / count(*) * 100, 1)
			FROM (
				SELECT  hour(CONVERT_TZ(t.LogDateTime,"EUROPE/London","UTC")) AS hour,
						(min(n.HrsSunShine) - min(t.HrsSunShine)) AS sun
				FROM `fulldata` as t
				JOIN `fulldata` as n
				ON t.LogDateTime = date_sub(n.LogDateTime, INTERVAL 1 hour)
				WHERE t.LogDateTime > "2013-4-14"
				AND hour(t.LogDateTime) BETWEEN 2 AND 22
				GROUP BY date_format(t.LogDateTime, "%Y%m%d%H")
			) as x
			GROUP BY hour;
END
I should probably do something similar with the temperature by hour, and comfort data. They are both quite expensive queries too.

Edit: Actually, looking at that sun query now with hindsight, I'm sure it is actually a lot simpler to do than that....

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

Re: Highcharts Graphs

Post by HRVistaWeather » Tue 05 Jan 2016 9:27 pm

Hi Mark,

Thanks for this, though I must be missing a field when I created the sunbyhour table.

I tried adding LogDateTime field as well (though did not think it was required) and it ran but only returned one row with zero datetime.

I obviously have the table structure incorrect, ensured I have correct start time for Solar and used Australia/Brisbane (non DST) vs my Australia/Hobart which is DST (Both +10 ST)

regards,
You do not have the required permissions to view the files attached to this post.
Tony
Huon River Vista - South Franklin Weather - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Image

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

Re: Highcharts Graphs

Post by mcrossley » Wed 06 Jan 2016 9:31 am

Tony, I have three columns - one redundant (sun), but still populated...

hour - int(2)
sun - decimal(5,1)
percent - decimal(3,1)

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

Re: Highcharts Graphs

Post by HRVistaWeather » Wed 06 Jan 2016 8:34 pm

Thanks Mark,
Ah that was the 3rd column could not figure that one out from the statement.
I am afraid it just does not want to play the game: returns only one row ?

hour 0
sun 3153.9
percent 28.1
Tony
Huon River Vista - South Franklin Weather - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Image

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

Re: Highcharts Graphs

Post by mcrossley » Wed 06 Jan 2016 11:15 pm

I think your problem is in the TZ conversion, you are converting to UTC. What you need to do is convert from your DST based TZ to your local TZ without DST, so (if I have the TZ correct) something like...

Code: Select all

hour(CONVERT_TZ(t.LogDateTime,"Australia/Hobart","+10:00")) AS hour,

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

Re: Highcharts Graphs

Post by HRVistaWeather » Thu 07 Jan 2016 2:26 am

Hi Mark,

Appreciated, yes your proposal looks correct to me (including zones/+10) etc.

Tried everything, but still no joy trying to convert, though as it's DST that's trying to be adjusted I decided not to bother and just use the time recorded, which worked. I changed the description for now from (UTC) to (AET) which is stating it's either or (AEST) or (AEDT) until I find a way to make it work. The chart even looks correct with how things are here always early morn sun backs of late morn then increases again around 16:00.

Only thing that I can't fix is the missing 1hr and 23hr on the chart, they just won't display, tried changing the sql script fro 2 to 22 (to) 1 to 23 but that screwed it big time. php .js is correct starts at 00 and ends 23, no idea.

Thanks anyway Mark I now understand the process, so will play over time. Let you know if I figure it out).

Actually what I think might be an option is to set it up as a view, that way no need to run a script to refresh it. Might look at that.
You do not have the required permissions to view the files attached to this post.
Tony
Huon River Vista - South Franklin Weather - Tasmania
Davis Vantage Pro 2 Plus - FARS, Cumulus MX, 2 Soil Temp/Moist Solar/Rad.
Image

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

Re: Highcharts Graphs

Post by mcrossley » Thu 07 Jan 2016 9:13 am

Hi Tiny, that is looking good - sadly with a bit higher figures than me :(

I deliberately excluded the 00 23 hours because the sunshine hours is a cumulative number for the day, so resets to zero at midnight. Coping with that wrap around would be beyond my small brain to achieve in a SQL query.

Post Reply