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