Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 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

Highcharts Graphs

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

Re: Highcharts Graphs

Post by mcrossley »

Also setting up a view will not do anything for the compute time. BTW, I just added a new sunshine chart - from yet another intermediate table. If I get time the Sun by hour data can be derived easily from the new Sun by Month & Hour table, but for now I'm running both. Let me know if you want the query to build the new table.
User avatar
BeaumarisWX
Posts: 358
Joined: Mon 09 Apr 2012 2:38 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 Pro Hades Canyon
Location: Beaumaris, Tasmania, AU
Contact:

Re: Highcharts Graphs

Post by BeaumarisWX »

Hi Mark,

Yes for sure matey, that looks brilliant. What a great way to display it, your a legend.

regards,
Tony Beaumaris, Tasmania (AUS)

CMX Mobile : https://beaumaris-weather.com/BWX/
CMX Default: https://beaumaris-weather.com/cumulusmx_default/
Colour Dashboard : https://beaumaris-weather.com/dashborad_color.php
Click below for Saratoga Template :
Image
User avatar
mcrossley
Posts: 12694
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

Sorry Tony, I was playing around with a few things. The sunshine by month and hour table is defined as:

Code: Select all

month - int(2)
hour - int(2)
sun - decimal (5,2)
percent - decimal(3,1)
The insert statements are:

