Simple question I hope..
Can I have Sea Level pressure displayed in both mb and inch on my web page and how easy is it to implement
Somebody commented that mb is more common now and they would prefer to see it that way, rather than edit a years worth of data by changing my system settings I thought I may be able to display both
Ie Pressure 30.12in (997mb) or something like
Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 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
If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080
Dual unit display
Moderator: daj
- beteljuice
- Posts: 3292
- Joined: Tue 09 Dec 2008 1:37 pm
- Weather Station: None !
- Operating System: W10 - Threadripper 16core, etc
- Location: Dudley, West Midlands, UK
Re: Dual unit display
If you are talking about the 'standard' html templates you would need to add some JavaScript to do the math for the additional unit.
This bit of code should give whatever the alternative unit is for your current pressure:
and your html would be something like:
Ooops - just realised <#pressunit> option should be 'in' NOT 'inHG' - corrected
This bit of code should give whatever the alternative unit is for your current pressure:
Code: Select all
<script type="text/javascript">
<!--
function showAltBaro(input) {
if(<#pressunit> == "in"){ // convert to hPa
output = (input * 33.86388).toFixed(1);
output += " hPa";
}else{ // convert to inHG
output = (input / 33.86388).toFixed(2);
output += " inHG";
}
document.write(output);
} // END function showAltBaro
-->
</script>
Code: Select all
.....
Pressure <#press> <#pressunit> (<script>showAltBaro(<#press>);</script>)
.....
Last edited by beteljuice on Tue 10 Jan 2012 12:17 pm, edited 1 time in total.
......................Imagine, what you will KNOW tomorrow !
-
R-II
- Posts: 11
- Joined: Wed 21 Dec 2011 8:29 pm
- Weather Station: Smart Weather WH2080
- Operating System: Windows 7
- Location: United Kingdom
Re: Dual unit display
Thanks, i found a way to do it after much fiddling but will try yours to see the effect.
I'm learning as I go along, my next step is to get the gauge to show alternate units via a radio button
Thanks again
I'm learning as I go along, my next step is to get the gauge to show alternate units via a radio button
Thanks again
- beteljuice
- Posts: 3292
- Joined: Tue 09 Dec 2008 1:37 pm
- Weather Station: None !
- Operating System: W10 - Threadripper 16core, etc
- Location: Dudley, West Midlands, UK
Re: Dual unit display
ATM you've 'lost' a table cell.
If you try my code (which I've corrected an error in
), then try this chunk of html:
If you try my code (which I've corrected an error in
Code: Select all
<tr class="td_pressure_data">
<td>Barometer </td>
<td><#press> <#pressunit><br /><script>showAltBaro(<#press>);</script></td>
<td><#presstrend></td>
<td><#presstrendval> inHG/hr<br /><script>showAltBaro(<#presstrendval>);</script>/hr</td>
</tr>
......................Imagine, what you will KNOW tomorrow !
-
scoobs
- Posts: 82
- Joined: Mon 23 Mar 2009 2:50 pm
- Weather Station: WH3080
- Operating System: Windows server
- Location: Skegness
Re: Dual unit display
Hi Richard get yourself an account on the Met office wow site too
be nice to have another station near to compare results.
-
R-II
- Posts: 11
- Joined: Wed 21 Dec 2011 8:29 pm
- Weather Station: Smart Weather WH2080
- Operating System: Windows 7
- Location: United Kingdom
Re: Dual unit display
The loss of cell was deliberate ... well it happened by accident and I quite liked the result, but when i get home i'll have a play with the codebeteljuice wrote:ATM you've 'lost' a table cell.
-
R-II
- Posts: 11
- Joined: Wed 21 Dec 2011 8:29 pm
- Weather Station: Smart Weather WH2080
- Operating System: Windows 7
- Location: United Kingdom
Re: Dual unit display
Will do, glad to see a local face aboutscoobs wrote:Hi Richard get yourself an account on the Met office wow site toobe nice to have another station near to compare results.