With so many additions/changes to these great scripts, I figured why not have a central location.
I added a colored THWS above the thermometer.
Add this to ajaxWDwx.js
// function to add colored thws
function thwsColor(th) {
if (th > 110) { return ('<span style="border: 0px; color: #FFCCFF;"> '+th+''+uomTemp+' </span>'); } //
if (th > 105) { return ('<span style="border: 0px; color: #FF99FF;"> '+th+''+uomTemp+' </span>'); }
if (th > 100) { return ('<span style="border: 0px; color: #CC66CC;"> '+th+''+uomTemp+' </span>'); }
if (th > 95) { return ('<span style="border: 0px; color: #FF6666;"> '+th+''+uomTemp+' </span>'); }
if (th > 90) { return ('<span style="border: 0px; color: #FF9900;"> '+th+''+uomTemp+' </span>'); } //
if (th > 85) { return ('<span style="border: 0px; color: #FFCC00;"> '+th+''+uomTemp+' </span>'); } //GOOD
if (th > 80) { return ('<span style="border: 0px; color: #FFFF33;"> '+th+''+uomTemp+' </span>'); } //good
if (th > 75) { return ('<span style="border: 0px; color: #FFFF66;"> '+th+''+uomTemp+' </span>'); } //good
if (th > 65) { return ('<span style="border: 0px; color: #99FF99;"> '+th+''+uomTemp+' </span>'); } //
if (th > 50) { return ('<span style="border: 0px; color: #66FFFF;"> '+th+''+uomTemp+' </span>'); } //
if (th > 40) { return ('<span style="border: 0px; color: #9999FF;"> '+th+''+uomTemp+' </span>'); } //
if (th > 30) { return ('<span style="border: 0px; color: #6666CC;"> '+th+''+uomTemp+' </span>'); } //
if (th > 15) { return ('<span style="border: 0px; color: #333399;"> '+th+''+uomTemp+' </span>'); } //
if (th > -15) { return ('<span style="border: 0px; color: #993399;"> '+th+''+uomTemp+' </span>'); } //
return th;
}
// ------------------------------------------------------------------------------------------
// main function.. read clientraw.txt and format <span class="ajax" id="ajax..."></span> areas
// THWS added by MadALwx for Alt-Dashboard Script
var thws = (clientraw[142]);
thws = thwsColor(thws);
set_ajax_obs("ajaxthws",thws);
// FeelsLike
Then add this to the ajax-dashboard.php:
<tr>
<td style="text-align: right;" class="data2">THWS:<sup>1</sup></td>
<td style="text-align: left;" class="data2">
<span class="ajax" id="ajaxthws" style="font-size:16px">
<?php echo strip_units($thws) . $uomTemp; ?></span>
</td>
</tr>
Nice add MadALwx. Added to my dashboard.
Chuck
Glad you like. Thanks to Ken for showing me how.
Also added colored 1hr trend baro words. Change the code in ajaxWDwx.js to read:
// Page 52 of the PDF Manual
// http://www.davisnet.com/product_documents/weather/manuals/07395.234-VP2_Manual.pdf
// figure out a text value for barometric pressure trend
if ((btrnd >= -0.7) && (btrnd <= 0.7)) { return ('<span style="border: 0px; color: white;"> '+langBaroTrend[0]+'</span>'); } //steady
if ((btrnd > 0.7) && (btrnd < 2.0)) { return ('<span style="border: 0px; color: #66FF99;"> '+langBaroTrend[1]+'</span>'); } //rising slowly
if (btrnd >= 2.0) { return ('<span style="border: 0px; color: #33CCFF;"> '+langBaroTrend[2]+'</span>'); } //rising rapid
if ((btrnd < -0.7) && (btrnd > -2.0)) { return ('<span style="border: 0px; color: yellow;"> '+langBaroTrend[3]+'</span>'); } //falling slowly
if (btrnd <= -2.0) { return ('<span style="border: 0px; color: white; background-color: #FF0000;"> '+langBaroTrend[4]+'</span>'); } //falling rapidly
return(btrnd);
}
Again thanks for this little mod. Wish I could think of things like this.
Chuck
Are you having problems with THWS showing?
BTW, I really like how you incorp the Sparkline graphs. Can you post it?
It is showing up in Firefox 3.6 and Google Chrome 5.0 and Opera 10.5. Unless it is a certain temp that is doing that. Here is my Sparkline code that is in my dashboard.
<!-- start hourly graphs -->
<table width="688" border="0" cellpadding="2" cellspacing="1">
<tr>
<td style="text-align: left" class="datahead"> Chucksweather.com Hourly Trends</td>
</tr>
<tr>
<td align="center" valign="middle">
<table width="688" border="0" cellpadding="1" cellspacing="2" style="border:solid; border-color: #CCCCCC;">
<tr align="center">
<td> <img src="WDS/wdsparkline.php?chart=temp&unit=fdeg" alt="Graphic: Temp Sparkline Graph" /></td>
<td> <img src="WDS/wdsparkline.php?chart=hum&unit=per" alt="Graphic: Humidity Sparkline Graph" /></td>
<td> <img src="WDS/wdsparkline.php?chart=baro&unit=inhg" alt="Graphic: Barometer Sparkline Graph" /></td>
</tr>
<tr align="center">
<td> <img src="WDS/wdsparkline.php?chart=rain&unit=in" alt="Graphic: Rain Sparkline Graph" /></td>
<td> <img src="WDS/wdsparkline.php?chart=winds&unit=mph" alt="Graphic: Wind Speed Sparkline Graph" /></td>
<td> <img src="WDS/wdsparkline.php?chart=windg&unit=mph" alt="Graphic: Wind Gust Sparkline Graph" /></td>
</tr>
</table>
</td>
</tr>
</table>
<!-- end hourly graphs -->
Chuck
Has anyone incorporated uv from latest.csv vice using Temis? Definitely a more accurate point uv forecast using wxsim latest.csv.
I use my WXSIM UV forecast instead. Here is the code:
<TABLE>
<tr><td style="text-align: left" >
<?php echo $UVfcstDate[$UVptr]; ?> </td>
<td colspan="2" style="text-align: center" ><?php echo set_UV_string($WXSIMuv[$uv]);
?></td></tr><tr><td></td></tr></table>
<?php $UVptr++; // increment counter ?>
<?php $uv=($uv+2); ?>
<?php } ?>
</td>
</tr>
<tr>
<td class="data1" nowrap="nowrap" style="text-align: center; ">
<TABLE><tr><td style="text-align: left" >
<?php echo $UVfcstDate[$UVptr]; ?> </td>
<td colspan="2" style="text-align: center" ><?php echo set_UV_string($WXSIMuv[$uv]); ?></td></tr><tr><td></td></tr></table>
<?php $UVptr++; // increment counter ?>
<?php $uv=($uv+2); ?>
</td>
<?php $UVptr++; // increment counter ?>
</tr>
Thanks weatherbee. Do you have a php script that pulls the forecast from the latest.csv?
I get the UV forecast from plaintext.txt for the dashboard.
Sounds better. I’ll plug the code in. Thanks.
Weatherbee,
Where does $WXSIMuv[$uv] come from? A seperate script?
It comes from plaintext-parser.php. Since you are using that for the WXSIM forecast I would think just adding $WXSIMuv[$uv] would work.
I have the 2nd day working, but not the current day.
<?php } else { // don't have UV sensor .. show UV forecast instead ?>
<tr>
<td class="data1" nowrap="nowrap" style="text-align: right; ">
<?php echo $UVfcstDate[$UVptr]; ?>
<?php echo set_UV_string($WXSIMuv[$uv]); ?>
<?php $UVptr++; // increment counter ?>
<?php $uv=($uv+2); ?>
</td>
</tr>
<tr>
<td class="data1" nowrap="nowrap" style="text-align: left; ">
<?php echo $UVfcstDate[$UVptr]; ?>
<?php echo set_UV_string($WXSIMuv[$uv]); ?>
<?php $UVptr++; // increment counter ?>
<?php $uv=($uv+2); ?>
</td>
<?php $UVptr++; // increment counter in case they have no solar either ?>
</tr>
<?php } // end $haveUV ---------------------------------------- ?>
The update to my script won’t work at all if I add
" <?php } ?>" that is included in your code. The page won’t even load. But when it’s taken out, the current day doesn’t work.
I tried various configs, but nogo.
http://www.knology.net/~blackjack52/indextest.php
Try this:
<?php } else { // don't have UV sensor .. show UV forecast instead ?>
<tr>
<td class="data1" nowrap="nowrap" style="text-align: center; ">
<?php
if ($haveUV) { // Show todays high if evening or yesterdays if morning
?>
<?php if ($time_hour > 12) { // Display Summary if in the evening ?>
<?php langtrans('High Today'); ?>: <span style="font-size: 9px;">
<?php echo $highuv; ?> @ <?php echo fixup_time($highuvtime); ?></span>
<?php $UVptr++; // increment counter ?>
<?php } else { ?>
<?php langtrans('High Yest'); ?>: <span style="font-size: 9px;">
<?php echo $highuvyest; ?> @ <?php echo fixup_time($highuvyesttime); ?></span>
<?php } ?>
<?php } else {?>
<?php if ($WXSIMuv[0] == "") {
$uv=1;$UVptr++; // increment counter;
} else {
$uv=0;
} ?>
<TABLE>
<tr><td style="text-align: left" >
<?php echo $UVfcstDate[$UVptr]; ?> </td>
<td colspan="2" style="text-align: center" ><?php echo set_UV_string($WXSIMuv[$uv]);
?></td></tr><tr><td></td></tr></table>
<?php $UVptr++; // increment counter ?>
<?php $uv=($uv+2); ?>
<?php } ?>
</td>
</tr>
<tr>
<td class="data1" nowrap="nowrap" style="text-align: center; ">
<TABLE><tr><td style="text-align: left" >
<?php echo $UVfcstDate[$UVptr]; ?> </td>
<td colspan="2" style="text-align: center" ><?php echo set_UV_string($WXSIMuv[$uv]); ?></td></tr><tr><td></td></tr></table>
<?php $UVptr++; // increment counter ?>
<?php $uv=($uv+2); ?>
</td>
<?php $UVptr++; // increment counter ?>
</tr>
<?php } // end $haveUV ---------------------------------------- ?>
This figures out when the UV forecast is there. The php problem probably comes because different versions of the dashboard are being used.
That did it. Thank you very much.
Glad it worked for you. You have done some nice work on your site, it looks very nice.
Thanks to help and ideas from people here.