I've been spending some time playing around with some highcharts graphs recent, and got a little carried away..
https://warehamwx.co.uk/graphs_monthly.php
I have plans for a few more, one of them was using windbarb.js
I did get a windbarb chart working, but I ran in to a problem with it, so I scrapped it. I wanted to try again, but thought I'd see if anyone here has used it.
I used HighWindGust and HWindGBear from the Dayfile table in SQL, and put it in to an array. I put a chart together for area, as well as the windbarbs. I noticed that the windbarbs had a lot of pennants, meaning that it was showing high winds. Sure enough, the tooltips were showing 'hurricane' and 'violent storm'. After some faffing around, I realised that the windbarb.js is using metres per second. It was interpreting a 56mph gust as 56m/s (125mph).
I then thought that perhaps I might be able to convert my readings from mph to m/s, then only show the beaufort description in the windbarb tooltip. I did just that and thought I'd solved it. However, the windbarbs on the charts were still showing too many pennants, which didn't relate to the actual wind speeds.
It now seems that coding may be needed for the barbs themselves, to properly do a conversion so that the correct pennants show up on them. It's not as simple as just converting the actual value to m/s.
I've had a look, but I cannot seem to find any information on it. I find it rather strange that they would lock it to a single unit?!
Simple question; Has anyone managed to do it?
Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.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 Question
- HansR
- Posts: 6026
- Joined: Sat 20 Oct 2012 6:53 am
- Weather Station: GW1100 (WS80/WH40)
- Operating System: Raspberry OS/Bookworm
- Location: Wagenborgen (NL)
- Contact:
Re: Highcharts Question
@Mapantz: Yes, I used the windbarbs in my AirLink module of CumulusUtils (See here menu choose Extra=>AirLink=>Grafiek Out.
Indeed the windbarbs only use the m/s, all figures are taken as m/s. Afaik the conversion should be enough.
My code for the chart as seen can be seen here
The relevant parts are:
and the conversion function:
I had help from HighCharts support on their own forum and on StackOverflow.
That should do it.
Indeed the windbarbs only use the m/s, all figures are taken as m/s. Afaik the conversion should be enough.
My code for the chart as seen can be seen here
The relevant parts are:
Code: Select all
if (idx in resp) {
if (idx == 'wind') {
let convertedWindbarbData = convertToMs(resp[idx]);
chart.addSeries({name: titles[idx], xAxis: 1, color: 'black', type: 'windbarb', visible: true, tooltip: {valueSuffix: ' m/s'}, data: convertedWindbarbData }, false);
}
else {
chart.addSeries({name: titles[idx], id: titles[idx], data: resp[idx]}, false);
}
}
Code: Select all
function convertToMs(data){data.map(s => {s[1] = s[1] * 0.27778 }); return data}
That should do it.
Hans
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
-
- Posts: 1832
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: Highcharts Question
Hi Hans
Thanks for the reply.
The problem is, I don't want the chart to show my speeds in m/s. It was easy enough converting mph to m/s, I did that in the php file that grabs the data from my sql table
Converting the data within the highchart itself is the problem.
I can make it show the wind speed values in mph, but the windbarb icons themselves will always read the data as m/s, that's the problem I have..
Added a windbarb chart at the bottom of the page: https://warehamwx.co.uk/graphs_monthly.php
Thanks for the reply.
The problem is, I don't want the chart to show my speeds in m/s. It was easy enough converting mph to m/s, I did that in the php file that grabs the data from my sql table
Code: Select all
$HGustDir[] = array((float)$row[13] * 0.44704, (float)$row[21]);
I can make it show the wind speed values in mph, but the windbarb icons themselves will always read the data as m/s, that's the problem I have..
Added a windbarb chart at the bottom of the page: https://warehamwx.co.uk/graphs_monthly.php
- HansR
- Posts: 6026
- Joined: Sat 20 Oct 2012 6:53 am
- Weather Station: GW1100 (WS80/WH40)
- Operating System: Raspberry OS/Bookworm
- Location: Wagenborgen (NL)
- Contact:
Re: Highcharts Question
Search the highcharts forum/stackoverflow vor windbarbs, I know the code to modify the windbarbs pennants is in there for sure. I have seen it but did not note the link as that was not what i was looking for. But it is published by highcharts how to deal with this.
Hans
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
- beteljuice
- Posts: 3292
- Joined: Tue 09 Dec 2008 1:37 pm
- Weather Station: None !
- Operating System: W10 - Threadripper 16core, etc
- Location: Dudley, West Midlands, UK
Re: Highcharts Question
@ Map ...
$HGustDir[] = direction not speed ?
$HGustDir[] = direction not speed ?
......................Imagine, what you will KNOW tomorrow !
- HansR
- Posts: 6026
- Joined: Sat 20 Oct 2012 6:53 am
- Weather Station: GW1100 (WS80/WH40)
- Operating System: Raspberry OS/Bookworm
- Location: Wagenborgen (NL)
- Contact:
Re: Highcharts Question
Good. Any use of publishing ot here for completeness?
Hans
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
-
- Posts: 1832
- Joined: Sat 17 Dec 2011 11:55 am
- Weather Station: Davis Vantage Pro2
- Operating System: Windows 11 x64
- Location: Dorset - UK
- Contact:
Re: Highcharts Question
Row 13 is the gust speed in my script (now changed it to max wind speed) row 21 is now the dominant direction of the day.
I'll put a zip together later if folks are interested?!
- HansR
- Posts: 6026
- Joined: Sat 20 Oct 2012 6:53 am
- Weather Station: GW1100 (WS80/WH40)
- Operating System: Raspberry OS/Bookworm
- Location: Wagenborgen (NL)
- Contact:
Re: Highcharts Question
Well, i am. Is that enough
Hans
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3