Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 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

Annual data Summary (DAJ script) - show day-of-week

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
mikechristelow
Posts: 165
Joined: Wed 01 Feb 2012 9:33 pm
Weather Station: Watson W8681 (solar)
Operating System: Windows XP SP3
Location: Crewe, Cheshire
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mikechristelow »

Tests proving it may be time for a beer and a break :bash:

When I run Mark's test page it works exactly as expected, with the days of the week shown for all values of the month currently selected. :clap:
annual-data-summary mcrossley test.PNG
When I crib Mark's code and replace my own readDayfile.js with it, only the table header and lefthand border appear - all the data values are blank. :o
annual-data-summary mcrossley script my site.PNG
When I use the Beteljuice's original script, I get the header, border and data but not - obviously - the full days-of-the-week content against each date in the month (which is what the Beteljuice set out to achieve I beleive :P ).
annual-data-summary betejuice script my site.PNG
Soooo - have I missed something (well, I obviously must have!!!) - a .css element perhaps? I can't see the wood for the proverbial trees now :roll:
You do not have the required permissions to view the files attached to this post.
http://www.christelow.co.uk
“It's snowing still," said Eeyore gloomily.
"So it is."
"And freezing."
"Is it?"
"Yes," said Eeyore. "However," he said, brightening up a little, "we haven't had an earthquake lately.”

User avatar
mcrossley
Posts: 12767
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mcrossley »

mikechristelow wrote:Soooo - have I missed something (well, I obviously must have!!!) - a .css element perhaps? I can't see the wood for the proverbial trees now :roll:
No CSS changes in mine from beteljuices. All the changes in the JS file from the beteljuice version I have now commented with "// NEW - mcrossley". Take a look at the latest version, clear your cache if necessary.

So that is lines (in my file): 100, 105, 133, and 143.
User avatar
mikechristelow
Posts: 165
Joined: Wed 01 Feb 2012 9:33 pm
Weather Station: Watson W8681 (solar)
Operating System: Windows XP SP3
Location: Crewe, Cheshire
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mikechristelow »

Hi Mark,
Done that and still the same - table header and column with days-of-week and day-of-month appear, plus the highlighted cell and corresponding elemnts in the boder and header, but no data showing in the tablke itself. Very bizarre!! :?
Time for a break, I'll take another look tomorrow.
Thanks to both you and the Beteljuice for all the great work so far! :clap:
http://www.christelow.co.uk
“It's snowing still," said Eeyore gloomily.
"So it is."
"And freezing."
"Is it?"
"Yes," said Eeyore. "However," he said, brightening up a little, "we haven't had an earthquake lately.”

User avatar
mcrossley
Posts: 12767
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mcrossley »

Mike, I had a look at your page and edited the script on the fly. I could get the day names working, but the call to "$.get(dayfile, function(){..." is not returning the dayfile.txt from your web server. The web server is verrrrry slow though. This is why there isn't any data in the table when I was playing with it.

The code I used was...

Code: Select all

// Annual Weather data summary
//
// javascript to process dayfile.txt and produce the table layout
//
// Author: David A Jamieson (daj@findmyinbox.co.uk)
// Version: 1.1
// Updated: 7 March 2011
// Dec 3 2013 beteljuice bodge tp display Day Of Week
//
// You may use and modify this code freely, however you should continue to
// acknowledge the original author
//


var dayfile='data/dayfile.txt';

var mn = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];

var dy = ['Sun','Mon','Tue','Wed','Thur','Fri','Sat']; // NEW - beteljuice

var label_items = [
		['maxtemp','Hi Temp','Maximum Temperature (°C)',true],
		['mintemp','Lo Temp','Minimum Temperature (°C)',true],
		['avgtemp','Avg Temp','Average Temperature (°C)',true],
		['rainfall','Rainfall','Rainfall (mm)',true],
		['rainrate','Rain Rate','Rain rate (mm/hr)',true],
		['maxpres','Hi Press','High Pressure (hPa)',true],
		['minpres','Lo Press','Low Pressure (hPa)',true],
		['windspeed','Wind Speed','Highest Wind Speed (kph)',true],
		['windgust','Wind Gust','Highest Wind Gust (kph)',true],
		['windrun','Wind Run','Wind Run (miles)',true],
		['heatdeg','Heat Deg','Heating Degree Days',true],
		['cooldeg','Cool Deg','Cooling Degree Days',true] ];

