function CanvasChartPainterFactory(){
return new CanvasChartPainter();
}
function CanvasChartPainter(){
this.base=AbstractChartPainter;
this._eventImg=document.createElement("IMG");
this._eventImgmap=document.createElement("MAP");
this.events=Array();
this._pieCurrAngle=0;
this._pieChart_cx=0;
this._pieChart_cy=0;
this._pieChart_r=0;
this.showErrorMsg=false;
this.offsetLabel_HorizontalAxis=0;
}
CanvasChartPainter.prototype=new AbstractChartPainter;
CanvasChartPainter.prototype.create=function(el){
while(el.firstChild){
el.removeChild(el.lastChild);
}
this.el=el;
this.w=el.clientWidth;
this.h=el.clientHeight;
this.canvas=document.createElement("canvas");
this.canvas.width=this.w;
this.canvas.height=this.h;
this.canvas.style.width=this.w+"px";
this.canvas.style.height=this.h+"px";
el.appendChild(this.canvas);
if((!this.canvas.getContext)&&(typeof G_vmlCanvasManager!="undefined")){
this.canvas=G_vmlCanvasManager.initElement(this.canvas);
}
};
CanvasChartPainter.prototype.init=function(_2,_3,_4,_5,_6,_7){
this.ctx=this.canvas.getContext("2d");
this.chartx=0;
this.chartw=this.w;
this.charth=this.h;
this.charty=0;
this.xlen=_2;
this.ymin=_3;
this.ymax=_4;
this.xgd=_5;
this.ygd=_6;
this.calc(this.chartw,this.charth,_2,_3,_4,_5,_6);
};
CanvasChartPainter.prototype.drawLegend=function(_8){
var _9,_a,_b,_c;
_9=document.createElement("div");
_9.className="legend";
_9.style.position="absolute";
_a=document.createElement("ul");
for(i=0;i<_8.length;i++){
_b=document.createElement("li");
var _d=_8[i].color;
if(typeof (_d)=="object"){
_d=_d.baseColor;
}
_b.style.color=_d;
_c=document.createElement("span");
_c.appendChild(document.createTextNode(_8[i].label));
_c.style.color="black";
_b.appendChild(_c);
_a.appendChild(_b);
}
_9.appendChild(_a);
this.el.appendChild(_9);
_9.style.right="0px";
_9.style.top=this.charty+(this.charth/2)-(_9.offsetHeight/2)+"px";
this.legend=_9;
this.chartw=this.w-(this.legend.offsetWidth+5);
this.calc(this.chartw,this.charth,this.xlen,this.ymin,this.ymax,this.xgd,this.ygd);
};
CanvasChartPainter.prototype.drawVerticalAxis=function(_e,_f){
var _10,_11,_12,y,ty,n,_16,_17,_18,w,_1a,pos;
_18=Math.pow(10,_f);
_12=this.range/(_e-1);
_10=document.createElement("div");
_10.style.position="absolute";
_10.style.left="0px";
_10.style.top="0px";
_10.style.textAlign="right";
this.el.appendChild(_10);
this.ctx.fillStyle="black";
w=0;
_1a=new Array();
for(n=0,i=this.ymax;(i>this.ymin)&&(n<_e-1);i-=_12,n++){
_11=document.createElement("span");
_17=parseInt(i*_18)/_18;
_11.appendChild(document.createTextNode(_17));
_10.appendChild(_11);
_1a.push([i,_11]);
if(_11.offsetWidth>w){
w=_11.offsetWidth;
}
}
_11=document.createElement("span");
_11.appendChild(document.createTextNode(this.ymin));
_10.appendChild(_11);
_1a.push([this.ymin,_11]);
if(_11.offsetWidth>w){
w=_11.offsetWidth;
}
_10.style.width=w+"px";
this.chartx=w+5;
this.charty=_11.offsetHeight/2;
this.charth=this.h-((_11.offsetHeight*1.5)+5);
this.chartw=this.w-(((this.legend)?this.legend.offsetWidth:0)+w+10);
this.calc(this.chartw,this.charth,this.xlen,this.ymin,this.ymax,this.xgd,this.ygd);
n=this.range/this.charth;
_16=(this.ymin/n);
for(i=0;i<_1a.length;i++){
_11=_1a[i][1];
pos=_1a[i][0];
if(pos==this.ymin){
y=this.charty+this.charth-1;
}else{
y=this.charty+(this.charth-(pos/n)+_16);
}
this.ctx.fillRect(this.chartx-5,y,5,1);
ty=y-(_11.offsetHeight/2);
_11.style.position="absolute";
_11.style.right="0px";
_11.style.top=ty+"px";
}
};
CanvasChartPainter.prototype.drawHorizontalAxis=function(_1c,_1d,xgd,_1f){
var _20,_21,_22,x,tx,n,_26;
_26=Math.pow(10,_1f);
n=this.chartw/(xgd-1);
_20=document.createElement("div");
_20.style.position="absolute";
_20.style.left="0px";
_20.style.top=(this.charty+this.charth+5)+"px";
_20.style.width=this.w+"px";
this.el.appendChild(_20);
this.ctx.fillStyle="black";
for(i=0;i<xgd;i++){
if(_1d[i]!=undefined){
_21=document.createElement("span");
_21.appendChild(document.createTextNode(_1d[i]));
_20.appendChild(_21);
x=this.chartx+(n*i)+this.offsetLabel_HorizontalAxis;
tx=x-(_21.offsetWidth/2);
_21.style.position="absolute";
_21.style.left=tx+"px";
_21.style.top="0px";
this.ctx.fillRect(x,this.charty+this.charth,1,5);
}
}
};
CanvasChartPainter.prototype.drawAxis=function(){
this.ctx.fillStyle="black";
this.ctx.fillRect(this.chartx,this.charty,1,this.charth-1);
this.ctx.fillRect(this.chartx,this.charty+this.charth-1,this.chartw+1,1);
};
CanvasChartPainter.prototype.drawBackground=function(){
//this.ctx.fillStyle="blue";
//this.ctx.fillRect(0,0,this.w,this.h);
};
CanvasChartPainter.prototype.drawChart=function(){
this.ctx.fillStyle="silver";
if(this.xgrid){
for(i=this.xgrid;i<this.chartw;i+=this.xgrid){
this.ctx.fillRect(this.chartx+i,this.charty,1,this.charth-1);
}
}
if(this.ygrid){
for(i=this.charth-this.ygrid;i>0;i-=this.ygrid){
this.ctx.fillRect(this.chartx+1,this.charty+i,this.chartw,1);
}
}
};
CanvasChartPainter.prototype.drawArea=function(_27,_28){
var i,len,x,y,n,_2e;
var _2f=new events();
n=this.range/this.charth;
_2e=(this.ymin/n);
len=_28.length;
if(len){
if(typeof (_27)=="object"){
_27=this.createGradient(_27,CHART_AREA,0,0,0,this.h);
}
this.ctx.fillStyle=_27;
x=this.chartx+1;
this.ctx.beginPath();
_2f.beginPath();
this.ctx.moveTo(x,this.charty+this.charth-1);
_2f.moveTo(x,this.charty+this.charth-1);
y=this.charty+this.charth-(_28[0]/n)+_2e;
this.ctx.lineTo(x,y);
_2f.lineTo(x,y);
for(i=1;i<len;i++){
y=this.charty+this.charth-(_28[i]/n)+_2e;
x+=this.xstep;
this.ctx.lineTo(x,y);
_2f.lineTo(x,y);
}
this.ctx.lineTo(x,this.charty+this.charth-1);
_2f.lineTo(x,this.charty+this.charth-1);
this.ctx.closePath();
_2f.closePath();
this.ctx.fill();
var i=this.events.length;
this.events[i]=_2f;
}
};
CanvasChartPainter.prototype.drawLine=function(_30,_31,_32){
var i,len,x,y,n,_38;
var _39=new events();
n=this.range/this.charth;
_38=(this.ymin/n);
this.ctx.lineCap="round";
len=_31.length;
if(len){
this.ctx.lineWidth=_32;
if(typeof (_30)=="object"){
_30=this.createGradient(_30,CHART_LINE,0,0,0,this.h);
}
this.ctx.strokeStyle=_30;
x=this.chartx+1;
y=this.charty+this.charth-(_31[0]/n)+_38;
this.ctx.beginPath();
_39.beginPath();
this.ctx.moveTo(x,y);
_39.moveTo(x,y);
for(i=1;i<len;i++){
y=this.charty+this.charth-(_31[i]/n)+_38;
x+=this.xstep;
this.ctx.lineTo(x,y);
var _3a=parseInt(this.ctx.lineWidth/2);
_39.lineTo(x,parseInt(y-_3a));
}
_39.lineToPoly(this.ctx.lineWidth);
this.events[this.events.length]=_39;
this.ctx.stroke();
}
};
CanvasChartPainter.prototype.drawBars=function(_3b,_3c,_3d,_3e,_3f){
var i,len,x,y,n,_45;
n=this.range/this.charth;
_45=(this.ymin/n);
len=_3c.length;
if(len>_3d){
len=_3d;
}
if(len){
if(typeof (_3b)=="object"){
_3b=this.createGradient(_3b,CHART_AREA,0,0,0,this.h);
}
this.ctx.fillStyle=_3b;
x=this.chartx+_3e+1;
for(i=0;i<len;i++){
var _46=new events();
y=this.charty+this.charth-(_3c[i]/n)+_45;
this.ctx.beginPath();
_46.beginPath();
this.ctx.moveTo(x,this.charty+this.charth-1);
_46.moveTo(x,this.charty+this.charth-1);
this.ctx.lineTo(x,y);
_46.lineTo(x,y);
this.ctx.lineTo(x+_3f,y);
_46.lineTo(x+_3f,y);
this.ctx.lineTo(x+_3f,this.charty+this.charth-1);
_46.lineTo(x+_3f,this.charty+this.charth-1);
this.ctx.closePath();
_46.closePath();
this.ctx.fill();
this.events[this.events.length]=_46;
x+=this.xstep;
}
}
};
CanvasChartPainter.prototype.drawPie=function(_47,_48,_49,cx,cy,r){
this._pieChart_cx=cx;
this._pieChart_cy=cy;
this._pieChart_r=r;
var len,_4e=0,i,_50,_51=0;
if(typeof (_47)=="object"){
_4e=_47.length;
}else{
_4e=1;
}
len=_48.length;
this.ctx.strokeStyle="#FFFFFF";
this.ctx.lineWidth=2;
this.ctx.lineJoin="bevel";
_50=this._pieCurrAngle;
for(i=0;i<len;i++){
var _52=new events();
_51=parseFloat((_48[i]*(Math.PI*2))/_49);
if(typeof (_47)=="object"){
_47=this.createGradient(_47,CHART_PIE,0,0,0,this.h);
}
this.ctx.fillStyle=_47;
this.ctx.beginPath();
var _53=cx+r*Math.cos(_50);
var _54=cy+r*Math.sin(_50);
if(_49!=_48[i]){
this.ctx.moveTo(cx,cy);
_52.moveTo(cx,cy);
this.ctx.lineTo(_53,_54);
_52.lineTo(_53,_54);
}else{
_52.moveTo(_53,_54);
}
this.ctx.arc(cx,cy,r,_50,_50+_51,false);
_52.arc(cx,cy,r,_50,_50+_51,false);
this.ctx.closePath();
_52.closePath();
this.ctx.fill();
this.ctx.stroke();
_50=_50+_51;
this._pieCurrAngle=_50;
this.events[this.events.length]=_52;
}
};
CanvasChartPainter.prototype.initEventImg=function(Src){
this._eventImg.src=Src;
this._eventImg.style.position="absolute";
this._eventImg.style.top=this.canvas.offsetTop;
this._eventImg.style.left=this.canvas.offsetLeft;
this._eventImg.width=this.canvas.width;
this._eventImg.height=this.canvas.height;
this._eventImg.useMap="#"+this._eventImgmap.name;
this._eventImg.border="0px";
this.el.appendChild(this._eventImg);
};
CanvasChartPainter.prototype.initEventImgmap=function(_56){
this._eventImgmap.name=_56+"_Imgmap";
this._eventImgmap.id=_56+"_Imgmap";
this.el.appendChild(this._eventImgmap);
};
CanvasChartPainter.prototype.appendEvents=function(_57){
var i=this.events.length-1;
var j=_57.length-1;
while(i>=0){
var _5a=this.events[i];
var _5b=_5a.fill();
if(_57.length!=this.events.length){
this.copyEvent(_5b,_57[j].tmpArea);
}else{
this.copyEvent(_5b,_57[i].tmpArea);
}
this._eventImgmap.appendChild(_5b);
j=parseInt(i/_57[j].values.length);
i--;
}
};
CanvasChartPainter.prototype.copyEvent=function(_5c,_5d){
_5c.onclick=_5d.onclick;
_5c.onmouseover=_5d.onmouseover;
};
CanvasChartPainter.prototype.createGradient=function(_5e,_5f,x0,y0,x1,y1){
var _64="";
if(_5f==CHART_LINE){
return _5e.baseColor;
}
var gra;
if(_5f==CHART_PIE){
var cx=parseInt(this._pieChart_cx);
var cy=parseInt(this._pieChart_cy);
var r=parseInt(this._pieChart_r);
gra=this.ctx.createRadialGradient(cx,cy,0,cx,cy,r+_5e.pieChartGradientOffset);
}else{
gra=this.ctx.createLinearGradient(x0,y0,x1,y1);
}
this.hexToRGB(_5e.baseColor,_5e.alpha);
gra.addColorStop(_5e.baseVal,this.hexToRGB(_5e.baseColor,_5e.alpha));
gra.addColorStop(_5e.secondVal,this.hexToRGB(_5e.secondColor,_5e.alpha));
_64=gra;
return _64;
};
CanvasChartPainter.prototype.hexToRGB=function(hex,_6a){
if(typeof (hex)!="string"){
return hex;
}
if(hex.substr(0,1)=="#"){
var R=parseInt(hex.substr(1,2),16);
var G=parseInt(hex.substr(3,2),16);
var B=parseInt(hex.substr(5,2),16);
return "rgba("+parseInt(R,10)+","+parseInt(G,10)+","+parseInt(B,10)+","+parseFloat(_6a,10)+")";
}
};

