// JavaScript Document $(function(){ var wakuDiv02w = document.getElementById('waku2'); var dispMonth = "10"; if ( ! wakuDiv02w || ! wakuDiv02w.getContext ) { return false; } var selMonth = new Date( 2016, dispMonth-2, 1 ); var ctx = wakuDiv02w.getContext('2d'); ctx.font= 'bold 15px sans-serif'; var myTime = new Array('0:00','6:00','12:00','18:00','0:00','6:00','12:00','18:00','0:00'); var indexHum = new Array(0,20,40,60,80,100,120,140); //湿度 if(dispMonth > 10 || dispMonth < 5){ var indexTemp = new Array(-20,-15,-10,-5,0,5,10,15); //気温 }else{ var indexTemp = new Array(0,5,10,15,20,25,30,35); //気温 } var indexSun = new Array(0,6,12,18,24,30); //日射量 var indexRain = new Array(25,20,15,10,5,0); //降水量 var wakuWidth = 750; var wakuHeight = 240; var split_lineX = 62; var split_lineY1 = 7; var split_lineY2 = 5; var px = 65.5; var py = 60.5; var splitLineX = wakuWidth / split_lineX; var splitLineY1 = wakuHeight / split_lineY1; var splitLineY2 = wakuHeight / split_lineY2; var fontX = 5; var fontY = 3; ctx.strokeStyle = "rgb(187,187,187)"; ctx.lineWidth = 1; //縦線 for(i = 4; i < split_lineX; i=i+7){ var p1 = 0; ctx.beginPath(); ctx.moveTo((i*splitLineX)+px+p1, py); ctx.lineTo((i*splitLineX)+px+p1, py+wakuHeight); ctx.stroke(); } ctx.fillStyle = '#5a3407'; ctx.font= "bold 13pt 'ヒラギノ角ゴ Pro W3'"; ctx.textAlign = 'center'; ctx.fillText("日射量・降水量グラフ", (wakuWidth/2) + px, 25, 200); ctx.fillStyle = '#333333'; ctx.font= "bold 10pt 'ヒラギノ角ゴ Pro W3'"; ctx.textAlign = 'center'; ctx.fillText("降水量(mm)", px, 40, 200); ctx.fillText("日射量(MJ/㎡)", wakuWidth + px + 20, 40, 200); ctx.fillStyle = '#333333'; ctx.font= 'bold 13px sans-serif'; /* 時間 */ for(j = 1; j < split_lineY2; j=j+1){ ctx.beginPath(); ctx.moveTo(px, py+(j*splitLineY2)); ctx.lineTo(px+wakuWidth, py+(j*splitLineY2)); ctx.stroke(); } for(i = 5; i >= 0; i=i-1){ ctx.textAlign = 'end'; ctx.fillText(indexRain[5-i],px - fontX, py+(i*splitLineY2) + fontY); ctx.textAlign = 'start'; ctx.fillText(indexSun[5-i],px + wakuWidth + 5, py+(i*splitLineY2) + fontY); } ctx.strokeStyle = "rgb(0,0,0)"; ctx.lineWidth = 1; ctx.strokeRect(px, py, wakuWidth, wakuHeight); /* 凡例 */ ctx.beginPath(); ctx.fillStyle = "rgb(0,204,255)"; ctx.fillRect(wakuWidth + px - 85 , 8, +6, 8); ctx.stroke(); ctx.beginPath(); ctx.fillStyle = "rgb(255,204,0)"; ctx.fillRect(wakuWidth + px - 15 , 8, +6, 8); ctx.stroke(); ctx.fillStyle = '#333333'; ctx.font= "bold 10pt 'ヒラギノ角ゴ Pro W3'"; ctx.textAlign = 'center'; ctx.fillText("降水量", wakuWidth + px - 50, 17, 200); ctx.fillText("日射量", wakuWidth + px + 20, 17, 200); });