var tableDiv='#tableData';

var field_delimiter = ",";

var date_delimiter  = "/";
	
// ----------------------------------------------------
// Nothing to edit below here


function drawCalendar(tableYear,whatdata){
	var tablelayout='<div id="table_container"><div id="table_menu">';tablelayout+='<ul>'
	for(var i=0;i<label_items.length;i++){
		if(label_items[i][3]==true){
			tablelayout+='<li><a href="javascript:" onclick="drawCalendar('+String(tableYear)+',\''+label_items[i][0]+'\');">'+label_items[i][1]+'</a></li>';
		}
	}
	tablelayout+='</ul>'
	tablelayout+='<div id="table_name"><p>';dayfilecol2=0;
	switch(whatdata){
		case'maxtemp':tablelayout+=label_items[0][2];dayfilecol=6;break;
		case'mintemp':tablelayout+=label_items[1][2];dayfilecol=4;break;
		case'avgtemp':tablelayout+=label_items[2][2];dayfilecol=15;break;
		case'rainfall':tablelayout+=label_items[3][2];dayfilecol=14;break;
		case'rainrate':tablelayout+=label_items[4][2];dayfilecol=12;break;
		case'maxpres':tablelayout+=label_items[5][2];dayfilecol=10;break;
		case'minpres':tablelayout+=label_items[6][2];dayfilecol=08;break;
		case'windspeed':tablelayout+=label_items[7][2];dayfilecol=17;break;
		case'windgust':tablelayout+=label_items[8][2];dayfilecol=1;break;
		case'windrun':tablelayout+=label_items[9][2];dayfilecol=16;break;
		case'heatdeg':tablelayout+=label_items[10][2];dayfilecol=40;break;
		case'cooldeg':tablelayout+=label_items[11][2];dayfilecol=41;break;
		default:tablelayout+='?';
	}
	tablelayout+='</p></div></div>';
	tablelayout+="<table>";
	tablelayout+="<tr>";
	tablelayout+='<th id="table_year">'+String(tableYear)+'</th>';
	for(m=1;m<=12;m++){
		tablelayout+='<th ';
		if(dayfilecol2>0){tablelayout+='colspan="2" ';}
		tablelayout+='id="tc'+(m)+'">'+mn[m-1]+'</th>';
	}
	tablelayout+="</tr>";
	for(d=1;d<=31;d++){
		tablelayout+='<tr>';
// OLD		tablelayout+='<th id="tr'+d+'">'+d+'</th>';
			part1 = '<td id="tr'+d+'">'; // NEW - beteljuice
			part2 = ''; // NEW - beteljuice

		for(m=1;m<=12;m++){
			if(d<=daysInMonth(m,tableYear)){
				theDate = new Date(tableYear, m-1, d); // NEW - beteljuice
				theDay = dy[theDate.getDay()]; // NEW - beteljuice
// OLD         tablelayout+='<td class="datacell" datarow="#tr'+d+'" datacol="#tc'+m+'" id="'+d+'-'+mn[m-1]+'">';
//            part1 += '<span style="display: none;" id="dd'+d+'_'+mn[m-1]+'">'+theDay+'</span>'; // NEW - beteljuice
//            part2+='<td class="datacell" dataday="#dd'+d+'_'+mn[m-1]+'" datarow="#tr'+d+'" datacol="#tc'+m+'" id="'+d+'-'+mn[m-1]+'">'; // NEW - beteljuice
            part1 += '<span style="display: none;" class="'+mn[m-1]+'">'+theDay+'</span>'; // NEW - mcrossley
            part2+='<td class="datacell" datamon=".'+mn[m-1]+'" datarow="#tr'+d+'" datacol="#tc'+m+'" id="'+d+'-'+mn[m-1]+'">'; // NEW - mcrossley
            if(dayfilecol2>0){
// OLD            tablelayout+='<td class="datacell" datarow="#tr'+d+'" datacol="#tc'+m+'" id="'+d+'-'+mn[m-1]+'-2">';
//               part2+=tablelayout+='<td class="datacell" dataday="#dd'+d+'_'+mn[m-1]+'" datarow="#tr'+d+'" datacol="#tc'+m+'" id="'+d+'-'+mn[m-1]+'-2">'; // NEW - beteljuice
               part2+='<td class="datacell" datamon=".'+mn[m-1]+'" datarow="#tr'+d+'" datacol="#tc'+m+'" id="'+d+'-'+mn[m-1]+'-2">'; // NEW - mcrossley
				}
			}
			else
			{
// OLD			tablelayout+='<td class="nondate"';
				part2 +='<td class="nondate"'; // NEW - beteljuice
// OLD			if(dayfilecol2>0){tablelayout+='colspan="2" ';}
				if(dayfilecol2>0){part2+='colspan="2" ';}
// OLD			tablelayout+='>';
				part2+='>'; // NEW - beteljuice
			}
// OLD		tablelayout+='</td>';
			part2+='</td>'; // NEW - beteljuice
		}
// new - stitch the 'row' together
		tablelayout+= part1+' '+d+'</th>'+part2; // NEW - beteljuice
		tablelayout+='</tr>';
	}
	tablelayout+='</table></div>';
	$(tableDiv).html(tablelayout);
	if(dayfilecol2>0){
		$(".datacell").addClass('smallfont');
	}
	$(".datacell").hover(function(){
		var trow=$(this).attr("datarow");
		var tcol=$(this).attr("datacol");
//      var tday=$(this).attr("dataday"); // NEW - beteljuice
      var tday=$(this).attr("datamon"); // NEW - mcrossley
		$(trow).addClass("highlight");
		$(tcol).addClass("highlight");
		$(this).addClass("highlight");
		$(tday).show(); // NEW - beteljuice
		},
		function(){
			var trow=$(this).attr("datarow");
			var tcol=$(this).attr("datacol");
//         var tday=$(this).attr("dataday"); // NEW - beteljuice
         var tday=$(this).attr("datamon"); // NEW - mcrossley
			$(trow).removeClass("highlight");
			$(tcol).removeClass("highlight");
			$(this).removeClass("highlight");
			$(tday).hide(); // NEW - beteljuice
	});
	var current_year=-1;
	var year_list='<select onchange="drawCalendar(this.value,\''+whatdata+'\');">';
	$.get(dayfile,function(data){
		var lines=data.split("\n");
		$.each(lines,function(n,elem){
			wd_data=elem.split(field_delimiter);
			the_date=wd_data[0].split(date_delimiter);
			if('20'+the_date[2]==String(tableYear)){
				data_cell='#'+String(parseInt(the_date[0],10))+'-'+mn[parseInt(the_date[1],10)-1];
				$(data_cell).html(wd_data[dayfilecol]);
				if(dayfilecol2>0){
					$(data_cell+'-2').html(wd_data[dayfilecol2]);
				}
				if((parseFloat(wd_data[dayfilecol].split(',').join('.'))==0)&&(dayfilecol==14||dayfilecol==1)){
					$(data_cell).addClass('zerovalue');
				}
				// Minimum, Maximum & Average Temperature
				if((parseFloat(wd_data[dayfilecol])>=30.0)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_extremehot');}
				if((parseFloat(wd_data[dayfilecol])<=29.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_veryhot');}
				if((parseFloat(wd_data[dayfilecol])<=27.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_hot');}
				if((parseFloat(wd_data[dayfilecol])<=24.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_verywarm');}
				if((parseFloat(wd_data[dayfilecol])<=19.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_warm');}
				if((parseFloat(wd_data[dayfilecol])<=16.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_moderate');}
				if((parseFloat(wd_data[dayfilecol])<=12.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_cool');}
				if((parseFloat(wd_data[dayfilecol])<=6.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_cold');}
				if((parseFloat(wd_data[dayfilecol])<=2.9)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_verycold');}
				if((parseFloat(wd_data[dayfilecol])<=0.0)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_freezing');}
				if((parseFloat(wd_data[dayfilecol])<= -10.0)&&(dayfilecol==4||dayfilecol==6||dayfilecol==15)){$(data_cell).addClass('mt_deepfreeze');}

				// Total Rainfall
				if((parseFloat(wd_data[dayfilecol])>=100.0)&&(dayfilecol==14)){$(data_cell).addClass('rf_extremehigh');}
				if((parseFloat(wd_data[dayfilecol])<=74.9)&&(dayfilecol==14)){$(data_cell).addClass('rf_veryhigh');}            
				if((parseFloat(wd_data[dayfilecol])<=49.9)&&(dayfilecol==14)){$(data_cell).addClass('rf_higher');}
				if((parseFloat(wd_data[dayfilecol])<=24.9)&&(dayfilecol==14)){$(data_cell).addClass('rf_high');}
				if((parseFloat(wd_data[dayfilecol])<=12.4)&&(dayfilecol==14)){$(data_cell).addClass('rf_low');}
				if((parseFloat(wd_data[dayfilecol])<=7.9)&&(dayfilecol==14)){$(data_cell).addClass('rf_lower');}
				if((parseFloat(wd_data[dayfilecol])<=3.9)&&(dayfilecol==14)){$(data_cell).addClass('rf_verylow');}
				if((parseFloat(wd_data[dayfilecol])<=0.9)&&(dayfilecol==14)){$(data_cell).addClass('rf_extremelow');}            
				if((parseFloat(wd_data[dayfilecol])==0.0)&&(dayfilecol==14)){$(data_cell).addClass('rf_zero');}
				
				// Rain Rate
				if((parseFloat(wd_data[dayfilecol])>=50.0)&&(dayfilecol==12)){$(data_cell).addClass('rr_extremerain');}
				if((parseFloat(wd_data[dayfilecol])<=49.9)&&(dayfilecol==12)){$(data_cell).addClass('rr_veryheavyrain');}            
				if((parseFloat(wd_data[dayfilecol])<=15.9)&&(dayfilecol==12)){$(data_cell).addClass('rr_heavyrain');}
				if((parseFloat(wd_data[dayfilecol])<=3.9)&&(dayfilecol==12)){$(data_cell).addClass('rr_moderaterain');}
				if((parseFloat(wd_data[dayfilecol])<=0.9)&&(dayfilecol==12)){$(data_cell).addClass('rr_lightrain');}
				if((parseFloat(wd_data[dayfilecol])<=0.25)&&(dayfilecol==12)){$(data_cell).addClass('rr_verylightrain');}
				if((parseFloat(wd_data[dayfilecol])==0.0)&&(dayfilecol==12)){$(data_cell).addClass('rr_grey');}
				
				// High Pressure
				if((parseFloat(wd_data[dayfilecol])>=1050.00)&&(dayfilecol==10)){$(data_cell).addClass('bar_extremehigh');}
				if((parseFloat(wd_data[dayfilecol])<=1049.99)&&(dayfilecol==10)){$(data_cell).addClass('bar_veryhigh');}
				if((parseFloat(wd_data[dayfilecol])<=1034.99)&&(dayfilecol==10)){$(data_cell).addClass('bar_higher');}
				if((parseFloat(wd_data[dayfilecol])<=1019.99)&&(dayfilecol==10)){$(data_cell).addClass('bar_high');}
				if((parseFloat(wd_data[dayfilecol])<=1004.99)&&(dayfilecol==10)){$(data_cell).addClass('bar_low');}
				if((parseFloat(wd_data[dayfilecol])<=999.99)&&(dayfilecol==10)){$(data_cell).addClass('bar_lower');}
				if((parseFloat(wd_data[dayfilecol])<=989.99)&&(dayfilecol==10)){$(data_cell).addClass('bar_verylow');}
				if((parseFloat(wd_data[dayfilecol])<=979.99)&&(dayfilecol==10)){$(data_cell).addClass('bar_extremelow');}    
				
				// Low Pressure
				if((parseFloat(wd_data[dayfilecol])>=1040.00)&&(dayfilecol==8)){$(data_cell).addClass('bar_extremehigh');}
				if((parseFloat(wd_data[dayfilecol])<=1039.99)&&(dayfilecol==8)){$(data_cell).addClass('bar_veryhigh');}
				if((parseFloat(wd_data[dayfilecol])<=1024.99)&&(dayfilecol==8)){$(data_cell).addClass('bar_higher');}
				if((parseFloat(wd_data[dayfilecol])<=1009.99)&&(dayfilecol==8)){$(data_cell).addClass('bar_high');}
				if((parseFloat(wd_data[dayfilecol])<=994.99)&&(dayfilecol==8)){$(data_cell).addClass('bar_low');}
				if((parseFloat(wd_data[dayfilecol])<=989.99)&&(dayfilecol==8)){$(data_cell).addClass('bar_lower');}
				if((parseFloat(wd_data[dayfilecol])<=979.99)&&(dayfilecol==8)){$(data_cell).addClass('bar_verylow');}
				if((parseFloat(wd_data[dayfilecol])<=969.99)&&(dayfilecol==8)){$(data_cell).addClass('bar_extremelow');}
				
				// Wind Speed and Gust
				if((parseFloat(wd_data[dayfilecol])>=118.0)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_hurricane');}
				if((parseFloat(wd_data[dayfilecol])<=117.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_violent_storm');}
				if((parseFloat(wd_data[dayfilecol])<=101.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_storm');}
				if((parseFloat(wd_data[dayfilecol])<=87.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_strong_gale');}
				if((parseFloat(wd_data[dayfilecol])<=73.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_gale');}
				if((parseFloat(wd_data[dayfilecol])<=60.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_high_wind');}
				if((parseFloat(wd_data[dayfilecol])<=48.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_strong_breeze');}
				if((parseFloat(wd_data[dayfilecol])<=37.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_fresh_breeze');}            
				if((parseFloat(wd_data[dayfilecol])<=27.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_moderate_breeze');}
				if((parseFloat(wd_data[dayfilecol])<=18.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_gentle_breeze');}
				if((parseFloat(wd_data[dayfilecol])<=10.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_light_breeze');}
				if((parseFloat(wd_data[dayfilecol])<=4.9)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_light_air');}
				if((parseFloat(wd_data[dayfilecol])<=0.0)&&(dayfilecol==17||dayfilecol==1)){$(data_cell).addClass('wnd_calm');}
				
				// Wind Run
				if((parseFloat(wd_data[dayfilecol])>=550.0)&&(dayfilecol==16)){$(data_cell).addClass('wrun_extremehigh');}
				if((parseFloat(wd_data[dayfilecol])<=549.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_veryhigh');}
				if((parseFloat(wd_data[dayfilecol])<=399.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_higher');}
				if((parseFloat(wd_data[dayfilecol])<=249.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_high');}
				if((parseFloat(wd_data[dayfilecol])<=144.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_low');}
				if((parseFloat(wd_data[dayfilecol])<=99.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_lower');}
				if((parseFloat(wd_data[dayfilecol])<=49.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_verylow');}
				if((parseFloat(wd_data[dayfilecol])<=24.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_extremelow');}
				if((parseFloat(wd_data[dayfilecol])<=4.9)&&(dayfilecol==16)){$(data_cell).addClass('wrun_deadcalm');}
				
				// Heating Degree Days
				if((parseFloat(wd_data[dayfilecol])>=25.0)&&(dayfilecol==40)){$(data_cell).addClass('htg_extremehigh');}
				if((parseFloat(wd_data[dayfilecol])<=24.9)&&(dayfilecol==40)){$(data_cell).addClass('htg_veryhigh');}
				if((parseFloat(wd_data[dayfilecol])<=15.9)&&(dayfilecol==40)){$(data_cell).addClass('htg_higher');}
				if((parseFloat(wd_data[dayfilecol])<=12.9)&&(dayfilecol==40)){$(data_cell).addClass('htg_high');}
				if((parseFloat(wd_data[dayfilecol])<=5.9)&&(dayfilecol==40)){$(data_cell).addClass('htg_low');}
				if((parseFloat(wd_data[dayfilecol])<=3.9)&&(dayfilecol==40)){$(data_cell).addClass('htg_lower');}
				if((parseFloat(wd_data[dayfilecol])<=1.9)&&(dayfilecol==40)){$(data_cell).addClass('htg_verylow');}
				if((parseFloat(wd_data[dayfilecol])<=0.0)&&(dayfilecol==40)){$(data_cell).addClass('htg_extremelow');}
				// Cooling Degree Days
				if((parseFloat(wd_data[dayfilecol])>=25.0)&&(dayfilecol==41)){$(data_cell).addClass('clg_extremehigh');}
				if((parseFloat(wd_data[dayfilecol])<=24.9)&&(dayfilecol==41)){$(data_cell).addClass('clg_veryhigh');}
				if((parseFloat(wd_data[dayfilecol])<=15.9)&&(dayfilecol==41)){$(data_cell).addClass('clg_higher');}
				if((parseFloat(wd_data[dayfilecol])<=12.9)&&(dayfilecol==41)){$(data_cell).addClass('clg_high');}
				if((parseFloat(wd_data[dayfilecol])<=5.9)&&(dayfilecol==41)){$(data_cell).addClass('clg_low');}
				if((parseFloat(wd_data[dayfilecol])<=3.9)&&(dayfilecol==41)){$(data_cell).addClass('clg_lower');}
				if((parseFloat(wd_data[dayfilecol])<=1.9)&&(dayfilecol==41)){$(data_cell).addClass('clg_verylow');}
				if((parseFloat(wd_data[dayfilecol])<=0.0)&&(dayfilecol==41)){$(data_cell).addClass('clg_extremelow');}
			}
			if(the_date[2]>current_year){
				current_year=the_date[2];
				year_list+='<option value="';
				year_list+='20'+the_date[2]+'"';
				if('20'+the_date[2]==String(tableYear)){
					year_list+=' selected="selected"';
				}
				year_list+='>20'+String(the_date[2])+'</option>';
			}
		});
		year_list+='</select>';
		$('#table_year').html(year_list);
	});
}
function daysInMonth(month,year){
	return new Date(year,month,0).getDate();
}
$(document).ready(function(){
	var urlParams={};
	(function(){
		var e,a=/\+/g,r=/([^&=]+)=?([^&]*)/g,d=function(s){
			return decodeURIComponent(s.replace(a," "));
		},q=window.location.search.substring(1);
		while(e=r.exec(q))urlParams[d(e[1])]=d(e[2]);
	})();
	if(urlParams['year']){
		drawYear=urlParams['year'];
	}else{
		var d=new Date();
		var curr_date=d.getDate();
		drawYear=d.getFullYear();
	}
	if(urlParams['data']){
		dataSet=urlParams['data'];
	}else{
		dataSet='maxtemp';
	}
	drawCalendar(drawYear,dataSet);
});
Last edited by mcrossley on Mon 30 Dec 2013 10:58 pm, edited 1 time in total.
User avatar
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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

Mark wrote:Actually there is a problem ..
Ta corrected my code posted earlier.

@ Chris - you do have the correct path set to your dayfile.txt ?
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
mikechristelow
Posts: 165
Joined: Wed 01 Feb 2012 9:33 pm
Weather Station: Watson W8681 (solar)
Operating System: Windows XP SP3
Location: Crewe, Cheshire
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mikechristelow »

Hi Mark,
Hmmm :? That's just weird!
I'd replaced the readDayfile.js with the code you modded and hey-presto - it now works. Looking at this version compared with the one I had previously it looks like I'd managed to mess something up in the for(m=1;m<=12;m++) {...} loop but I can't recall how.
Anyway, the page now shows exactly how I wanted it to!
annual-data-summary mcrossley script version 2 my site.PNG
I'm intrigued with your experience of my server. I run my Cumulus site on a Netgear ReadyNAS Duo, with a gigabit wired network connected to BT Home Hub "2" with an Infinity2 broadband service. I checked the link only yesterday morning and got 44Mbps down and 15Mbps up though I notice tonight it is showing 26.7Mbps down (burst = 32.4Mbps) and just 4Mbps up). These are a bit rubbish compared with your PlusNet stats but I would have thought they'd be adequate for web traffic? Need to give that some more thought too :)

Many thanks for your help with the datasummary stuff. BTW did you get to choose a holiday? :lol: :lol:
You do not have the required permissions to view the files attached to this post.
http://www.christelow.co.uk
“It's snowing still," said Eeyore gloomily.
"So it is."
"And freezing."
"Is it?"
"Yes," said Eeyore. "However," he said, brightening up a little, "we haven't had an earthquake lately.”

User avatar
mcrossley
Posts: 12767
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by mcrossley »

That is weird Mike (sorry I think I called you Chris before), I'm pretty sure that the line speeds aren't the issue. The transfer rates I am getting from your server are really bad, your datasummary page takes over 4 minutes to load. The initial responses are pretty quick, but the data transfer is the slow bit.
Capture.JPG
Edit: Still researching the holiday!
You do not have the required permissions to view the files attached to this post.
User avatar
PaulMy
Posts: 3849
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by PaulMy »

After some more learning and experimenting I got it to work http://www.komokaweather.com/weather/datasummary.php

Thanks,
Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
User avatar
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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

EDIT: cross posting, well done paul :clap:

EDIT: The reason it seemed to work was because both the php and JS version have the same id for the data table.
By including the JS version into the php page the hard work done by the server in php was being overwritten by the JS version when it hit the browser.
However: The JS instructions written by the php remain, thus the JS version content, but conflicting hover instructions.

I was going to say ...
@ paulmy - Have you got a properly working version of the PHP (readDayfile.php).

The version I got from the wiki seems to have bugs !
I corrected one, but found more and must assume it's not the one that people are actually using !!!

Here's the buggy take: PHP version - min/max doesn't mouseover correctly and font sizes 'break' the table.

WAIT A MINUTE .... you've done some unholy alliance running external js ... hmmm
Last edited by beteljuice on Wed 01 Jan 2014 3:34 pm, edited 2 times in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
PaulMy
Posts: 3849
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by PaulMy »

I was trying it on my coloured version http://www.komokaweather.com/weather/da ... olour1.php as well but then I lost the colour so more trial and error experimenting to do, or maybe something else is needed.

Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
User avatar
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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

OK - I've fixed min / max bug, only css (font size) a bit sick. PHP test, but I don't know if I'm working with the right php version !!!!

(Surely you don't normally load up a separate js file ??)
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
PaulMy
Posts: 3849
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by PaulMy »

WAIT A MINUTE .... you've done some unholy alliance running external js ... hmmm
(Surely you don't normally load up a separate js file ??)
:oops: I wasn't sure what/how to use the code posted as my experimenting by adding it in my datasummary.php file failed, so when I noticed it said javascript I thought I could save it as .js file and then added an additional line in datasummary.php and that worked (maybe I should have put that posted code in <script> </script>?) I probably broke every rule in my trial and error approach but I do get results, sometimes :roll:

I appreciate the help and guidance that steers me in the right direction though.
Paul
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
User avatar
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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

That explains why on one occasion I got too many cells highlighted and two or three days being displayed on your php page.

On the assumption your page is mostly based on the one I downloaded the cell definitions are different, thus the JS for 'hover' is different, and how are the daynames being worked out and added to to the 'day' cell ?

Give me a copy of your readDayfile.php and I'll try modding it.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
PaulMy
Posts: 3849
Joined: Sun 28 Sep 2008 11:54 pm
Weather Station: Davis VP2 Plus 24-Hour FARS
Operating System: Windows8 and Windows10
Location: Komoka, ON Canada
Contact:

Re: Annual data Summary (DAJ script) - show day-of-week

Post by PaulMy »

Thanks, files attached,

Paul
readDayfile-colour1.txt
You do not have the required permissions to view the files attached to this post.
VP2+
C1 www.komokaweather.com/komokaweather-ca
MX https://komokaweather.com/cumulusmx/index.htm /index.html /index.php
MX https://komokaweather.com/cumulusmxwll/index.htm /index.html /index.php
MX https:// komokaweather.com/cumulusmx4/index.htm
Image
User avatar
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: Annual data Summary (DAJ script) - show day-of-week

Post by beteljuice »

The two files have been coded differently !

I have modified the more extensive 'coloured' version.
I have also added an extra line in the css to re-use what was the redundant hover cell highlight to give a white border to aid 'location'

Edit: - comment removed, looking at wrong persons screenshot :oops:

BTW - I've changed none of the set-up so it's trawling your data :?

WARNING - It doesn't like Jan 1st !
I hope it works from the 2nd Jan 2014 onward, else there are some real problems !

It was working from UK server inspecting USA timestamp - doh (although really it should be able to cope)

PHP with colours

EDIT: Improved css, cells no longer 'twitch' on hover and border increased.

Here are the zipped files:
readDayfile-colour.zip
You do not have the required permissions to view the files attached to this post.
Last edited by beteljuice on Thu 02 Jan 2014 11:49 pm, edited 2 times in total.
Image
......................Imagine, what you will KNOW tomorrow !
Post Reply