I implemented in JavaScript and used teh Cumulus tags to produce a 'better' one. This shows dawn and dusk twilights in pink as well as full daylight in yellow, and night as midnight blue rather than black. It also keeps the daylight sector centred at 9 O'Clock. Like this... You can see it on my Index page here.
The code to produce this is:
Code: Select all
On your HTML page add an empty span to hold the image:
<span id="daylightChart" style="width:75px; height:75px; margin: 0px 5px; border:0"></span>
Then add some JavaScript to create the image and add it into the span...
<script>
var dayPct = (+'<#daylength>'.split(':')[0] + '<#daylength>'.split(':')[1] / 60) / 24 * 100;
var duskPct = (+'<#daylightlength>'.split(':')[0] + '<#daylightlength>'.split(':')[1] / 60) / 24 * 100;
duskPct -= dayPct;
var nightPct = 100 - dayPct - duskPct;
duskPct /= 2;
document.getElementById('daylightChart').innerHTML = '<img src="http://chart.apis.google.com/chart?' +
'chs=75x75' +
'&chtt=day/night' +
'&chts=000000,12' +
'&chma=0,0,0,0' +
'&chd=t:' + duskPct + ',' + dayPct + ',' + duskPct + ',' + nightPct +
'&cht=p3' +
'&chp=' + (Math.PI - (dayPct + duskPct * 2) / 100 * Math.PI) +
'&chf=bg,s,FFFFFF00' +
'&chco=F046A1,FFD700,F046A1,303060' +
'" alt="day/night ratio"/>';
</script>
'chs=75x75' +
'&chtt=day/night' +
'&chts=000000,12' +
'&chma=0,0,0,0' +
'&chd=t:' + duskPct + ',' + dayPct + ',' + duskPct + ',' + nightPct +
'&cht=p3' +
'&chp=' + (Math.PI - (dayPct + duskPct * 2) / 100 * Math.PI) +
'&chf=bg,s,FFFFFF00' +
'&chco=F046A1,FFD700,F046A1,303060' +
'" alt="day/night ratio"/>');
instead.