Page 1 of 5

Yearly Data Summary--Adding new fields

Posted: Mon 14 Mar 2011 12:20 am
by silverview
I have been playing around with the annual data summary. I would like to add summaries for windrun, windchill, and sunshine hours. I have tried to edit both the readDayfile.php and readDayfile.js using the following: ['sunhours','Sunshine','Hours of Sunshine',true],

I'm having the following problems:

I'm not sure what to put in the first element for the system variable . I'm just guessing when I use sunhours, windchill and windrun. Is there a list of the variables which correspond to each entry in the dayfile.txt?

Using what I have shown above, when I check the resulting web page, there is a button labeled Sunshine, a question mark above the table instead of Hours of Sunshine, and the values in the table are those from Max Temp. http://www.the-vermin.ca/silversprings/ ... mmary.html

Apparently there is more to it than just adding one line to the readDayfile script. I know other users have been able to customize the information that is being displayed, but I'm not able to figure it out. Any help would be appreciated.

Thanks,

Re: Yearly Data Summary--Adding new fields

Posted: Mon 14 Mar 2011 7:38 am
by captzero
Hi Chris,

I modified mine to display wind run, hi / lo pressure but deleted avg temp and min/max as displayed here: http://www.brisbaneliveweather.com/annual.php

I'm using the javascript version so I edited my readDayfile.js file with notepad ++ to look like this:
http://www.brisbaneliveweather.com/readDayfile.js

To add Rain Rate for example....
add this
['rainrate','Rain Rate','Daily Rain Rate (mm/hr)',true],

'rainrate' names the variable, 'Rain Rate' labels the button, and 'Daily Rain Rate (mm/hr)' is what is displayed above the table.

Then I had to add this line:
break;case'rainrate':tablelayout+=label_items[3][2];dayfilecol=12;

dayfilecol=12 points to the column number in the dayfile.txt file. (The first column in the dayfile.txt file is the 'date' column and is number 0, so Rain Rate in the dayfile.txt file is column 13, but 12 in the readDayfile.js )

To display a 'zero value' for the Rain Rate, I also modified this line and added:

if((parseFloat(wd_data[dayfilecol])==0)&&(dayfilecol==14||dayfilecol==1||dayfilecol==12)){$(data_cell).addClass('zerovalue');}}

Have a look at my readDayfile.js and have a play around and experiment. You should be able to add Sunshine Hours easy enough. Don't forget to make a back up of any files you are modifying, just in case.

I hope this helps.

Re: Yearly Data Summary--Adding new fields

Posted: Mon 14 Mar 2011 11:22 am
by daj
I actually just realised that the scripts I included in the pack are slightly 'minified' so all the whitespace is removed making it very difficult to read and modify. I should upload full versions :oops:

Re: Yearly Data Summary--Adding new fields

Posted: Mon 14 Mar 2011 3:10 pm
by silverview
Thanks Dan and David,

Dan, I had looked at your readDayfile previously when I was trying to figure this out. It was considerably different than the readDayfile I was attempting to edit, so I assumed that it had something to do with having a .js table in a .php page. That should give you an idea of the knowledge level I am dealing with here.

However, with the help of your explanation, I will have another look.

Re: Yearly Data Summary--Adding new fields

Posted: Mon 14 Mar 2011 7:53 pm
by captzero
silverview wrote:something to do with having a .js table in a .php page
Thats true. David hadn't released his php version when I tried this but I am slowly converting my site to php. The js version was quick and dirty and works well so I left it as it was.

Re: Yearly Data Summary--Adding new fields

Posted: Mon 14 Mar 2011 8:44 pm
by daj
captzero wrote:The js version was quick and dirty .....
:lol: :lol: :lol:

Re: Yearly Data Summary--Adding new fields

Posted: Wed 06 Jul 2011 6:45 pm
by philcdav
Hi guys.

have been trialling the summary and it works great on my site using the js. script ..

http://www.philcdav.webspace.virginmedi ... mmary.html

What i hoped to do was use the modified script to include pressure.

I replaced the script with Dans mod. but it failed to work at all, just gave blank fields.

Help please

Re: Yearly Data Summary--Adding new fields

Posted: Mon 11 Jul 2011 7:28 pm
by daj
Phil