Code: Select all

	DELETE FROM <db_name>.`sunbymonthhour`;
	INSERT INTO <db_name>.`sunbymonthhour`
	SELECT  month,
			hour,
			sum(sun),
			round(sum(sun) / count(*) * 100, 1)
	FROM (
		SELECT  month(CONVERT_TZ(t.LogDateTime,"EUROPE/London","UTC")) AS month,
				hour(CONVERT_TZ(t.LogDateTime,"EUROPE/London","UTC")) AS hour,
				(min(n.HrsSunShine) - min(t.HrsSunShine)) AS sun
		FROM <db_name>.<logdata_table_name> as t
		JOIN <db_name>.<logdata_table_name> 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 month, hour;
The TZ settings will need adapting to your specific TZ as before - as will the solar data start date if it does not correspond with the general data start date, otherwise the t.LogDateTime > "2013-4-14" clause can be deleted.
User avatar
BeaumarisWX
Posts: 358
Joined: Mon 09 Apr 2012 2:38 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 Pro Hades Canyon
Location: Beaumaris, Tasmania, AU
Contact:

Re: Highcharts Graphs

Post by BeaumarisWX »

Hi Mark,

Brilliant thank you, think I got it all running OK, seems to be correct. http://hrvistaweather.com/weather/wxhis ... rtsAll.php

In historicGraphs.js I changed:

From:

Code: Select all

var temperatureHourlyMonth = function () {
	try {
		chart.showLoading();
	} catch (e) {}

	$('#graph_description').text(
		'The average temperature for each hour of the day plotted per month. You can enable/disable the individual series plots by clicking on them in the graph legend.'
	);
To:

Code: Select all

var temperatureHourlyMonth = function () {
	try {
		chart.showLoading();
	} catch (e) {}

	$('#graph_description').text(
		'The average temperature for each hour of the day plotted per month.'
	);

removing the " You can enable/disable the individual series plots by clicking on them in the graph legend."

regards,
Tony Beaumaris, Tasmania (AUS)

CMX Mobile : https://beaumaris-weather.com/BWX/
CMX Default: https://beaumaris-weather.com/cumulusmx_default/
Colour Dashboard : https://beaumaris-weather.com/dashborad_color.php
Click below for Saratoga Template :
Image
UncleBuck
Posts: 43
Joined: Sat 29 Dec 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: Highcharts Graphs

Post by UncleBuck »

I know this thread is now over a month since the last post but thought I would chime in on Tony's problem with time zone conversions.

If the hosting providers version of MySQL does not have the Timezone tables populated then you can't use the Australia/Hobart format for time conversion. The only way I have found around this was as follows:

Check the time that MySQL is using by using a simple select statement and returning now(). (in my case it was AEST)
Then use convert_tz(LogDateTime,"SYSTEM","+10:00")

Col.
UncleBuck
Posts: 43
Joined: Sat 29 Dec 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: Highcharts Graphs

Post by UncleBuck »

Just thinking a little more on that and realised even that is wrong.

MX is storing the log file date as daylight time, MySQL is set to use standard time so I will have to think a little more on that.
UncleBuck
Posts: 43
Joined: Sat 29 Dec 2012 10:27 pm
Weather Station: Davis VP2+
Operating System: MAC Mini - OSX El Capitan
Location: Victoria, Australia

Re: Highcharts Graphs

Post by UncleBuck »

Hi Mark,
Just a quick question for clarification purposes.

In your scripts you use several table names that are not what CMX creates as the part of the SQL setup. Could you please provide your equivalent table names for the following CMX tables:

CMX table Your table
Dayfile
Monthly
Realtime

If you could also provide the names of other tables used for these graphs that are not part of a standard CMX setup that would fantastic.

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

Re: Highcharts Graphs

Post by mcrossley »

Hi Colin, I think they are pretty self explanatory, I try and use the standard table names in released scripts, but sometimes forget!

Dayfile=daydata
Monthly=fulldata
Realtime=realtime

I use other tables and views for various bits'n'bobs...
facts
sunbyhour
sunbymonthhour
tide
monthlytemps (view)

and some triggers (post-insert on daydata, and pre-insert on realtime) to generate various derived values (a running 10 minute average UV-I that Cumulus does not create for instance).
Mapantz
Posts: 1778
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Highcharts Graphs

Post by Mapantz »

Hi folks.

I wonder if somebody could spare five minutes?

I've just setup the realtime Highcharts on my server, and the way I decided to create the realtime log was through TNET's php script & running a cronjob every minute. I thought I had cracked it, until I saw the first update..

The realtimelog.txt is updating fine: http://www.warehamwx.com/cu/realtime.log

When the page loads, the graphs create fine, when the update comes, the timestamp at the bottom of the graph turns in to years 2006 - 2016: http://www.warehamwx.com/cu/realtime.log

I'm a bit stumped and confused now! :oops:

Many thanks.
Image
Mapantz
Posts: 1778
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 x64
Location: Dorset - UK
Contact:

Re: Highcharts Graphs

Post by Mapantz »

I solved my own problem in the end. It was the date format in TNET's script.. It produced 2016-03-13 in the realtimelog, while the realtime.txt is 13/03/16

I changed a line in the realtimelog.php to:

Code: Select all

$data="DD/MM/YY"; echo "20" . substr($data,6,2) . "-" . substr($data,0,2) . "-" . substr($data,3,2);
The dates match, and the graph now updates and executes with no issues. :)
Image
Dinant
Posts: 93
Joined: Sat 17 Aug 2013 9:11 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 2012 R2
Location: Markelo
Contact:

Re: Highcharts Graphs

Post by Dinant »

Hi Mark,

I like your historic highcharts on your website. I have copied the necessary files to my own site. But I have a small problem. If I press under the column Rainfall on the Drill Down button it keeps saying Loading...
In the javascript console it says:
Uncaught TypeError: Cannot read property 'length' of undefined historicGraphs.js:1610.
It is about this section:

Code: Select all

					for (k = 0; k < resp[i].months[j][2].length; k++) {
						options.drilldown.series[options.drilldown.series.length-1].data[k] = {
							name: resp[i].months[j][2][k][0] + '-' + resp[i].months[j][0],
							y   : resp[i].months[j][2][k][1]
						};
					}
This variable resp.months[j][2].length is undefined.
If I comment this section the graph is shown but the second drill doesn't show anything.

Do you know what is wrong?

Dinant
Dinant
Posts: 93
Joined: Sat 17 Aug 2013 9:11 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 2012 R2
Location: Markelo
Contact:

Re: Highcharts Graphs

Post by Dinant »

Forgot to mention: my website: http://www.weerstation-markelo.nl/test.php
User avatar
mcrossley
Posts: 12694
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Highcharts Graphs

Post by mcrossley »

Your historicRainByYear.php script is not returning data for the first months of 2013, until August 17th...

Code: Select all

[{"year":"2013","total":371.8,"months":[["Jan",0],["Feb",0],["Mar",0],["Apr",0],["May",0],["Jun",0],["Jul",0],["Aug",12.8,[[17,0],
Try changing the PHP...

Code: Select all

from this...
		while ($m < (int)$monthRow[1]) {
			$valTot[$m - 1] = array($months[$m-1], 0);
			$m++;
		}

to this...
		while ($m < (int)$monthRow[1]) {
			$valTot[$m - 1] = array($months[$m-1], 0, array());
			$m++;
		}
I had put that code into my historicSunshineByYear.php as that starts mid-year and I obviously hit the same issue, but it looks like I forgot to go back and fix the rainfall script as my rain records happen to start in January 2010.
Dinant
Posts: 93
Joined: Sat 17 Aug 2013 9:11 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 2012 R2
Location: Markelo
Contact:

Re: Highcharts Graphs

Post by Dinant »

That does the job. Thanks.

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

Re: Highcharts Graphs

Post by mcrossley »

Great!

PS: You don't need to copyright me for the graphs - but the acknowledgement is nice, thanks.
Post Reply