if(!window.CanvasRenderingContext2D){
(function(){
var m=Math;
var mr=m.round;
var ms=m.sin;
var mc=m.cos;
var _5={init:function(_6){
var _7=_6||document;
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
var _8=this;
_7.attachEvent("onreadystatechange",function(){
_8.init_(_7);
});
}
},init_:function(_9,e){
if(_9.readyState=="complete"){
if(!_9.namespaces["g_vml_"]){
_9.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml");
}
var ss=_9.createStyleSheet();
ss.cssText="canvas{display:inline-block;overflow:hidden;"+"text-align:left;}"+"g_vml_\\:*{behavior:url(#default#VML)}";
var _c=_9.getElementsByTagName("canvas");
for(var i=0;i<_c.length;i++){
if(!_c[i].getContext){
this.initElement(_c[i]);
}
}
}
},fixElement_:function(el){
var _f=el.outerHTML;
var _10=document.createElement(_f);
if(_f.slice(-2)!="/>"){
var _11="/"+el.tagName;
var ns;
while((ns=el.nextSibling)&&ns.tagName!=_11){
ns.removeNode();
}
if(ns){
ns.removeNode();
}
}
el.parentNode.replaceChild(_10,el);
return _10;
},initElement:function(el){
el=this.fixElement_(el);
el.getContext=function(){
if(this.context_){
return this.context_;
}
return this.context_=new CanvasRenderingContext2D_(this);
};
el.attachEvent("onresize",onResize);
var _14=el.attributes;
if(_14.width&&_14.width.specified){
el.style.width=_14.width.nodeValue+"px";
}
if(_14.height&&_14.height.specified){
el.style.height=_14.height.nodeValue+"px";
}
return el;
}};
function onPropertyChange(e){
switch(e.propertyName){
case "width":
case "height":
break;
}
}
function onResize(e){
var el=e.srcElement;
if(el.firstChild){
el.firstChild.style.width=el.clientWidth+"px";
el.firstChild.style.height=el.clientHeight+"px";
}
}
_5.init();
var _18=[];
for(var i=0;i<16;i++){
for(var j=0;j<16;j++){
_18[i*16+j]=i.toString(16)+j.toString(16);
}
}
function createMatrixIdentity(){
return [[1,0,0],[0,1,0],[0,0,1]];
}
function matrixMultiply(m1,m2){
var _1d=createMatrixIdentity();
for(var x=0;x<3;x++){
for(var y=0;y<3;y++){
var sum=0;
for(var z=0;z<3;z++){
sum+=m1[x][z]*m2[z][y];
}
_1d[x][y]=sum;
}
}
return _1d;
}
function copyState(o1,o2){
o2.fillStyle=o1.fillStyle;
o2.lineCap=o1.lineCap;
o2.lineJoin=o1.lineJoin;
o2.lineWidth=o1.lineWidth;
o2.miterLimit=o1.miterLimit;
o2.shadowBlur=o1.shadowBlur;
o2.shadowColor=o1.shadowColor;
o2.shadowOffsetX=o1.shadowOffsetX;
o2.shadowOffsetY=o1.shadowOffsetY;
o2.strokeStyle=o1.strokeStyle;
}
function processStyle(_24){
var str,_26=1;
_24=String(_24);
if(_24.substring(0,3)=="rgb"){
var _27=_24.indexOf("(",3);
var end=_24.indexOf(")",_27+1);
var _29=_24.substring(_27+1,end).split(",");
str="#";
for(var i=0;i<3;i++){
str+=_18[parseInt(_29[i])];
}
if((_29.length==4)&&(_24.substr(3,1)=="a")){
_26=_29[3];
}
}else{
str=_24;
}
return [str,_26];
}
function processLineCap(_2b){
switch(_2b){
case "butt":
return "flat";
case "round":
return "round";
case "square":
default:
return "square";
}
}
function CanvasRenderingContext2D_(_2c){
this.m_=createMatrixIdentity();
this.mStack_=[];
this.aStack_=[];
this.currentPath_=[];
this.strokeStyle="#000";
this.fillStyle="#ccc";
this.lineWidth=1;
this.lineJoin="miter";
this.lineCap="butt";
this.miterLimit=10;
this.globalAlpha=1;
var el=document.createElement("div");
el.style.width=_2c.clientWidth+"px";
el.style.height=_2c.clientHeight+"px";
el.style.overflow="hidden";
el.style.position="absolute";
_2c.appendChild(el);
this.element_=el;
this.arcScaleX_=1;
this.arcScaleY_=1;
}
var _2e=CanvasRenderingContext2D_.prototype;
_2e.clearRect=function(){
this.element_.innerHTML="";
this.currentPath_=[];
};
_2e.beginPath=function(){
this.currentPath_=[];
};
_2e.moveTo=function(aX,aY){
this.currentPath_.push({type:"moveTo",x:aX,y:aY});
};
_2e.lineTo=function(aX,aY){
this.currentPath_.push({type:"lineTo",x:aX,y:aY});
};
_2e.bezierCurveTo=function(_33,_34,_35,_36,aX,aY){
this.currentPath_.push({type:"bezierCurveTo",cp1x:_33,cp1y:_34,cp2x:_35,cp2y:_36,x:aX,y:aY});
};
_2e.quadraticCurveTo=function(_39,_3a,aX,aY){
this.bezierCurveTo(_39,_3a,_39,_3a,aX,aY);
};
_2e.arc=function(aX,aY,_3f,_40,_41,_42){
_3f*=10;
var _43=_42?"at":"wa";
var _44=aX+(mc(_40)*_3f)-5;
var _45=aY+(ms(_40)*_3f)-5;
var _46=aX+(mc(_41)*_3f)-5;
var _47=aY+(ms(_41)*_3f)-5;
this.currentPath_.push({type:_43,x:aX,y:aY,radius:_3f,xStart:_44,yStart:_45,xEnd:_46,yEnd:_47});
};
_2e.rect=function(aX,aY,_4a,_4b){
this.moveTo(aX,aY);
this.lineTo(aX+_4a,aY);
this.lineTo(aX+_4a,aY+_4b);
this.lineTo(aX,aY+_4b);
this.closePath();
};
_2e.strokeRect=function(aX,aY,_4e,_4f){
this.beginPath();
this.moveTo(aX,aY);
this.lineTo(aX+_4e,aY);
this.lineTo(aX+_4e,aY+_4f);
this.lineTo(aX,aY+_4f);
this.closePath();
this.stroke();
};
_2e.fillRect=function(aX,aY,_52,_53){
this.beginPath();
this.moveTo(aX,aY);
this.lineTo(aX+_52,aY);
this.lineTo(aX+_52,aY+_53);
this.lineTo(aX,aY+_53);
this.closePath();
this.fill();
};
_2e.createLinearGradient=function(aX0,aY0,aX1,aY1){
var _58=new CanvasGradient_("gradient");
return _58;
};
_2e.createRadialGradient=function(aX0,aY0,aR0,aX1,aY1,aR1){
var _5f=new CanvasGradient_("gradientradial");
_5f.radius1_=aR0;
_5f.radius2_=aR1;
_5f.focus_.x=aX0;
_5f.focus_.y=aY0;
return _5f;
};
_2e.drawImage=function(_60,_61){
var dx,dy,dw,dh,sx,sy,sw,sh;
var w=_60.width;
var h=_60.height;
if(arguments.length==3){
dx=arguments[1];
dy=arguments[2];
sx=sy=0;
sw=dw=w;
sh=dh=h;
}else{
if(arguments.length==5){
dx=arguments[1];
dy=arguments[2];
dw=arguments[3];
dh=arguments[4];
sx=sy=0;
sw=w;
sh=h;
}else{
if(arguments.length==9){
sx=arguments[1];
sy=arguments[2];
sw=arguments[3];
sh=arguments[4];
dx=arguments[5];
dy=arguments[6];
dw=arguments[7];
dh=arguments[8];
}else{
throw "Invalid number of arguments";
}
}
}
var d=this.getCoords_(dx,dy);
var w2=(sw/2);
var h2=(sh/2);
var _6f=[];
_6f.push(" <g_vml_:group"," coordsize=\"1000,1000\""," coordorigin=\"0, 0\""," style=\"width:100px;height:100px;position:absolute;");
if(this.m_[0][0]!=1||this.m_[0][1]){
var _70=[];
_70.push("M11='",this.m_[0][0],"',","M12='",this.m_[1][0],"',","M21='",this.m_[0][1],"',","M22='",this.m_[1][1],"',","Dx='",d.x,"',","Dy='",d.y,"'");
var max=d;
var c2=this.getCoords_(dx+dw,dy);
var c3=this.getCoords_(dx,dy+dh);
var c4=this.getCoords_(dx+dw,dy+dh);
max.x=Math.max(max.x,c2.x,c3.x,c4.x);
max.y=Math.max(max.y,c2.y,c3.y,c4.y);
_6f.push(" padding:0 ",mr(max.x),"px ",mr(max.y),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",_70.join(""),", sizingmethod='clip');");
}else{
_6f.push(" top:",d.y,"px;left:",d.x,"px;");
}
_6f.push(" \">","<g_vml_:image src=\"",_60.src,"\""," style=\"width:",dw,";"," height:",dh,";\""," cropleft=\"",sx/w,"\""," croptop=\"",sy/h,"\""," cropright=\"",(w-sx-sw)/w,"\""," cropbottom=\"",(h-sy-sh)/h,"\""," />","</g_vml_:group>");
this.element_.insertAdjacentHTML("BeforeEnd",_6f.join(""));
};
_2e.stroke=function(_75){
var _76=[];
var _77=false;
var a=processStyle(_75?this.fillStyle:this.strokeStyle);
var _79=a[0];
var _7a=a[1]*this.globalAlpha;
_76.push("<g_vml_:shape"," fillcolor=\"",_79,"\""," filled=\"",Boolean(_75),"\""," style=\"position:absolute;width:10;height:10;\""," coordorigin=\"0 0\" coordsize=\"100 100\""," stroked=\"",!_75,"\""," strokeweight=\"",this.lineWidth,"\""," strokecolor=\"",_79,"\""," path=\"");
var _7b=false;
var min={x:null,y:null};
var max={x:null,y:null};
for(var i=0;i<this.currentPath_.length;i++){
var p=this.currentPath_[i];
if(p.type=="moveTo"){
_76.push(" m ");
var c=this.getCoords_(p.x,p.y);
_76.push(mr(c.x),",",mr(c.y));
}else{
if(p.type=="lineTo"){
_76.push(" l ");
var c=this.getCoords_(p.x,p.y);
_76.push(mr(c.x),",",mr(c.y));
}else{
if(p.type=="close"){
_76.push(" x ");
}else{
if(p.type=="bezierCurveTo"){
_76.push(" c ");
var c=this.getCoords_(p.x,p.y);
var c1=this.getCoords_(p.cp1x,p.cp1y);
var c2=this.getCoords_(p.cp2x,p.cp2y);
_76.push(mr(c1.x),",",mr(c1.y),",",mr(c2.x),",",mr(c2.y),",",mr(c.x),",",mr(c.y));
}else{
if(p.type=="at"||p.type=="wa"){
_76.push(" ",p.type," ");
var c=this.getCoords_(p.x,p.y);
var _83=this.getCoords_(p.xStart,p.yStart);
var _84=this.getCoords_(p.xEnd,p.yEnd);
_76.push(mr(c.x-this.arcScaleX_*p.radius),",",mr(c.y-this.arcScaleY_*p.radius)," ",mr(c.x+this.arcScaleX_*p.radius),",",mr(c.y+this.arcScaleY_*p.radius)," ",mr(_83.x),",",mr(_83.y)," ",mr(_84.x),",",mr(_84.y));
}
}
}
}
}
if(c){
if(min.x==null||c.x<min.x){
min.x=c.x;
}
if(max.x==null||c.x>max.x){
max.x=c.x;
}
if(min.y==null||c.y<min.y){
min.y=c.y;
}
if(max.y==null||c.y>max.y){
max.y=c.y;
}
}
}
_76.push(" \">");
if(typeof this.fillStyle=="object"){
var _85={x:"50%",y:"50%"};
var _86=(max.x-min.x);
var _87=(max.y-min.y);
var _88=(_86>_87)?_86:_87;
_85.x=mr((this.fillStyle.focus_.x/_86)*100+50)+"%";
_85.y=mr((this.fillStyle.focus_.y/_87)*100+50)+"%";
var _89=[];
if(this.fillStyle.type_=="gradientradial"){
var _8a=(this.fillStyle.radius1_/_88*100);
var _8b=(this.fillStyle.radius2_/_88*100)-_8a;
}else{
var _8a=0;
var _8b=100;
}
var _8c={offset:null,color:null};
var _8d={offset:null,color:null};
this.fillStyle.colors_.sort(function(cs1,cs2){
return cs1.offset-cs2.offset;
});
for(var i=0;i<this.fillStyle.colors_.length;i++){
var fs=this.fillStyle.colors_[i];
_7a=fs.color[1];
_89.push((fs.offset*_8b)+_8a,"% ",fs.color[0],",");
if(fs.offset>_8c.offset||_8c.offset==null){
_8c.offset=fs.offset;
_8c.color=fs.color;
}
if(fs.offset<_8d.offset||_8d.offset==null){
_8d.offset=fs.offset;
_8d.color=fs.color;
}
}
_89.pop();
_76.push("<g_vml_:fill"," color=\"",_8d.color,"\""," color2=\"",_8c.color,"\""," type=\"",this.fillStyle.type_,"\""," focusposition=\"",_85.x,", ",_85.y,"\""," colors=\"",_89.join(""),"\""," opacity=\"",_7a,"\" />");
}else{
if(_75){
_76.push("<g_vml_:fill color=\"",_79,"\" opacity=\"",_7a,"\" />");
}else{
_76.push("<g_vml_:stroke"," opacity=\"",_7a,"\""," joinstyle=\"",this.lineJoin,"\""," miterlimit=\"",this.miterLimit,"\""," endcap=\"",processLineCap(this.lineCap),"\""," weight=\"",this.lineWidth,"px\""," color=\"",_79,"\" />");
}
}
_76.push("</g_vml_:shape>");
this.element_.insertAdjacentHTML("beforeEnd",_76.join(""));
this.currentPath_=[];
};
_2e.fill=function(){
this.stroke(true);
};
_2e.closePath=function(){
this.currentPath_.push({type:"close"});
};
_2e.getCoords_=function(aX,aY){
return {x:10*(aX*this.m_[0][0]+aY*this.m_[1][0]+this.m_[2][0])-5,y:10*(aX*this.m_[0][1]+aY*this.m_[1][1]+this.m_[2][1])-5};
};
_2e.save=function(){
var o={};
copyState(this,o);
this.aStack_.push(o);
this.mStack_.push(this.m_);
this.m_=matrixMultiply(createMatrixIdentity(),this.m_);
};
_2e.restore=function(){
copyState(this.aStack_.pop(),this);
this.m_=this.mStack_.pop();
};
_2e.translate=function(aX,aY){
var m1=[[1,0,0],[0,1,0],[aX,aY,1]];
this.m_=matrixMultiply(m1,this.m_);
};
_2e.rotate=function(_97){
var c=mc(_97);
var s=ms(_97);
var m1=[[c,s,0],[-s,c,0],[0,0,1]];
this.m_=matrixMultiply(m1,this.m_);
};
_2e.scale=function(aX,aY){
this.arcScaleX_*=aX;
this.arcScaleY_*=aY;
var m1=[[aX,0,0],[0,aY,0],[0,0,1]];
this.m_=matrixMultiply(m1,this.m_);
};
_2e.clip=function(){
};
_2e.arcTo=function(){
};
_2e.createPattern=function(){
return new CanvasPattern_;
};
function CanvasGradient_(_9e){
this.type_=_9e;
this.radius1_=0;
this.radius2_=0;
this.colors_=[];
this.focus_={x:0,y:0};
}
CanvasGradient_.prototype.addColorStop=function(_9f,_a0){
_a0=processStyle(_a0);
this.colors_.push({offset:1-_9f,color:_a0});
};
function CanvasPattern_(){
}
G_vmlCanvasManager=_5;
CanvasRenderingContext2D=CanvasRenderingContext2D_;
CanvasGradient=CanvasGradient_;
CanvasPattern=CanvasPattern_;
})();
}

