Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 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

Temp Arrow won't display?

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Temp Arrow won't display?

Post by William Grimsley »

Hi there,

For some reason, the ajax temp arrow won't display on my ajax-dashboard.php file! I haven't altered the ajaxCUwx.js in any way, so I don't know how this has happened? On a side note, the ajax temp arrow does display using Javascript!

This seems very strange and I don't know how to fix it! :bash:

Please can someone help?

Thanks,

William
User avatar
saratogaWX
Posts: 1185
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Temp Arrow won't display?

Post by saratogaWX »

Hmmm. I see the down-arrow under the big temperature in the ajax-dashboard area with no JavaScript enabled.

To isolate the problem to PHP or JavaScript, which of the following describes the problem you are seeing:

1) arrow DOES NOT appear when page is first loaded, then appears after the AJAX update is done
2) arrow DOES appear when page is first loaded, then disappears after the AJAX update is done
3) arrow DOES NOT appear when page is first loaded, and DOES NOT appear after the AJAX update is done

If (1) then the PHP data for temperature 1 hour ago matches the current temperature in CUtags.php, and the realtime.txt has a more current temperature which is different than the realtime value for 1 hour ago temperature. This is not a bug -- it's the way it works based on the 5-minute update sample in CUtags.php versus the every-few-seconds update in realtime.txt

If (2) it is also not a bug .. the 5-minute ago data had the two temperatures not matching (so an arrow is shown), while the realtime data shows that more recent data has the two temperatures matching, so no arrow is shown.

If (3) is also not a bug. It just means that both the 5-minute ago and the realtime temperatures do not have a difference to display, so no arrow.
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Temp Arrow won't display?

Post by William Grimsley »

Hi Ken,

My problem is 3)

The arrow will not display, like I said. But, there was a temperature difference at the time (in Cumulus), which was -0.5C.

Thanks,

William
User avatar
saratogaWX
Posts: 1185
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Temp Arrow won't display?

Post by saratogaWX »

Actually, your problem is (2) (arrow appears when first loaded, then disappears when AJAX updates the page), so it is a JavaScript issue.

Looking at your page with Firefox and JavaScript enabled, I see the arrow does disappear.

The basic PHP generates this HTML with your CUtags.php values

Code: Select all

<span class="ajax" id="ajaxtemparrow"><img src="./ajax-images/rising.gif" alt="Increased 0.2&deg;C than last hour." title="Increased 0.2&deg;C than last hour." width="7" height="8" style="border: 0; margin: 1px 3px;" /></span>
so the up-arrow image is there when the page first loads.

The ajaxCUwx.js has

Code: Select all

		var temp = convertTemp(realtime[2]);
...
		var temptrend = convertTempRate(realtime[25]);
		var temparrow = ajax_genarrow(temp, temp-temptrend, '', 
			 langTempRising+uomTemp+langTempLastHour,
			 langTempFalling+uomTemp+langTempLastHour,1)
to refresh the arrow (or remove it) based on the realtime.txt fields 2(current temp), 25(temperature trend).
Your realtime.txt has those fields as 5.5 and 8.4 respectively.

Using Firefox Web Developer View Generated Source shows
<span style="" lastobs="&nbsp;" class="ajax" id="ajaxtemparrow">&nbsp;</span>
so the issue is a JavaScript one.

I did a compare of the 'stock' ajaxCUwx.js and your current copy, and found over 30 differences where you have 'tweaked' the code (outside the normal settings area, but not in that specific area). I am unable to reproduce the problem with my Cumulus setup and the stock ajaxCUwx.js so all I can say is:

1) yes, you have a JavaScript (not a PHP) issue.
2) it is in your ajaxCUwx.js
3) since I cannot reproduce the effect on my own setup, I can't do any more diagnosis for you.

Regrets,
Ken
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Temp Arrow won't display?

Post by William Grimsley »

Hi Ken,

Thanks for your explanation.
saratogaWX wrote:I did a compare of the 'stock' ajaxCUwx.js and your current copy, and found over 30 differences where you have 'tweaked' the code (outside the normal settings area, but not in that specific area). I am unable to reproduce the problem with my Cumulus setup and the stock ajaxCUwx.js so all I can say is:

1) yes, you have a JavaScript (not a PHP) issue.
2) it is in your ajaxCUwx.js
3) since I cannot reproduce the effect on my own setup, I can't do any more diagnosis for you.
Ok, I just replaced my ajaxCUwx.js file and the problem still lies, so how can the problem be in the ajaxCUwx.js file? :bash:

Thanks,

William
User avatar
saratogaWX
Posts: 1185
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Temp Arrow won't display?

Post by saratogaWX »

I really wish you'd cease using :bash: :bash: :bash: :bash:

for your emoticon -- it's really unnecessary and it feels like you are trying to bash those who attempt to assist you.

Perhaps :cry: or :x would be a better indicator of your current state. The rest of us will continue to use :roll: or :? based on your questions.

Now to the problem at hand. The reason the JavaScript fails to produce an arrow is that your realtime.txt is not emitting a temperature change value where it should normally exist.

I substituted '|' for the normal blank delimiter so you can see
6/03/2013|21:52:23|3.4|92%|2.2|1.0|1.0|225|0.0|7.8|992.05|SW|1|mph|C|hPa|mm|170.9|0.54|43.0|189.6|11.2|21.7|43|3.4||8.4|15:04|3.4|21:46|18.0|01:27| ...
note the null field in position 25 which is where the temperature difference should be. Since a null is also interpreted as a zero, there is no change detected in the statement

Code: Select all

var temparrow = ajax_genarrow(temp, temp-temptrend, '',
          langTempRising+uomTemp+langTempLastHour,
          langTempFalling+uomTemp+langTempLastHour,1)
so therefore, no arrow is being produced. The JavaScript code in ajaxCUwx.js is working correctly.. it's the realtime.txt that seems to have the issue with a null-content temperature trending value.

I know you've had other postings about installation/re-installation issues .. maybe something happened there that is causing your realtime.txt file to be slightly malformed, and that is causing the display issue you are seeing.
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Temp Arrow won't display?

Post by steve »

That's not the standard realtime.txt file, so it's presumably made up from web tags. The wiki entry for realtime.txt incorrectly said that the web tag for the temperature trend value is <#temptrendval> when in fact it's <#temptrend>. I suspect that was my mistake, apologies. I've corrected the wiki.
Steve
User avatar
saratogaWX
Posts: 1185
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Temp Arrow won't display?

Post by saratogaWX »

Thanks Steve!
Yes, that is likely the cause as I'm using the built-in realtime.txt and it's working fine on two different instances.

William should replace his template for realtime.txt (or switch to using the built-in one instead).

Best regards,
Ken
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Temp Arrow won't display?

Post by William Grimsley »

Thanks guys!

I've just changed the web tag <#temptrendval> to <#temptrend> and now the ajax temp arrow, displays! :D
saratogaWX wrote:I really wish you'd cease using :bash: :bash: :bash: :bash:
Sorry, that emotion I'm not trying to aim at you, that's me getting angry! :lol:
saratogaWX wrote:Perhaps :cry: or :x would be a better indicator of your current state. The rest of us will continue to use :roll: or :? based on your questions.
Ok, I will use those emotion icons, from now on! :D

Thanks very much for your help,

William
Post Reply