Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3044 7 December 2018. See the Wiki for download

Trend arrow Javascript

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
steve
Cumulus Author
Posts: 26714
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Trend arrow Javascript

Post by steve » Mon 15 Nov 2010 8:55 am

Yes, that too. My slightly autistic nature only lets me process one problem at a time :lol:
Steve

User avatar
mcrossley
Posts: 5231
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Trend arrow Javascript

Post by mcrossley » Mon 15 Nov 2010 9:01 am

Ditto - I hadn't spotted the decimal issue! :lol:

User avatar
steve
Cumulus Author
Posts: 26714
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Trend arrow Javascript

Post by steve » Mon 15 Nov 2010 9:02 am

steve wrote:You can use the web tags which replace the comma with a decimal point,
Actually, there doesn't seem to be one for temperature trend. The standard gauges page uses <#temptrendtext> and <#temptrendtextenglish>
Steve

User avatar
mcrossley
Posts: 5231
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Trend arrow Javascript

Post by mcrossley » Mon 15 Nov 2010 9:07 am

Which is why is it easier to reanme the images steady.png, rising.png, falling.png and then just use...

Code: Select all

<img src="xxxxx\<#temptrendtextenglish>.png" alt="<#temptrendextenglish>" />
(typing on a wobbly train - apologies for mistakes)

corsair
Posts: 5
Joined: Tue 09 Nov 2010 10:38 am
Weather Station: Davis Vantage Pro 2
Operating System: Win Seven

Re: Trend arrow Javascript

Post by corsair » Mon 15 Nov 2010 9:19 am

mcrossley wrote:Which is why is it easier to reanme the images steady.png, rising.png, falling.png and then just use...

Code: Select all

<img src="xxxxx\<#temptrendtextenglish>.png" alt="<#temptrendextenglish>" />
(typing on a wobbly train - apologies for mistakes)
Did the rename to www, no luck! Sorry but I don't understand this... How can I use it? Strange thing that I use same syntax from Station Sensor Led, few lines below, that works perfect...

User avatar
steve
Cumulus Author
Posts: 26714
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Trend arrow Javascript

Post by steve » Mon 15 Nov 2010 9:25 am

Because of this (my very first answer).

var temp = +1,5;
Steve

Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

Re: Trend arrow Javascript

Post by Synewave » Mon 15 Nov 2010 10:07 am

Corsair,

As Mark and Steve have said, it is probably better to use the <#temptrendtext> as the comma as the decimal seperator will cause it to fail. You could write some Javascript to replace the , with a . but this way will be much easier:

Locate this line in your indexT.htm file:

Code: Select all

<td><#temp>&nbsp;<#tempunit></td>
and replace it with:

Code: Select all

<td><#temp>&nbsp;<#tempunit> <img src="images/<#temptrendtext>.png" alt="<#temptrendext>" /></td>
You will also need to rename your up and down arrow images as follows:

up.png becomes Rising.png
down.png becomes Falling.png

These images will need to be in your images folder on your website.

corsair
Posts: 5
Joined: Tue 09 Nov 2010 10:38 am
Weather Station: Davis Vantage Pro 2
Operating System: Win Seven

Re: Trend arrow Javascript

Post by corsair » Mon 15 Nov 2010 10:31 am

THANK YOU, all for your instructions... With Paul's step by step info, I manage it! Thank you Paul! BTW, excellent site! Great job for Great College!! :clap: :clap: If you don't mind, I will ask you for more info about History data in your page!

Synewave
Posts: 642
Joined: Mon 25 Jan 2010 1:55 pm
Weather Station: Watson W-8681
Operating System: Raspian
Location: Brighton, UK
Contact:

Re: Trend arrow Javascript

Post by Synewave » Mon 15 Nov 2010 10:41 am

Corsair,

Glad to see you've got it working. Just had a look at your images folder, although I didn't say so before, you will also need a Steady.png file in your images folder.

Thanks for the compliment about my website.

corsair
Posts: 5
Joined: Tue 09 Nov 2010 10:38 am
Weather Station: Davis Vantage Pro 2
Operating System: Win Seven

Re: Trend arrow Javascript

Post by corsair » Tue 16 Nov 2010 7:01 am

Thank you again Paul. Was there but with small "s"... :lol: Good morning from sunny :evil: Athens

mitmania
Posts: 33
Joined: Tue 07 Feb 2012 11:51 am
Weather Station: WS2350 & Davis VP2
Operating System: Win 7
Location: Italy
Contact:

Re: Trend arrow Javascript

Post by mitmania » Tue 09 Jun 2015 8:44 pm

Hi .... wonder where he constantly make mistakes ... I rewrote the same code 10 times but I do not see anything on Safari or Chrome .... thanks!

<!-- Temperatura_1_linea -->
<tr class="td_temperature_data">
<td><font size="2">Temperatura esterna</font></td>
<td><#temp>&nbsp;<#tempunit><script type="text/javascript">
var temp = <#temptrend>;
if (temp==0){var imagen = "steady.bmp";}
if (temp>0){var imagen = "up.bmp";}
if (temp<0){var imagen = "down.bmp";}
document.write('<img src="http://piavemeteo.altervista.org/images/'+imagen+'"/>');
</script></td>
<td><font size="2">Dew point</font></td>
<td><#dew>&nbsp;<#tempunit></td>
</tr>

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: Trend arrow Javascript

Post by beteljuice » Wed 10 Jun 2015 12:25 am

Because of all the comments above !!!!!

Currently your Cumulus processed script says:
var temp = -1,7;

COMMA decimal delimiter .....
So the maths comparrisons do not work correctly.

As above, use #temptrendenglish method instead.
Image
......................Imagine, what you will KNOW tomorrow !

mitmania
Posts: 33
Joined: Tue 07 Feb 2012 11:51 am
Weather Station: WS2350 & Davis VP2
Operating System: Win 7
Location: Italy
Contact:

Re: Trend arrow Javascript

Post by mitmania » Wed 10 Jun 2015 10:42 am

Ok !!!!!!!!

User avatar
dazza1223
Posts: 426
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Vue
Operating System: raspberry pi 3 +
Location: worthing
Contact:

Re: Trend arrow Javascript

Post by dazza1223 » Sun 28 Jan 2018 1:17 am

Can i use them so it auto refresh the icon with out refresh the page to get the icon to up date
have fun and keep learning

dazza :D

Post Reply