// JavaScript Document
$(function(){
var wakuDiv01w = document.getElementById('waku2');
var dispMonth = "10";
if ( ! wakuDiv01w || ! wakuDiv01w.getContext ) {
return false;
}
var ctx = wakuDiv01w.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,2,4,6,8,10); //日射量
var indexRain = new Array(25,20,15,10,5,0); //降水量
var wakuWidth = 750;
var wakuHeight = 240;
var split_lineX = 28;
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 = 1; i < split_lineX; i=i+1){
ctx.beginPath();
ctx.moveTo((i*splitLineX)+px, py);
ctx.lineTo((i*splitLineX)+px, py+wakuHeight);
ctx.stroke();
}
ctx.fillStyle = '#558525';
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("日射量(MJ/㎡)", px, 40, 200);
ctx.fillText("降水量(mm)", wakuWidth + px + 20, 40, 200);
ctx.fillStyle = '#333333';
ctx.font= 'bold 13px sans-serif';
/* 時間 */
var tcount = 0;
for(i = 2; i < split_lineX; i=i+4){
ctx.textAlign = 'center';
ctx.fillText("12:00",(i*splitLineX)+px , py + wakuHeight + 15);
tcount++;
}
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(indexSun[5-i],px - fontX, py+(i*splitLineY2) + fontY);
ctx.textAlign = 'start';
ctx.fillText(indexRain[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(255,204,0)";
ctx.fillRect(wakuWidth + px - 85 , 8, +6, 8);
ctx.stroke();
ctx.beginPath();
ctx.fillStyle = "rgb(0,204,255)";
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);
});