I'll update with pressure and get back to you

Re: Yearly Data Summary--Adding new fields

Posted: Mon 11 Jul 2011 7:57 pm
by daj
Phil

Question -- you wanting Max or Min pressure for each day? Also, the pressure stored in the dayfile is Sea Level (just so you know!)

Re: Yearly Data Summary--Adding new fields

Posted: Tue 19 Jul 2011 9:08 am
by JennyLeez
Hi David,

Well I have mucked around until blue in face but I aint smart enough.
Please how can I add another row to add more labels.
I have this so far. But as you see they over lap :(
http://wairoa.net/weather/datasummary.php
Many thanks for your help
Jenny

Re: Yearly Data Summary--Adding new fields

Posted: Tue 19 Jul 2011 10:25 am
by beteljuice
You have two different css files to edit ;)

weathermain.css - shadowed-border - width: 850px (increase to suit)

datasummary.css - table_container - width: 840px (increase to suit)

Re: Yearly Data Summary--Adding new fields

Posted: Tue 19 Jul 2011 10:30 am
by JennyLeez
beteljuice wrote:You have two different css files to edit ;)

weathermain.css - shadowed-border - width: 850px (increase to suit)

datasummary.css - table_container - width: 840px (increase to suit)
Correct but this will only fit them across in one row. I want to add more labels so I need two rows please.
Thanks for help so far :)

Re: Yearly Data Summary--Adding new fields

Posted: Tue 19 Jul 2011 11:33 am
by gemini06720
JennyLeez wrote:Please how can I add another row to add more labels.
Jenny, is this what you are looking for: Annual Weather Data Summary - I also have this stand-alone PHP script: Annual Weather Data Summary

Re: Yearly Data Summary--Adding new fields

Posted: Tue 19 Jul 2011 11:55 am
by JennyLeez
gemini06720 wrote:
JennyLeez wrote:Please how can I add another row to add more labels.
Jenny, is this what you are looking for: Annual Weather Data Summary - I also have this stand-alone PHP script: Annual Weather Data Summary
Yes thats it. Lots of labels on more than 1 row.
Can Davids readDayfile.php be written so I may do this please.
I will attach it.
many thanks for your help :)

Re: Yearly Data Summary--Adding new fields

Posted: Tue 19 Jul 2011 11:25 pm
by beteljuice
The beteljuice suggests ...

Where the humble <br /> is inserted is a cosmetic rather than logical decision ie. some button 'labels' will be long - some short, so doing a simple count (say 6 labels / line) won't necessarily look good.

You already have a "data available" array which contains field names, label names and a flag to create the button.

Why not create an additional flag to create 'a new line' following that button ?
Example: (Edit: a REMark in the middle of an array won't work :oops: )

Code: Select all

$label_items = array(
		array('maxtemp','Max Temp','Maximum Temperature',true, false),
		array('mintemp','Min Temp','Minimum Temperature',true, false),
		array('avgtemp','Avg Temp','Average Temperature',true, false),
		array('minmaxt','Min/Max Temp','Min / Max Temperature',true, false),
		array('rainfall','Rainfall','Daily Rainfall',true, false),
		array('rainrate','Rain Rate','Daily Rain Rate (mm/hr)',true, true),
		array('maxpres','Max Pressure','Maximum Sea Level Pressure',true, false),
		array('minpres','Min Pressure','Minimum Sea Level Pressure',true, false),		
		array('windgust','Wind Gust','Highest Wind Gust',true, false),
		array('windspeed','Wind Speed','Highest Average Wind Speed',true, false),
		array('windrun','Wind Run','Daily Wind Run',true, false) );
Then add a line of code to make the menu construct look like this:

Code: Select all

	for ($i = 0; $i < count($label_items); $i++)  {
		if ($label_items[$i][3] == true) {
			$tablelayout .= '<li><a href="' . $_SERVER['PHP_SELF'] .'?year='.$tableYear .'&data=' . $label_items[$i][0] . '">' . $label_items[$i][1] . '</a></li>';
         if($label_items[$i][4] == true) {$tablelayout .= '<br />';}  // Line break check
		}
	}
Should work, but I've got a few things wrong lately :o