
function myVMLInsertLeg(color,size)
{var partSize;partSize="";partSize=partSize+"<v:shape style='HEIGHT: 10px; LEFT: 20px; TOP: 20px; WIDTH: "+size+"px'  coordsize  = '200,200' fillcolor = '"+color+"'  strokecolor = '"+color+"' path = 'm1,1l1,200,200,200,200,1xe'><v:fill type = 'gradient' color2 = 'black' angle = '45'></v:fill></v:shape><br>"
return(partSize)}
function myVMLDrawGraph(width,height,values,nams,dots)
{var chaine=new String();var color=new Array();color[0]="green";color[1]="blue";color[2]="red";var i,k,n,vmin,vmax,v0;var str,str2,str3,xl,yl,yyl,il,ilAV,ilPEA,txty,txt,txt_unit;var m=values.length;n=values[0].length;w=width/(n-1);vmin=999999999999;for(j=0;j<m;j++){for(i=0;i<n;i++){v=values[j][i];if(v<vmin)vmin=v;}}
vmax=vmin;xl="";yl="";txty="";txty="";yyl="";for(j=0;j<m;j++){for(i=0;i<n;i++){v=values[j][i];if(v<vmin)vmin=v;if(v>vmax)vmax=v;}}
vdiff=Math.abs(vmax-vmin);var limite=new Array();var coef;var nd;limite[0]=0;limite[1]=1000;limite[2]=2000;limite[3]=10000;limite[4]=20000;limite[5]=100000;limite[6]=200000;limite[7]=1000000;limite[8]=2000000;limite[9]=10000000;limite[10]=20000000;limite[11]=100000000;limite[12]=200000000;limite[13]=1000000000;limite[14]=2000000000;limite[15]=10000000000;limite[16]=20000000000;limite[17]=100000000000;limite[18]=200000000000;limite[19]=1000000000000;limite[20]=2000000000000;limite[21]=10000000000000;for(i=0;i<21;i=i+2){if(vdiff<=limite[i+1]&&vdiff>limite[i]){coef=1;nd=Math.ceil(Math.log(vmax-vmin)/Math.log(10))-1;}}
for(i=1;i<21;i=i+2){if(vdiff<=limite[i+1]&&vdiff>limite[i]){coef=5;nd=Math.ceil(Math.log(vmax-vmin)/Math.log(10))-2;}}
dy=coef*Math.pow(10,nd);yl="";var start;start=Math.ceil(vmin/dy)*dy;for(i=start;i<vmax;i=i+dy)
{y=Math.ceil(height-((i-vmin)/(vmax-vmin)*height));yl=yl+" M 0,"+y+" L 4,"+y+" X";yyl=yyl+" M 0,"+y+" L "+width+","+y+" X";if(nd>=2&&nd<5){txt=""+(Math.ceil(i/100))/10;txt_unit="K&euro;"}
else if(nd>=5&&nd<8){txt=""+(Math.ceil(i/100))/10000;txt_unit="M&euro;"}
else if(nd>=8){txt=""+(Math.ceil(i/100))/10000000;txt_unit="MD&euro;"}
else{txt=i;txt_unit="&euro;"}
txty=txty+"<p style='position:absolute;left:5;top:"+(y+2)+"; text-align=center;FONT-FAMILY: arial; FONT-SIZE: xx-small; COLOR: black;'>"+txt+"</p>";}
il="";if(dots!=""){var z;var dots_tbl=dots.split(",");var dots_length=dots_tbl.length;for(z=0;z<dots_length;z++){if(dots_tbl[z]=="AV"){if(m>1){il=il+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor="+color[z+1]+">"}
else{il=il+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor="+color[z]+">"}
for(i=1;i<n;i++){if(i==4){k=0;for(k=1;k<(height/10+1);k++){ilAV=ilAV+" M "+Math.ceil(i*w)+","+(height-10*k)+" L "+Math.ceil(i*w)+","+(height-10*k+4)+" X"}}
else if(i==8){k=0;for(k=1;k<(height/10+1);k++){ilAV=ilAV+" M "+Math.ceil(i*w)+","+(height-10*k)+" L "+Math.ceil(i*w)+","+(height-10*k+4)+" X"}}}
il=il+"<v:path v=\""+ilAV+"\" /></v:shape>"}
if(dots_tbl[z]=="PEA"){if(m>1){il=il+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor="+color[z+1]+">"}
else{il=il+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor="+color[z]+">"}
for(i=1;i<n;i++){if(i==2){k=0;for(k=1;k<(height/10+1);k++){ilPEA=ilPEA+" M "+Math.ceil(i*w)+","+(height-10*k)+" L "+Math.ceil(i*w)+","+(height-10*k+4)+" X"}}
else if(i==5){k=0;for(k=1;k<(height/10+1);k++){ilPEA=ilPEA+" M "+Math.ceil(i*w)+","+(height-10*k)+" L "+Math.ceil(i*w)+","+(height-10*k+4)+" X"}}}
il=il+"<v:path v=\""+ilPEA+"\" /></v:shape>"}}}
str="";txtL="<v:rect style=\"position:relative; top="+(height+25)+"; width="+(width+10+30)+"; height="+(m*16+2)+";\" fillcolor=\"#FFFFFF\"><v:shadow on=\"true\" offset=\"4pt,3pt\" color=\"gray\"/></v:rect>";for(j=0;j<m;j++){str=str
+"<v:polyline style=\"left=30;top=5;position:relative;\" strokecolor=\""+color[j]+"\" points=\""
+"0,"+(height-((values[j][0]-vmin)/(vmax-vmin)*height));for(i=1;i<n;i++){str=str+","+i*w+","+(height-((values[j][i]-vmin)/(vmax-vmin)*height))
xl=xl+" M "+Math.ceil(i*w)+","+height+" L "+Math.ceil(i*w)+","+(height+4)+" X"}
str=str+"\" strokeweight=1px><v:stroke joinstyle=round endcap=round /><v:fill on=\"false\" /></v:polyline>";txtL=txtL
+"<v:shape style=\"HEIGHT: 10px; LEFT: 10px; TOP: "+((height+25)+(4+j*16))+"px; position:absolute; WIDTH: 10;\" coordsize  = \"200,200\" fillcolor = \""+color[j]+"\"  strokecolor = \""+color[j]+"\" path = \"m1,1l1,200,200,200,200,1xe\"></v:shape>"
+"<p style='position:absolute;left:"+25+";top:"+((height+25)+(5+j*16))+"; text-align=center;FONT-FAMILY: arial; FONT-SIZE: xx-small; COLOR: black;'>"+nams[j]+" ("+txt_unit+")"+"</p>";}
intGraphHeight=(height+25+(m*16+2));chaine=""
+"<v:group style=\"position:absolute; top:"+osY+"px; left:"+(osX+((442-(width+10+30+20))/2))+"px; width:"+width+"px; height: "+height+"px; z-index: 999\" coordsize=\""+width+","+height+"\">"
+"<v:rect style=\"position:absolute; width="+(width+10+30)+"; height="+(height+15)+";\" fillcolor=\"#FFFFFF\"><v:shadow on=\"true\" offset=\"4pt,3pt\" color=\"gray\"/></v:rect>"
+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"gray\">"
+"<v:path v=\""+xl+"\" /></v:shape>"
+il
+"<v:shape style=\"left=25;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"gray\">"
+"<v:path v=\""+yl+"\" /></v:shape>"
+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"silver\">"
+"<v:path v=\""+yyl+"\" /></v:shape>"
+str
+"<v:polyline style=\"left=30;top=5;position:absolute;\" strokecolor=\"gray\" points=\"0,"+(height+4)+",0,0\" strokeweight=2px><v:stroke joinstyle=round endcap=round /><v:fill on=\"false\" /></v:polyline>"
+"<v:polyline style=\"left=30;top=5;position:absolute;\" strokecolor=\"gray\" points=\"-4,"+height+","+width+","+height+"\" strokeweight=2px><v:stroke joinstyle=round endcap=round /><v:fill on=\"false\" /></v:polyline>"
+txty
+txtL
+"</v:group>"
return(chaine);}
function myVMLGraphBar(width,height,values,nams)
{var chaine=new String();var bars=new String();var color=new Array();color[0]="green";color[1]="blue";color[2]="red";var i,n,vmin,vmax,v0;var str,str2,str3,xl,yl,yyl,txty,txt,txt_unit,leg,txt_eg;n=values.length;w=width/n;vmin=values[0];vmax=vmin;xl="";yl="";txty="";txty="";yyl="";for(i=1;i<n;i++)
{v=values[i];if(v<vmin)vmin=v;if(v>vmax)vmax=v;}
for(i=1;i<=n;i++)
{xl=xl+" M "+Math.ceil(i*w)+","+height+" L "+Math.ceil(i*w)+","+(height+4)+" X"}
vdiff=Math.abs(vmax-vmin);var limite=new Array();var coef;var nd;limite[0]=0;limite[1]=1000;limite[2]=2000;limite[3]=10000;limite[4]=20000;limite[5]=100000;limite[6]=200000;limite[7]=1000000;limite[8]=2000000;limite[9]=10000000;limite[10]=20000000;limite[11]=100000000;limite[12]=200000000;limite[13]=1000000000;limite[14]=2000000000;limite[15]=10000000000;limite[16]=20000000000;limite[17]=100000000000;limite[18]=200000000000;limite[19]=1000000000000;limite[20]=2000000000000;limite[21]=10000000000000;for(i=0;i<21;i=i+2){if(vdiff<=limite[i+1]&&vdiff>limite[i]){coef=1;nd=Math.ceil(Math.log(vmax-vmin)/Math.log(10))-1;}}
for(i=1;i<21;i=i+2){if(vdiff<=limite[i+1]&&vdiff>limite[i]){coef=5;nd=Math.ceil(Math.log(vmax-vmin)/Math.log(10))-2;}}
dy=Math.pow(10,nd);yl="";for(i=0;i<=vmax;i=i+2*dy)
{y=Math.ceil(height-((i)/(vmax)*height));yl=yl+" M 0,"+y+" L 4,"+y+" X";yyl=yyl+" M 0,"+y+" L "+width+","+y+" X";if(nd>=3&&nd<6){txt=""+(Math.ceil(i/100))/10;txt_unit="K&euro;";}
else if(nd>=6&&nd<9){txt=""+(Math.ceil(i/100))/10000;txt_unit="M&euro;";}
else if(nd>=9){txt=""+(Math.ceil(i/100))/10000000;txt_unit="MD&euro;";}
else{txt=i;txt_unit="&euro;";}
txty=txty+"<p style='position:absolute;left:5;top:"+(y+2)+"; text-align=center;FONT-FAMILY: arial; FONT-SIZE: xx-small; COLOR: black;'>"+txt+"</p>";}
bars=""
for(i=0;i<n;i++)
{bars=bars+"<v:shape style='HEIGHT: "+(height*values[i]/vmax)+" px; left: "+(35+(width/n)*i)+"px; top: "+((height-height*values[i]/vmax+5))+" px; position:absolute; width: "+(width/n-10)+" px'  coordsize  = '200,200' fillcolor = '"+color[i]+"'  strokecolor = '"+color[i]+"' path = 'm1,1l1,200,200,200,200,1 xe' title='"+values[i]+" F'><v:fill type = 'gradient' color2 = 'black' angle = '45'></v:fill></v:shape>"}
txt_leg="<v:rect style=\"position:relative; width="+(width+10+30)+"; height="+(n*16+2)+";\" fillcolor=\"#FFFFFF\"><v:shadow on=\"true\" offset=\"4pt,3pt\" color=\"gray\"/></v:rect>"
for(i=0;i<n;i++)
{txt_leg=txt_leg
+"<v:shape style=\"HEIGHT: 10px; LEFT: 10px; TOP:"+(4+i*16)+"px; position:absolute; WIDTH: "+10+";\" coordsize  = \"200,200\" fillcolor = \""+color[i]+"\"  strokecolor = \""+color[i]+"\" path = \"m1,1l1,200,200,200,200,1xe\"><v:fill type = 'gradient' color2 = 'black' angle = '45'></v:fill></v:shape>"
+"<p style='position:absolute;left:"+25+";top:"+(5+i*16)+"; text-align=center;FONT-FAMILY: arial; FONT-SIZE: xx-small; COLOR: black;'>"+nams[i]+" ("+txt_unit+")"+"</p>";}
chaine=""
+"<v:group style=\"width:"+width+"px; height: "+height+"px;\" coordsize=\""+width+","+height+"\">"
+"<v:rect style=\"position:absolute; width="+(width+10+30)+"; height="+(height+15)+";\" fillcolor=\"#FFFFFF\"><v:shadow on=\"true\" offset=\"4pt,3pt\" color=\"gray\"/></v:rect>"
+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"gray\">"
+"<v:path v=\""+xl+"\" /></v:shape>"
+"<v:shape style=\"left=25;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"gray\">"
+"<v:path v=\""+yl+"\" /></v:shape>"
+"<v:shape style=\"left=30;top=5;position:absolute; width:"+width+"; height: "+height+";\" coordsize=\""+width+","+height+"\" strokecolor=\"silver\">"
+"<v:path v=\""+yyl+"\" /></v:shape>"
+bars
+"<v:polyline style=\"left=30;top=5;position:absolute;\" strokecolor=\"gray\" points=\"0,"+(height+4)+",0,0\" strokeweight=2px><v:stroke joinstyle=round endcap=round /><v:fill on=\"false\" /></v:polyline>"
+"<v:polyline style=\"left=30;top=5;position:absolute;\" strokecolor=\"gray\" points=\"-4,"+height+","+width+","+height+"\" strokeweight=2px><v:stroke joinstyle=round endcap=round /><v:fill on=\"false\" /></v:polyline>"
+txty
+"</v:group>"
+"<br>"
+"<v:group style=\"width:"+width+"px; height: "+height+"px; z-index: 999\" coordsize=\""+width+","+height+"\">"
+txt_leg
+"</v:group>"
return(chaine);}