Page 1 of 1

Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 8:31 am
by captzero
Hi Guys. Probably one for David...

I'm using the Annual Data Summary (js version) and it highlights zero values for rain and rainrate.

I'd like to highlight 'high' values for temperature (+37C) and wind (+50kph) with a view to eventually using a colour scale for temps.

I've created the following in the datasummary.css to create a colour for high value
#table_container .highvalue { color: #CC0000;}

I tried adding the following line in the dayfile.js

if((parseFloat(wd_data[dayfilecol])>37)&&(dayfilecol==6)){$(data_cell).addClass('highvalue');}}

but this disables or crashes the script.

Am I on the right track? Any help is appreciated. Thanks in advance.

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 8:39 am
by daj
Just a quick observation as I have not had time to test it, but if this is a copy and paste of the code you use you have a rouge } at the end of the line, unless it is part of a fuller set of code

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 8:51 am
by captzero
captzero wrote:you have a rouge }
Yes, I pasted too much code in. It should read
if((parseFloat(wd_data[dayfilecol])>37)&&(dayfilecol==6)){$(data_cell).addClass('highvalue');

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 8:53 am
by daj
Ok, let me have a look in more detail.

I also see you are using the compressed version of the JS, which is harder to read and customize.

Here's a easier version to read if you wanted to use it

http://grantownweather.co.uk/historic/r ... ile-max.js

I'll pop your code into my setup and see if I can help you

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 9:05 am
by daj
Dan

I added your code and it worked fine for me -- I had to change the 37 down to 20 for me as I've never had a reading of 37 :-)

I added your line below line 133 of the non-compressed JS

(so I am showing line 133, 134 (new one) and line 135)

Code: Select all

if ((parseFloat(wd_data[dayfilecol].split(',').join('.')) == 0) && (dayfilecol ==14 || dayfilecol ==1)) { $(data_cell).addClass('zerovalue'); }
if((parseFloat(wd_data[dayfilecol])>20)&&(dayfilecol==6)){$(data_cell).addClass('highvalue');}
}
Here it is live on my site

http://grantownweather.co.uk/historic/dataSummary.php

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 9:18 am
by captzero
Thanks David,
daj wrote: had to change the 37 down to 20 for me as I've never had a reading of 37
:lol: I forgot, not everyone lives in Gods country.

Thats good news.

I'll give it a try with the new javascript and report back. Unfortunatly I wont be able to do much right now as I am about to leave for the night.

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 9:21 am
by daj
captzero wrote:I'll give it a try with the new javascript....
Just to be clear, it is the same javascript just formatted for better reading!

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 9:51 pm
by daj
captzero wrote:Thanks David,
daj wrote: had to change the 37 down to 20 for me as I've never had a reading of 37
:lol: I forgot, not everyone lives in Gods country.
You might need to lower your threshold too -- I could not see a temperature of over 37 on your site :shock:

Re: Annual Data Summary - Highlighting High Values

Posted: Wed 15 Jun 2011 10:47 pm
by captzero
daj wrote:I could not see a temperature of over 37 on your site
Yes, true. With the recent La NiƱa and all the wet weather and floods we copped over the summer here, its been an unusually mild summer. I'm planning ahead.
Doh...That also may explain why I wasnt able to see the changes. :bash: Something to look at when I get home this afternoon.

Re: Annual Data Summary - Highlighting High Values

Posted: Thu 16 Jun 2011 9:28 am
by captzero
David,

Thanks for your help with this. I was able to add different colours for a corresponding temperature range / wind / pressure etc. Results here:
http://www.brisbaneliveweather.com/annual.php