アットウィキロゴ

gex098

var geo=new Array();
var code=new Array();
var cx=new Array();
var cy=new Array();
var pref=new Array();
 
function sample(){
 
 var data;
 
  data = new XMLHttpRequest();
  data.open("GET", "geo.txt", false);
  data.send(null);
 
  var str=data.responseText;
 
var x=str.split("\n");
 
number=x.length;
for(s=0;s<number;s++){
var x1=x[s].split(",");
geo[s+1]=x1[0];
code[s+1]=x1[1];    
}
 
for(s=1;s<number+1;s++){
k="7"+code[s].substring(0,2);
pref[s]=k-700;
}
 
 
 
for(s=1;s<number+1;s++){
met(s,geo[s]);
}
 
maxx=0; 
maxy=0;
minx=99999;
miny=99999;
for(s=1;s<number+1;s++){
if(cx[s]>maxx)maxx=cx[s];    
if(cy[s]>maxy)maxy=cy[s]; 
} 
 
for(s=1;s<number+1;s++){
if(cx[s]<minx)minx=cx[s];    
if(cy[s]<miny)miny=cy[s]; 
} 
 
paint(); 
 
 
} 
 
function paint(){
 
 var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
 
for(s=1;s<number+1;s++){    
x5=500*(cx[s]-minx)/(maxx-minx);    
y5=500*(cy[s]-miny)/(maxy-miny);     
str=str+sub.rect(x5,500-y5,1,1,"yellow");
if(pref[s]>10)str=str+sub.rect(x5,500-y5,1,1,"orange");
if(pref[s]>20)str=str+sub.rect(x5,500-y5,1,1,"green");
if(pref[s]>30)str=str+sub.rect(x5,500-y5,1,1,"pink");
if(pref[s]>40)str=str+sub.rect(x5,500-y5,1,1,"red");
}
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
 
 
 
 
function met(s,g1){
 
 strx=""+g1;
 
y1=strx.substring(0,2);    
x1=strx.substring(2,4); 
y2=strx.substring(4,5);    
x2=strx.substring(5,6);   
y3=strx.substring(6,7);    
x3=strx.substring(7,8); 
 
cx[s]=80*x1+10*x2+x3;
cy[s]=80*y1+10*y2+y3;
 
 
 
 
 
}
最終更新:2015年06月30日 06:55