function ieCanvasInit(_1){
var ie,_3,a,_5,i,_7,_8,_9;
ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
_3=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
if((!ie)||(ie[1]<6)||(_3)){
return;
}
_5=document.getElementsByTagName("canvas");
for(i=0;i<_5.length;i++){
node=_5[i];
if(node.getContext){
return;
}
_9=document.createElement("canvas");
_9.id=node.id;
_9.style.width=node.width;
_9.style.height=node.height;
node.parentNode.replaceChild(_9,node);
}
document.namespaces.add("v");
_7=document.createElement("object");
_7.id="VMLRender";
_7.codebase="vgx.dll";
_7.classid="CLSID:10072CEC-8CC1-11D1-986E-00A0C955B42E";
document.body.appendChild(_7);
if((!_1)||(_1=="")){
_1="iecanvas.htc";
}
_8=document.createStyleSheet();
_8.addRule("canvas","behavior: url('"+_1+"');");
_8.addRule("v\\:*","behavior: url(#VMLRender);");
}

var IE=document.all?true:false;
if(!IE){
document.captureEvents(Event.MOUSEMOVE);
}
var tempX=0,tempY=0;
function getMouseXY(e){
if(IE){
tempX=event.clientX+document.body.scrollLeft;
tempY=event.clientY+document.body.scrollTop;
}else{
tempX=e.pageX;
tempY=e.pageY;
}
if(tempX<0){
tempX=0;
}
if(tempY<0){
tempY=0;
}
return true;
}
function events(){
this.id="";
this.X=Array();
this.Y=Array();
this.Index=0;
}
events.prototype.beginPath=function(){
};
events.prototype.moveTo=function(X,Y){
this.X[this.Index]=X;
this.Y[this.Index]=Y;
this.Index++;
};
events.prototype.lineTo=function(X,Y){
this.X[this.Index]=X;
this.Y[this.Index]=Y;
this.Index++;
};
events.prototype.fill=function(){
return this.areaPath();
};
events.prototype.closePath=function(){
};
events.prototype.getCanvasTop=function(){
var _6=parseFloat(this.canvas.offsetTop);
return _6;
};
events.prototype.getCanvasLeft=function(){
var _7=parseFloat(this.canvas.offsetLeft);
return _7;
};
events.prototype.areaPath=function(){
var _8=document.createElement("AREA");
_8.shape="poly";
var _9="";
var i=0,_b="";
while(i<this.Index){
_9=_9+_b+parseInt(this.X[i],10)+","+parseInt(this.Y[i],10);
_b=" , ";
i++;
}
_8.coords=_9;
_8.href="#";
return _8;
};
events.prototype.arc=function(cx,cy,r,_f,_10,_11){
var _12=cx+(r*Math.cos(_f));
var _13=cy+(r*Math.sin(_f));
this.X[this.Index]=_12;
this.Y[this.Index]=_13;
this.Index++;
if(_11==false){
var i=_f,_15="",_16="";
while(i<_10){
_12=cx+(r*Math.cos(i));
_13=cy+(r*Math.sin(i));
this.X[this.Index]=_12;
this.Y[this.Index]=_13;
this.Index++;
i=i+0.1;
}
_12=cx+(r*Math.cos(_10));
_13=cy+(r*Math.sin(_10));
this.X[this.Index]=_12;
this.Y[this.Index]=_13;
this.Index++;
}else{
}
};
events.prototype.lineToPoly=function(_17){
if(_17<=1){
_17=_17*2;
}
var _18=Array(),_19=Array();
var _1a=parseInt(_17/2);
var i=0,j=0;
while(i<(this.Index-1)){
var x1=parseFloat(this.X[i]),y1=parseFloat(this.Y[i]);
i++;
var x2=parseFloat(this.X[i]),y2=parseFloat(this.Y[i]);
var m=0;
m=parseFloat((y2-y1)/(x2-x1),10);
var _22;
var k=0;
if(m==Infinity||m==-Infinity){
_22=0;
k=x1;
var _24=x1+_17;
var _25=y1;
_18[j]=_24;
_19[j]=_25;
j++;
}else{
if(m==0){
_22=(-1)*m;
k=(y1-(_22*x1));
var _24=x1;
var _25=y1+_17;
_18[j]=_24;
_19[j]=_25;
j++;
}else{
_22=(-1)*m;
k=(y1-(_22*x1));
var _24=x1;
var _25=(_22*x1)+k+_17;
_18[j]=_24;
_19[j]=_25;
j++;
}
}
if(i==(this.Index-1)){
if(m==Infinity||m==-Infinity){
_22=0;
k=x2;
var _24=x2+_17;
var _25=y2;
_18[j]=_24;
_19[j]=_25;
j++;
}else{
if(m==0){
_22=(-1)*m;
k=(y1-(_22*x1));
var _24=x2;
var _25=y2+_17;
_18[j]=_24;
_19[j]=_25;
j++;
}else{
_22=(-1)*m;
k=(y2-(_22*x2));
var _24=parseFloat((y2-k)/_22)+_17;
var _24=x2;
var _25=(_22*x2)+k+_17;
_18[j]=_24;
_19[j]=_25;
j++;
}
}
}
}
var _26=Array();
var _27=Array();
this.X=_26.concat(this.X,_18.reverse());
this.Y=_27.concat(this.Y,_19.reverse());
this.Index=this.Index+this.Index;
};

