Actually, that won't work. Leave that line alone but below it, add the 
function call. Untested but this seems like it should work. 

update_windSpeed_kph( parseFloat(parseFloat(data["windSpeed_kph"])).
toLocaleString("$system_locale_js", {minimumFractionDigits: 1, 
maximumFractionDigits: 1}) );




On Saturday, August 31, 2019 at 12:53:25 PM UTC-4, Pat wrote:
>
> It's a 2 step process. Looks like you've done step 1 with creating the 
> function. You then need to tell this line to use that function 
> <https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/js/belchertown.js.tmpl#L799>.
>  
> Something like this? Untested:
>
> jQuery(".curwindspeed").text( update_windSpeed_kph( parseFloat(parseFloat(
> data["windSpeed_kph"])).toLocaleString("$system_locale_js", {
> minimumFractionDigits: 1, maximumFractionDigits: 1}) ) );
>
>
>
> On Saturday, August 31, 2019 at 12:07:20 PM UTC-4, Stefan wrote:
>>
>> Hello Pat.
>> Thank you for your answer. I think you mean this one. I had made various 
>> changes, but without success. Which variables do I have to use there? 
>> Do not see any color in the wind.
>>
>> See this: https://www.meteo-oberwallis.ch/wetter/glis/user/
>>
>> // Change the color of the windSpeed_kph variable
>> function update_windSpeed_kph( wind ) {
>>     outTemp = parseFloat( wind ).toFixed(0); // Convert back to decimal 
>> literal
>>     if ( wind <= 0 ) {
>>         jQuery(".curwindspeed").css( "color", "#1278c8" );
>>     } else if ( wind <= -3.8 ) {
>>         jQuery(".curwindspeed").css( "color", "#30bfef" );
>>     } else if ( wind <= 0 ) {
>>         jQuery(".curwindspeed").css( "color", "#1fafdd" );
>>     } else if ( wind <= 4.4 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(0,172,223,1)" );
>>     } else if ( wind <= 10 ) {
>>         jQuery(".curwindspeed").css( "color", "#71bc3c" );
>>     } else if ( wind <= 12.7 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(90,179,41,0.8)" );
>>     } else if ( wind <= 18.3 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(131,173,45,1)" );
>>     } else if ( wind <= 21.1 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(206,184,98,1)" );
>>     } else if ( wind <= 23.8 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(255,174,0,0.9)" );
>>     } else if ( wind <= 26.6 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(255,153,0,0.9)" );
>>     } else if ( wind <= 29.4 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(255,127,0,1)" );
>>     } else if ( wind <= 32.2 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(255,79,0,0.9)" );
>>     } else if ( wind <= 35 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(255,69,69,1)" );
>>     } else if ( wind <= 43.3 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(255,104,104,1)" );
>>     } else if ( wind >= 43.4 ) {
>>         jQuery(".curwindspeed").css( "color", "rgba(218,113,113,1)" );
>>     }
>> }
>>
>> Am Samstag, 31. August 2019 15:03:59 UTC+2 schrieb Pat:
>>>
>>> The code doesn't exist in the skin as it is right now, but it would be 
>>> easy to add. 
>>>
>>> Create a new function in the belchertown.js.tmpl file for the wind speed 
>>> and the colors you want. You could copy something like this for the 
>>> temperature 
>>> <https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/js/belchertown.js.tmpl#L87-L120>.
>>>  
>>> Then have the wind speed go through that function 
>>> <https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/js/belchertown.js.tmpl#L793-L804>
>>>  
>>> to change it's color. Use the temperature live section 
>>> <https://github.com/poblabs/weewx-belchertown/blob/master/skins/Belchertown/js/belchertown.js.tmpl#L751-L755>
>>>  
>>> for an example of this. 
>>>
>>> On Saturday, August 31, 2019 at 5:53:06 AM UTC-4, Stefan wrote:
>>>>
>>>> Hello.
>>>> I have a question. Can the wind speed in Belchertown also be colored? eg 
>>>> from 40 km yellow and from 80 red and from 120 purple? I mean in live 
>>>> view.
>>>>
>>>> [image: Unbenannt.PNG]
>>>>
>>>> Thanks for 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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/0cadb877-4671-43a7-876c-d835470c531c%40googlegroups.com.

Reply via email to