The MSW rating is calculated for you by our own algorithm. There are two components that make up the rating fadedRating
and solidRating
.
solidRating
This is the solid stars for the rating, which signifies swell quality/power.fadedRating
This signifies the number of stars you should show for the portion of the overall rating that has been effected by the wind.From a technical point of view you just need to render the solidRating
first and then the fadedRating
as the below JavaScript example shows.
var rating = [];// Loop the solid rating on a single forecast object.
for (var i = 0; i < forecast.solidRating; i++) {
rating.push('');
}// Loop the faded rating on a single forecast object.
for (var i = 0; i < forecast.fadedRating; i++) {
rating.push('');
}document.getElementById("ratingContainer").innerHTML = rating.join(" ");