function colors(){
this.baseColor="#FF0000";
this.baseVal=0.7;
this.secondColor="#000000";
this.secondVal=1;
this.alpha=0.7;
this.pieChartGradientOffset=50;
}

var CHART_LINE=1;
var CHART_AREA=2;
var CHART_BAR=3;
var CHART_PIE=4;
var CHART_STACKED=8;
function Chart(el){
this.versionname="0.03";
this._cont=el;
this._yMin=null;
this._yMax=null;
this._xGridDensity=0;
this._yGridDensity=0;
this._flags=0;
this._series=new Array();
this._labelPrecision=0;
this._horizontalLabels=new Array();
this._barWidth=10;
this._barDistance=2;
this._bars=0;
this._showLegend=true;
this._showAxis=true;
this._radiusOfPie=100;
this.showErrorMsg=false;
this.lineWidth=2;
if((typeof CanvasChartPainterFactory!="undefined")&&(window.CanvasRenderingContext2D)){
this._painterFactory=CanvasChartPainterFactory;
}else{
if(typeof JsGraphicsChartPainterFactory!="undefined"){
this._painterFactory=JsGraphicsChartPainterFactory;
}else{
this._painterFactory=null;
}
}
}
Chart.prototype.setRadiusOfPie=function(r){
this._radiusOfPie=r;
};
Chart.prototype.setPainterFactory=function(f){
this._painterFactory=f;
};
Chart.prototype.setVerticalRange=function(_4,_5){
this._yMin=_4;
this._yMax=_5;
};
Chart.prototype.setLabelPrecision=function(_6){
this._labelPrecision=_6;
};
Chart.prototype.setShowLegend=function(b){
this._showLegend=b;
};
Chart.prototype.setShowAxis=function(b){
this._showAxis=b;
};
Chart.prototype.setGridDensity=function(_9,_a){
this._xGridDensity=_9;
this._yGridDensity=_a;
};
Chart.prototype.setHorizontalLabels=function(_b){
this._horizontalLabels=_b;
};
Chart.prototype.setDefaultType=function(_c){
this._flags=_c;
};
Chart.prototype.setBarWidth=function(_d){
this._barWidth=_d;
};
Chart.prototype.setBarDistance=function(_e){
this._barDistance=_e;
};
Chart.prototype.add=function(_f,_10,_11,_12){
var o,_14;
if(!_12){
_12=this._flags;
}
if((_12&CHART_BAR)==CHART_BAR){
_14=this._barDistance+this._bars*(this._barWidth+this._barDistance);
this._bars++;
}else{
_14=0;
}
o=new ChartSeries(_f,_10,_11,_12,_14);
this._series.push(o);
};
Chart.prototype.renewValuesByLabel=function(_15,_16){
var i=0;
var _18=false;
while(i<this._series.length){
if(this._series[i].label==_15){
_18=true;
break;
}
i++;
}
if(_18==true){
this._series[i].values=_16;
}
return _18;
};
Chart.prototype.addChartListener=function(_19){
var i=0;
while(i<this._series.length){
if(this._series[i].label==_19){
break;
}
i++;
}
if(this._series[i]==undefined){
if(this.showErrorMsg==true){
alert("ERROR : chart.addChartListener(...) : this._series[i].tmpArea is undefined!");
}
return document.createElement("AREA");
}else{
return this._series[i].tmpArea;
}
};
Chart.prototype.draw=function(){
var _1b,i,o,o2,len,_20,_21,_22,_23,_24,_25,_26;
if(!this._painterFactory){
return;
}
_23=new Array();
stackedSeries=new Array();
_20=0;
_21=this._yMin;
_22=this._yMax;
for(i=0;i<this._series.length;i++){
o=this._series[i];
if((o.flags&CHART_STACKED)==CHART_STACKED){
_23.push(o);
}
}
for(i=_23.length-2;i>=0;i--){
o=_23[i].values;
o2=_23[i+1].values;
len=(o2.length>o.length)?o2.length:o.length;
for(j=0;j<len;j++){
if((o[j])&&(!o2[j])){
continue;
}
if((!o[j])&&(o2[j])){
o[j]=o2[j];
}else{
o[j]=parseInt(o[j])+parseFloat(o2[j]);
}
}
}
for(i=0;i<this._series.length;i++){
o=this._series[i];
if((o.flags&CHART_STACKED)!=CHART_STACKED){
_23.push(o);
}
}
for(i=0;i<_23.length;i++){
o=_23[i];
if(o.values.length>_20){
_20=o.values.length;
}
for(j=0;j<o.values.length;j++){
if((o.values[j]<_21)||(_21==null)){
_21=o.values[j];
}
if(o.values[j]>_22){
_22=o.values[j];
}
}
}
if(this._series.length==this._bars){
_20++;
this._xGridDensity++;
}
_1b=this._painterFactory();
_1b.showErrorMsg=this.showErrorMsg;
_1b.create(this._cont);
_1b.init(_20,_21,_22,this._xGridDensity,this._yGridDensity,true);
_1b.drawBackground();
if(this._showLegend){
_1b.drawLegend(_23);
}
if((this._flags&~CHART_STACKED)==CHART_BAR){
_1b.offsetLabel_HorizontalAxis=parseInt(((this._barWidth+this._barDistance)*this._series.length)/2)+1;
}
if((this._xGridDensity)&&(this._yGridDensity)&&true){
_1b.drawVerticalAxis(this._yGridDensity,this._labelPrecision);
_1b.drawHorizontalAxis(_20,this._horizontalLabels,this._xGridDensity,this._labelPrecision);
}
_1b.initEventImgmap(this._cont.id);
_1b.initEventImg("./images/chart_bg.gif");
_1b.drawChart();
var _27=0;
for(i=0;i<_23.length;i++){
_24=_23[i].flags&~CHART_STACKED;
switch(_24){
case CHART_PIE:
_27=_27+_23[i].values[0];
}
}
for(i=0;i<_23.length;i++){
_24=_23[i].flags&~CHART_STACKED;
switch(_24){
case CHART_LINE:
_1b.drawLine(_23[i].color,_23[i].values,this.lineWidth);
break;
case CHART_AREA:
_1b.drawArea(_23[i].color,_23[i].values);
break;
case CHART_BAR:
_1b.drawBars(_23[i].color,_23[i].values,_20-1,_23[i].offset,this._barWidth);
break;
case CHART_PIE:
_1b.drawPie(_23[i].color,_23[i].values,_27,parseInt(this._cont.clientWidth/2),parseInt(this._cont.clientHeight/2),this._radiusOfPie);
break;
default:
}
}
if(this._showAxis==true){
_1b.drawAxis();
}
_1b.appendEvents(_23);
if(this._series.length==this._bars){
this._xGridDensity--;
}
};
function ChartSeries(_28,_29,_2a,_2b,_2c){
this.label=_28;
this.color=_29;
this.values=_2a;
this.flags=_2b;
this.offset=_2c;
this.tmpArea=document.createElement("AREA");
this.tmpArea.onclick=function(){
return false;
};
}
function AbstractChartPainter(){
}
AbstractChartPainter.prototype.calc=function(w,h,_2f,_30,_31,xgd,ygd){
this.range=_31-_30;
this.xstep=w/(_2f-1);
this.xgrid=(xgd)?w/(xgd-1):0;
this.ygrid=(ygd)?h/(ygd-1):0;
this.ymin=_30;
this.ymax=_31;
};
AbstractChartPainter.prototype.create=function(el){
};
AbstractChartPainter.prototype.init=function(_35,_36,_37,xgd,ygd,_3a){
};
AbstractChartPainter.prototype.drawLegend=function(_3b){
};
AbstractChartPainter.prototype.drawVerticalAxis=function(ygd,_3d){
};
AbstractChartPainter.prototype.drawHorizontalAxis=function(_3e,_3f,xgd,_41){
};
AbstractChartPainter.prototype.drawAxis=function(){
};
AbstractChartPainter.prototype.drawBackground=function(){
};
AbstractChartPainter.prototype.drawChart=function(){
};
AbstractChartPainter.prototype.drawArea=function(_42,_43){
};
AbstractChartPainter.prototype.drawLine=function(_44,_45){
};
AbstractChartPainter.prototype.drawBars=function(_46,_47,_48,_49,_4a){
};

