Page 1 of 1

Patched dashboard.js

Posted: Fri 29 Jan 2010 10:33 pm
by mcrossley
Steve

I just noticed a problem with the dashboard.js script used on the gauges page. My WH1091 sometimes reports North as 360 and the script cannot cope with that on the Wind rose - it displays 'undefined'. Specifically the getord() function needs patching.

Here is the fixed version I am using on my website:

Code: Select all

function getord(d){
 //convert to range 0-360
 if(d>=360){d-=360;}
 deg = Math.ceil((d+11.25)/22.5)
 ords = new Array("N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW")
 return(ords[deg-1]);
}

Cheers
Mark

Re: Patched dashboard.js

Posted: Fri 29 Jan 2010 11:11 pm
by steve
Thanks, Mark, I'll include the fixed version with the next build.