This is only a guess. I had a similar problem displaying colors for my UV
index. My current.UV.raw was returning a float with several decimal places
so I rounded it to 1 decimal place as in the snippet below. It may not have
been the most elegant solution but seems to work for me. I was getting
strange color behaviour in my responsive skin with the colors. So something
to consider with your windSpeed.
#else if round($current.UV.raw ,1) >= 5.5 and round($current.UV.raw ,1) <=
7.4
<td class="stats_data" style="background-color: orange">$current.UV</td>
Maybe others can see something more glaring.
On Sunday, May 15, 2022 at 6:24:22 a.m. UTC-4 Meteo Oberwallis wrote:
> Hi Guys
> I have a problem with the wind color in Belchertown. I managed to display
> the wind in color as well. Only it doesn't always do so after visiting or
> refreshing the Belchertown page. I've attached my changes. What could it
> be? I have 2 pictures attached. At view a is at page load and also a few
> seconds later. At some point the color will change (see appendix b). But
> that is always different.
>
> This is my Code:
>
> // Change the color of the Windspeed variable according to US-EPA standards
> // (adjusted to match skin colors better)
> function get_windSpeed_color(windSpeed, returnColor = false) {
> if (windSpeed <= 0) {
> var windSpeed_color = "rgba(0,255,0,1)";
> } else if (windSpeed >= 19.9) {
> var windSpeed_color = "rgba(126,255,0,1)";
> } else if (windSpeed >= 39.9) {
> var windSpeed_color = "rgba(0,255,0,1)";
> } else if (windSpeed >= 59.9) {
> var windSpeed_color = "rgba(255,128,0,1)";
> } else if (windSpeed >= 79.9) {
> var windSpeed_color = "rgba(255,0,0,1)";
> } else if (windSpeed >= 99.9) {
> var windSpeed_color = "rgba(255,0,120,1)";
> } else if (windSpeed >= 118.0) {
> var windSpeed_color = "rgba(255,1,113,1)";
> }
>
> // Return the color value if requested, otherwise just set the div
> color
> if (returnColor) {
> return windSpeed_color;
> } else {
> jQuery(".curwindspeed").css("color", windSpeed_color);
> }
> }
>
> and
> // Windspeed Metric
> if (data.hasOwnProperty("windSpeed_kph")) {
> windSpeed =
> parseFloat(parseFloat(data["windSpeed_kph"])).toLocaleString("$system_locale_js",
>
> {minimumFractionDigits: unit_rounding_array["windSpeed"],
> maximumFractionDigits: unit_rounding_array["windSpeed"]});
> get_windSpeed_color(windSpeed);
> jQuery(".curwindspeed").html(windSpeed);
>
> I have the complete text as Attachment new_belchertown_js
>
> Thx for you help
>
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/c4d56270-c6b2-4809-924c-38f42ae5b3b3n%40googlegroups.com.