Page 1 of 1
Highcharts Windrose
Posted: Tue 16 Jan 2018 10:03 pm
by Bridger
I am still using Cumulus 1 and have had the Highcharts graphs, including the Windrose, running for sometime. The Windrose had been using only a SQL fulldata table.
I am now uploading realtime.txt to a MySQL realtime table and have managed to get the windrose to dispaly 24hour, 48hour and 7 day graphs except that, when the page initially loads with "Last 24 hours" selected, the graph for "Year to date" is displayed until "Go" is clicked.
I suspect the problem is somewhere in the windrose.js file but I don't have the knowledge to fix it.
Any help would be appreciated.
Windrose is here
http://www.fordingbridgeweather.co.uk/s ... ndrose.php
Re: Highcharts Windrose
Posted: Tue 16 Jan 2018 10:25 pm
by mcrossley
Line 220, change serverData("year") to serverData("24")
Re: Highcharts Windrose
Posted: Tue 16 Jan 2018 10:36 pm
by Bridger
Thanks Mark. Simple - when you know how.
Re: Highcharts Windrose
Posted: Wed 01 Jan 2020 7:47 pm
by Bridger
Some of the selections from the drop down menu on my Highcharts Windrose page show the centre "Calm" reading to 15 decimal places rather than the expected 2 decimal places. For example The Last 7 Days selection.
The only place I have been able to find a decimal place setting is in under tooltips in the windrose.js file but this appears to affect only the pop-up table figures.
Any help would be appreciated.
You can view the page here:-
http://www.fordingbridgeweather.co.uk/s ... ndrose.php
Thanks,
Re: Highcharts Windrose
Posted: Thu 02 Jan 2020 10:37 am
by mcrossley
Bridger wrote: ↑Wed 01 Jan 2020 7:47 pm
Some of the selections from the drop down menu on my Highcharts Windrose page show the centre "Calm" reading to 15 decimal places rather than the expected 2 decimal places. For example The Last 7 Days selection.
The only place I have been able to find a decimal place setting is in under tooltips in the windrose.js file but this appears to affect only the pop-up table figures.
Any help would be appreciated.
You can view the page here:-
http://www.fordingbridgeweather.co.uk/s ... ndrose.php
Thanks,
Two ways of doing it.
1. In MySQL - change the query to round the value to 1 dp (this is what I do)...
Code: Select all
// start of standard querys
$query =
"SELECT
dir,
ROUND(SUM(IF($windSpeedCol < 1, percent, 0)), 1) AS calm,
ROUND(SUM(IF($windSpeedCol >= 1 AND $windSpeedCol < 4, percent, 0)), 2) AS '1-3 mph',
ROUND(SUM(IF($windSpeedCol >= 4 AND $windSpeedCol < 8, percent, 0)), 2) AS '4-7 mph',
... etc
2. Change the embedded JavaScript in the page to round the value (untested)...
Code: Select all
// first element [0] of data is the calm percentage
var calm = resp.shift().toFixed(1);
Re: Highcharts Windrose
Posted: Thu 02 Jan 2020 1:06 pm
by Bridger
Thanks Mark.
There appeared to be no change with Option 1 but Option 2 did the trick. I changed the parameter to 2 to keep the output consistent with the 2 decimal places of the pop up table.
Peter