Page 1 of 1

Annual Data Summary - Problem!

Posted: Mon 12 Nov 2012 5:28 pm
by grottem
Hi
Trying to get Annual Data Summary to work, but as you see I have not got it right: grottem.com/ver/data/datasummary.php
Have tried both versions (php / html) - but none of them will display the data. Have followed the instructions and changed readayfile.js / php as instructed.
Have been in contact with mcrossley, but he is busy all week so he can't help me. He said that the Annual Summary page is downloading the dayfile.txt OK, so there is some other problem. The script is not producing any errors either.

Any suggestions?

Re: Annual Data Summary - Problem!

Posted: Mon 12 Nov 2012 5:47 pm
by laulau
In readDayfile.php you have to change this part of code
$field_delimiter = ',';

$date_delimiter = '/';
to
$field_delimiter = ';';

$date_delimiter = '.';
Hope it helps

And verify the dayfile.txt path
$dayfile='dayfile.txt';

Re: Annual Data Summary - Problem!

Posted: Mon 12 Nov 2012 6:06 pm
by grottem
Thanks for your reply laulau!!

Have changed lines 28 and 30 in readDayfile.php as you suggested, but no data appears. :shock:

Re: Annual Data Summary - Problem!

Posted: Mon 12 Nov 2012 6:20 pm
by laulau
Did you check the dayfile.txt path in line 15
$dayfile='dayfile.txt';

Re: Annual Data Summary - Problem!

Posted: Mon 12 Nov 2012 6:36 pm
by grottem
I corrected readDayfile.js with your suggestion, and now I get data out on grottem.com/ver/data/datasummary.html :D !!
Thanks for your help laulau!! :clap:

Then I just have to figure out how to mark max and min?

Thanks again!!!!

Re: Annual Data Summary - Problem!

Posted: Mon 12 Nov 2012 8:52 pm
by laulau
Happy to hear that's working now :)
But what do you mean by
Then I just have to figure out how to mark max and min?
:?:

Re: Annual Data Summary - Problem!

Posted: Tue 13 Nov 2012 10:19 pm
by sfws
If you mean you want max and min to look different, try different background colours. See https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=6640for possible look.
If that is what you want, then I can post relevant code extract.

Re: Annual Data Summary - Problem!

Posted: Wed 21 Nov 2012 7:44 am
by grottem
Hello "sfws"

Yes, it was something like that I was thinking of! :)

Re: Annual Data Summary - Problem!

Posted: Wed 21 Nov 2012 8:20 am
by sfws
you are using the jQuery/JavaScript version so:
Maybe you want a different look for days without any values

Code: Select all

tablelayout+='<td class="nondate" datarow="#tr'+d+'" datacol="#tc'+m+'" id="'+d+'-'+mname[m-1]+'">'; // data_cell created as a nondate class for days beyond end of month in short months and days without any data
and days with values

Code: Select all

if (!isNaN(wd_data[dayfilecol])){$(data_cell).removeClass('nondate');$(data_cell).addClass('datacell'); // added to change look of cells with numbers
}
and negative values (modify existing code for zero values by changing = to <=)

Code: Select all

if( (parseFloat( wd_data[dayfilecol].split(',').join('.') )<=0) ){$(data_cell).addClass('zerovalue');}  // amended to change look of negative values in main column 
if(dayfilecol2>0){
							if (!isNaN(wd_data[dayfilecol2])){
								$(data_cell+'-2').removeClass('nondate');$(data_cell+'-2').addClass('b_green');  // amended to change look of cells in second column with numbers
								if( (parseFloat( wd_data[dayfilecol2].split(',').join('.') )<=0) ){$(data_cell+'-2').addClass('zerovalue');} // added to change look of zero and negative values in any second column
Note b_green is a new class, not in original CSS, sets up a different background for 2nd figure of a day if you are displaying say minimum and maximum

Finally, for changing colours at particular values, I don't know what you want. As some hints to help you, one option on my implementation is to display total rainfall (as per original) but to also display in second column the rainfall rate and this is coloured as per rate descriptions listed in Wiki with a colour key appearing in the caption.

Code: Select all

['rain',		'Rainfall',		'Daily Rainfall  - Totals (mm) and (coloured fainter figures) Maximum Rate (mm/hr)',		true], 
is relevant amended line in array declaration

Code: Select all

case'rain':	tablelayout+=label_items[9][2]+' <img src="IMAGE_DIRECTORY/rainfall_key.png" alt="Horizontal bar with sections in various colours">';dayfilecol=14;dayfilecol2=12;break; 
is amended line in switch coding (adds rainfall rate as second figure and adds colour key to caption)

Code: Select all

if(dayfilecol2==12){   // added to change colour of numbers for rainfall rate    
									if((parseFloat(wd_data[dayfilecol2].split(',').join('.')))<0.5) {
										$(data_cell+'-2').css('color',"rgba(0,38,255,0.8)");}
									else if ((parseFloat(wd_data[dayfilecol2].split(',').join('.')))<1) {
										$(data_cell+'-2').css('color', "rgba(0,85,255,0.8)");}
									else if ((parseFloat(wd_data[dayfilecol2].split(',').join('.')))<2) {
										$(data_cell+'-2').css('color',"rgba(127,116,28,0.8)");}
									else if ((parseFloat(wd_data[dayfilecol2].split(',').join('.')))<4) {
										$(data_cell+'-2').css('color',"rgba(255,85,0,0.8)");}
									else if ((parseFloat(wd_data[dayfilecol2].split(',').join('.')))<8) {
										$(data_cell+'-2').css('color',"rgba(255,106,0,0.8)");}
									else if ((parseFloat(wd_data[dayfilecol2].split(',').join('.')))<16) {
										$(data_cell+'-2').css('color',"rgba(255,0,0,0.8)");}
									else if ((parseFloat(wd_data[dayfilecol2].split(',').join('.')))<32) {
										$(data_cell+'-2').css('color',"rgba(255,0,220,0.8)");}
									else {$(data_cell+'-2').css('color',"rgba(198,255,255,0.8)");}
								}
is code that varies text colour for the different rates

Re: Annual Data Summary - Problem!

Posted: Wed 21 Nov 2012 8:52 am
by grottem
Hello, and thanks for quick reply!

Now I have something to do since I'm not so familiar with programing! 8-)
I'm using Javascript since I cant't get php to work (grottem.com/ver/data/datasummary.php).
Have been cheking the forum for answers - and tried everything :cry:

Thank's anyway for your help!!! :clap: