﻿Module.createNamespace('com.wjstc.Graphics');Module.require('com.wjstc.Common',1.1);Module.require('com.wjstc.HideSelectIE6',1.1);Module.require('com.wjstc.Util',1.1);com.wjstc.Graphics.NAME='com.wjstc.Graphics';com.wjstc.Graphics.VERSION=1.1;com.wjstc.Graphics.Graph=function(chartTitle,labels,data,draggable,resizable,totalWidth,totalHeight,legends,columnsToShow,rowsToShow,showLegend,panelBackground,panelBorderWidth,panelBorderColor,cilindersBgColors,cilinderBorderWidth,cilinderBorderColor,gridBackground,gridBorderWidth,gridBorderColor,gridBorderColorV,gridBorderColorH){var u='undefined';this.chartTitle=chartTitle;this.labels=labels;this.data=data;this.dataRows=this.data.length;this.dataCols=0;if(this.dataRows>0){this.dataCols=this.data[0].length;;}this.draggable=(typeof(draggable)!='undefined')?draggable:'Y';this.resizable=(typeof(resizable)!='undefined')?resizable:'Y';this.totalWidth=(typeof(totalWidth)!=u)?(totalWidth-0):30;this.totalHeight=(typeof(totalHeight)!=u)?(totalHeight-0):20;this.legends=(typeof(legends)!=u)?legends:['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49'];if(typeof(columnsToShow)!=u){this.columnsToShow=columnsToShow;}else{this.columnsToShow=',';for(var i=0;i<this.dataCols;++i)this.columnsToShow+=i+',';}if(typeof(rowsToShow)==u){this.rowsToShow=rowsToShow;}else{this.rowsToShow=',';for(var i=0;i<this.dataRows;++i)this.rowsToShow+=i+',';}this.cilindersBgColors=(typeof(cilindersBgColors)!=u&&cilindersBgColors!=null)?cilindersBgColors:['336666','CCCC33','993399','A8A8A8','666699','003300','660000','339999','666633','999999','6666CC','669966','330000','660066','999933','777777','3333CC','66CC66','996666','330033','006666','666666','333366','33CC33','CC6666','996699','003333','666600','333399','336633','CC3333','CC66CC','669999','333300','333333','339933','663333','CC33CC','66CCCC','999966','000000','000066','993333','663366','33CCCC','CCCC66','CCCCCC','000033','006600'];this.showLegend=(typeof(showLegend)!=u)?showLegend:((this.showCols>0)?'Y':'N');this.panelBackground=(typeof(panelBackground)!='undefined')?panelBackground:'#e9e9e9';this.panelBorderWidth=(typeof(panelBorderWidth)!='undefined')?panelBorderWidth:2;this.panelBorderColor=(typeof(panelBorderColor)!='undefined')?panelBorderColor:'#999999';this.panelBorderLightColor=com.wjstc.Util.HexAjust(this.panelBorderColor,40);this.cilinderBorderWidth=(typeof(cilinderBorderWidth)!='undefined')?cilinderBorderWidth:1;this.cilinderBorderColor=(typeof(cilinderBorderColor)!='undefined')?cilinderBorderColor:'#000000';this.gridBackground=(typeof(gridBackground)!='undefined')?gridBackground:'#ffeecc';this.gridBorderWidth=(typeof(gridBorderWidth)!='undefined')?gridBorderWidth:1;this.gridBorderColor=(typeof(gridBorderColor)!='undefined')?gridBorderColor:'#336699';this.gridBorderColorV=(typeof(gridBorderColorV)!='undefined')?gridBorderColorV:'#cccccc';this.gridBorderColorH=(typeof(gridBorderColorH)!='undefined')?gridBorderColorH:'#cccccc';this.chart_div_id='com.wjstc.GraphicsDiv';this.charset='utf-8';this.sectionWidth_em=4;this.legendWidth_em=10.2;this.scaleWidth_em=6;this.graphics=document.createElement('div');this.graphics.style.border=this.panelBorderWidth+'px solid '+this.panelBorderColor;this.graphics.style.borderColor=this.panelBorderLightColor+" "+this.panelBorderColor+" "+this.panelBorderColor+" "+this.panelBorderLightColor;this.graphics.style.backgroundColor='transparent';this.graphics.style.position='absolute';com.wjstc.Common.moveToXY(this.graphics,10,10);this.graphics.style.zIndex='10';this.graphics.style.padding='0px';this.graphics.style.fontFamily='Verdana,Helvetica,sans-serif';this.graphics.style.fontSize='1em';this.graphics.innerHTML='';this.graphics.id=this.chart_div_id;this.graphics.style.zoom=1.0;};com.wjstc.Graphics.Graph.prototype.d=function(){var im;this.cellScale=100;this.maxScale=2;this.minScale=0;this.sectionSize_em=8;var ro;var s;var re;var ch;var u='undefined';var ts="<table border='0' cellpadding='0' cellspacing='0'";var bor='#000000';var kk;var ii;var min;var max;var maxx;var st;var rs;this.dataRows=this.data.length;this.dataCols=0;if(this.dataRows>0){this.dataCols=this.data[0].length;;}this.showCols=com.wjstc.Util.strSubstringCount(this.columnsToShow,',')-1;if(this.showCols<0){this.showCols=0;}this.showRows=com.wjstc.Util.strSubstringCount(this.rowsToShow,',')-1;if(this.showRows<0){this.showRows=0;}max=Number.MIN_VALUE;min=0;if(this.showCols<1||this.showRows<1){max=0;min=0;}var i;var j;for(i=0;i<this.dataRows;i++){if(this.rowsToShow.indexOf(','+i+',')>=0){for(j=0;j<this.dataCols;j++){if(this.columnsToShow.indexOf(','+j+',')>=0){if((this.data[i][j]-0)>max){max=this.data[i][j]-0;}if((this.data[i][j]-0)<min){min=this.data[i][j]-0;}}}}}this.cellScale=0.0001;maxx=max-min;while(maxx>this.cellScale){this.cellScale=this.cellScale*10;}ro=100/this.cellScale;this.cellScale=(Math.round(this.cellScale*ro)/ro)/20;this.maxScale=0;while(this.maxScale<=max){this.maxScale+=this.cellScale;}this.minScale=0;while(this.minScale>min){this.minScale-=this.cellScale;}this.sectionSize_em=Math.ceil(this.totalHeight*this.cellScale/(this.maxScale-this.minScale));if(this.minScale<0)if(((min-this.minScale)*this.sectionSize_em/this.cellScale)<2){this.minScale-=this.cellScale;this.sectionSize_em=Math.ceil(th*this.cellScale/(this.maxScale-this.minScale));}if(this.sectionSize_em<2)this.sectionSize_em=2;this.minScale=(Math.round(this.minScale*ro)/ro);this.maxScale=(Math.round(this.maxScale*ro)/ro);max=0;for(i=0;i<this.dataCols;++i){if(this.columnsToShow.indexOf(','+i+',')>=0){var maxWordLen=com.wjstc.Util.maxWordLength(this.labels[i]);if(max<maxWordLen){max=maxWordLen;}}}if(max<4){max=4;}this.sectionWidth_em=max;max=0;for(i=0;i<this.dataRows;i++){if(this.rowsToShow.indexOf(','+i+',')>=0){if(max<this.legends[i].length){max=this.legends[i].length;}}}if(max<10){max=10;}this.legendWidth_em=(max-0)+3;this.scaleWidth_em=((this.maxScale+'').length+4)*0.6;};com.wjstc.Graphics.Graph.prototype.f=function(){var i,ii,j,jj,k,l,kk,h,s,w;var position;this.d();var fS=Math.round(com.wjstc.Common.toFloat(com.wjstc.Common.ZoomSensor.getFontSize(),8));if(fS<6)fS=6;var zoom=1.0;if(com.wjstc.Util.isIE7){zoom=com.wjstc.Common.ZoomSensor.getZoom();}var S_J=new com.wjstc.Util.StrJoin();S_J.put("<div id='com.wjstc.Graphics.Graph.gr_panel' style='position:relative;left:0;top:0;font-size:"+this.size+"em;font-family:Verdana,Helvetica,sans-serif;font-weight:bold;");S_J.put("font-family:Verdana,Helvetica,sans-serif;font-weight:bold;");S_J.put("background-color:"+this.panelBackground+";border:0;'");S_J.put(">");S_J.put("<table  id='com.wjstc.Graphics.Graph.gr_table' cellpadding='0' cellspacing='0' border='1' style='z-index:15;border:"+this.panelBorderWidth+"px "+this.panelBorderColor+";'>");S_J.put("<tr>");S_J.put("<td style='position:relative;width:"+this.scaleWidth_em*this.size+"em;height:"+2*this.size+"em;vertical-align:bottom;border:0;'>");if(!com.wjstc.Util.isIE&& !com.wjstc.Util.isIE7){S_J.put("<div style='position:relative;height:100%;width:100%;border:0; background-color:"+this.panelBackground+";'>");}S_J.put("<span style='position:absolute;bottom:-0.6em;right:0.2em;text-align:right;border:0;font-size:"+this.size+"em; background-color:"+this.panelBackground+";'>"+this.maxScale+"&nbsp;</span>");if(!com.wjstc.Util.isIE&& !com.wjstc.Util.isIE7){S_J.put("</div>");}S_J.put("</td>");S_J.put("<td style='border:0;'>&nbsp;</td><td align='center' colspan='"+this.showCols+"' style='font-size:"+(1.2*this.size)+"em;border:0;padding:0.5em 0 0.25em 0;'");if(this.draggable=='Y'){S_J.put(" onmouseover=\"this.style.cursor='move';return false;\"");S_J.put(" onmousedown=\"com.wjstc.DragDrop.drag(com.wjstc.Common.getObjById('com.wjstc.GraphicsDiv'),event,null,");if((zoom-0)!=1.0){S_J.put("com.wjstc.Graphics.gr.show");}else{S_J.put("com.wjstc.HideSelectIE6.hs.hideShowHS");}S_J.put(",null);return false;\"");S_J.put(" onmouseup=\"this.style.cursor='pointer';com.wjstc.Graphics.gr.showChart();return false;\"");S_J.put(" onmouseout=\"this.style.cursor='pointer';return false;\"");}S_J.put(">"+this.chartTitle+"</td>");S_J.put("<td style='border:0;padding:2px;' align='right'>");S_J.put("<table cellpadding='1' cellspacing='0' style='width:1.2em;vertical-align:middle;font-size:"+this.size+"em;'>");S_J.put("<tr>");S_J.put("<td style='height:1.2em;width:1.2em; background-color:"+this.panelBackground+";");S_J.put(" border:1px solid "+this.panelBackground+";padding:2px;vertical-align:middle;text-align: center;'");S_J.put(" onmouseover=\"this.style.cursor='pointer';this.style.borderColor='"+this.panelBorderColor+"'; this.style.backgroundColor='#FFD494';return false;\"");S_J.put(" onmouseout=\"this.style.cursor='pointer';this.style.borderColor='"+this.panelBackground+"'; this.style.backgroundColor='"+this.panelBackground+"';\"");S_J.put(" onmousedown=\"this.style.borderColor='"+this.panelBorderColor+"';this.style.backgroundColor='#FFB874';return false;\" ");S_J.put(" onmouseup=\"this.style.cursor='pointer';this.style.borderColor='"+this.panelBorderColor+"';this.style.backgroundColor='#FFD494';com.wjstc.Graphics.gr.hideChart();return false;\"");S_J.put(" onclick=\"com.wjstc.Graphics.gr.hideChart();return false;\"");S_J.put("><img src='img/cancel.gif' style='vertical-align:bottom;' border='0' alt='Cancel' /><\/td>");S_J.put("</tr>");S_J.put("</table>");S_J.put("</td>");S_J.put("</tr>");var s="  ";w=this.totalWidth/this.showCols;if(w<this.sectionWidth_em){w=this.sectionWidth_em;}w=w/this.showRows;if(w<1.5){w=1.5;}var maxWidth=(w*this.showRows*1.2+(this.showRows>>2)/fS)*this.showCols+this.scaleWidth_em;if(this.showLegend=='Y'){maxWidth+=this.legendWidth_em*0.6;}this.graphics.style.width=com.wjstc.Common.toFloat(maxWidth*this.size,8)+'em';var cilinderWidth=Math.round(fS*w*0.80*this.size);if(cilinderWidth-(this.cilinderBorderWidth<<1)<3){cilinderWidth=(this.cilinderBorderWidth<<1)+3;}for(k=this.maxScale-this.cellScale,i=0;k>0;k-=this.cellScale,i++){S_J.put("<tr>");S_J.put("<td style='position:relative;width:"+this.scaleWidth_em*this.size+"em;vertical-align:bottom;border:0;'>");if(!com.wjstc.Util.isIE&& !com.wjstc.Util.isIE7){S_J.put("<div style='position:relative;height:100%;width:100%;border:0;'>");}S_J.put("<span style='position:absolute;bottom:-0.6em;right:0.2em;text-align:right;border:0;font-size:"+this.size+"em; background-color:"+this.panelBackground+";'>"+k+"&nbsp;</span>");if(!com.wjstc.Util.isIE&& !com.wjstc.Util.isIE7){S_J.put("</div>");}S_J.put("</td>");S_J.put("<td style='width:"+(0.2*this.size)+"em;"+"border-top:"+this.gridBorderWidth+"px solid "+this.gridBorderColor+";"+"border-right:0;"+"border-bottom:0;"+"border-left:0;"+"'>&nbsp;</td>");for(j=0,jj=0;jj<this.dataCols;++jj){if(this.columnsToShow.indexOf(','+jj+',')>=0){S_J.put("<td id='com.wjstc.Graphics.Graph.gr"+i+"c"+j+"' "+"style='vertical-align:bottom;height:"+this.sectionSize_em*this.size+"em;width:"+(this.showRows*w*1.2+(this.showRows>>2)/fS)*this.size+"em;background-color:"+this.gridBackground+";"+"border-top:"+this.gridBorderWidth+"px solid "+((i==0)?this.gridBorderColor:this.gridBorderColorH)+";"+"border-right:"+this.gridBorderWidth+"px solid "+((j==(this.showCols-1))?this.gridBorderColor:this.gridBorderColorV)+";"+"border-bottom:"+((k!=0)?0:this.gridBorderWidth)+"px solid "+this.gridBorderColor+";"+"border-left:"+((j==0)?this.gridBorderWidth:0)+"px solid "+this.gridBorderColor+";"+"'>&nbsp;</td>");j++;}}if(i==0){S_J.put("<td rowspan='"+(this.maxScale/this.cellScale+4)+"' style='padding:0 4px;vertical-align:top;border:0;'>");if(this.showLegend='Y'){S_J.put("<table cellpadding='3' cellspacing='0' style='font-size:"+this.size+"em;border:"+this.gridBorderWidth+"px solid "+this.gridBorderColor+";'>");for(var ii=0;ii<this.dataRows;ii++){if(this.rowsToShow.indexOf(','+ii+',')>=0){S_J.put("<tr><td valign='bottom' style='height:"+this.size*1.2+"em;width:"+this.size*1.2+"em;'>");S_J.put("<div id='com.wjstc.Graphics.Graph.gr_"+ii+"_div' style='position:relative;height:"+this.size+"em;width:"+this.size+"em; background-color:"+this.panelBackground+";'>&nbsp;");S_J.put(com.wjstc.Util.cilinderV('legend'+ii+'c',Math.ceil(fS*this.size),Math.ceil(fS*this.size)+'px','position:absolute;left:0;bottom:0;',this.cilinderBorderColor,this.cilinderBorderWidth,this.cilindersBgColors[ii]));S_J.put("</div>");S_J.put("</td><td valign='bottom' style='font-size:1em;width:"+this.legendWidth_em*0.6+"em;'>"+this.legends[ii]+"</td></tr>");}}S_J.put("</table>");}else{S_J.put("&nbsp;");}}S_J.put("</td>");S_J.put("</tr>");}S_J.put("<tr>");S_J.put("<td style='position:relative;width:"+this.scaleWidth_em*this.size+"em;vertical-align:bottom;border:0;'>");if(!com.wjstc.Util.isIE&& !com.wjstc.Util.isIE7){S_J.put("<div style='position:relative;height:100%;width:100%;border:0;'>");}S_J.put("<span style='position:absolute;bottom:-0.6em;right:0.2em;text-align:right;border:0;font-size:"+this.size+"em; background-color:"+this.panelBackground+";'>"+this.minScale+"&nbsp;</span></div></td>");if(!com.wjstc.Util.isIE&& !com.wjstc.Util.isIE7){S_J.put("</div>");}S_J.put("</td>");S_J.put("<td style='width:"+(0.2*this.size)+"em;"+"border-top:"+this.gridBorderWidth+"px solid "+this.gridBorderColor+";"+"border-right:0;"+"border-bottom:0;"+"border-left:0;"+"'>&nbsp;</td>");for(j=0,jj=0;jj<this.dataCols;++jj){if(this.columnsToShow.indexOf(','+jj+',')>=0){S_J.put("<td id='com.wjstc.Graphics.Graph.gr_"+j+"_td' "+"style='position:relative;height:"+(this.sectionSize_em*this.size)+"em;width:"+((this.showRows*w+(this.showRows>>2)/fS)*this.size)+"em;background-color:"+this.gridBackground+";"+"border-top:"+this.gridBorderWidth+"px solid "+((i==0)?this.gridBorderColor:this.gridBorderColorH)+";"+"border-right:"+this.gridBorderWidth+"px solid "+((j==(this.showCols-1))?this.gridBorderColor:this.gridBorderColorV)+";"+"border-bottom:0;"+"border-left:"+((j==0)?this.gridBorderWidth:0)+"px solid "+this.gridBorderColor+";"+"'>");S_J.put("<div id='com.wjstc.Graphics.Graph.gr_"+j+"_div' style='position:relative;height:100%;width:100%;background-color:"+this.gridBackground+";'>&nbsp;");for(l=0,ii=0;ii<this.dataRows;++ii){if(this.rowsToShow.indexOf(','+ii+',')>=0){position=(l*w+w*0.25)*this.size*1.15;S_J.put(com.wjstc.Util.cilinderV('r'+j+'c'+l,cilinderWidth,((this.data[ii][jj]*this.sectionSize_em*this.size)/this.cellScale)+'em','position:absolute;left:'+position+'em;bottom:-1px;float:left;',this.cilinderBorderColor,this.cilinderBorderWidth,this.cilindersBgColors[l]));++l;}}S_J.put("</div>");S_J.put("</td>");j++;}}S_J.put("</tr>");S_J.put("<tr>");S_J.put("<td style='font-size:"+(0.3*this.size)+"em;width:"+this.scaleWidth_em*this.size+"em;border:0;'>&nbsp;</td>");S_J.put("<td style='font-size:"+(0.3*this.size)+"em;width:"+(0.2*this.size)+"em;border:0;border-top:"+this.gridBorderWidth+"px solid "+this.gridBorderColor+";'>&nbsp;</td>");for(j=0,jj=0;jj<this.dataCols;++jj){if(this.columnsToShow.indexOf(','+jj+',')>=0){S_J.put("<td id='com.wjstc.Graphics.Graph.gr"+i+"c"+j+"' style='font-size:"+(0.3*this.size)+"em;position:relative;width:"+(this.showRows*w+(this.showRows>>2)/fS)*this.size+"em;"+"border-top:"+this.gridBorderWidth+"px solid "+this.gridBorderColor+";"+"border-right:"+this.gridBorderWidth+"px solid "+this.gridBorderColor+";"+"border-bottom:0;"+"border-left:"+((j==0)?this.gridBorderWidth:0)+"px solid "+this.gridBorderColor+";"+"'>&nbsp;</td>");++j;}}S_J.put("</tr>");S_J.put("<tr>");S_J.put("<td style='width:"+this.scaleWidth_em*this.size+"em;border:0;'>&nbsp;</td>");S_J.put("<td style='width:"+(0.2*this.size)+"em;border:0;'><div style='position:relative;height:100%;width:100%;'><span style='position:absolute;top:-"+(0.6*this.size)+"em;right:"+this.size+"em; background-color:"+this.panelBackground+";'>&nbsp</span></div></td>");for(jj=0;jj<this.dataCols;++jj){if(this.columnsToShow.indexOf(','+jj+',')>=0){S_J.put("<td style='width:"+(this.showRows*w+(this.showRows>>2)/fS)+"em;padding:0px 2px 0.5em 2px;vertical-align:top;text-align:center;border:0;font-size:"+this.size+"em;'>"+com.wjstc.Util.CPtoBR(this.labels[jj])+"</td>");}}S_J.put("</tr>");S_J.put("</table>");S_J.put("</div>");var s=S_J.get();return s;};com.wjstc.Graphics.Graph.prototype.c=function(size){if(typeof(size)!='undefined'){this.size=size;}if(this.graphics.parentNode!=document.body){document.body.appendChild(this.graphics);}this.graphics.innerHTML=this.f();com.wjstc.Graphics.gr.graphics.style.visibility='visible';};com.wjstc.Graphics.Graph.prototype.showChart=function(){if(typeof(this.size)!=='undefined'){this.size=1.0;}com.wjstc.Graphics.gr.c(this.size);};com.wjstc.Graphics.Graph.prototype.initChart=function(size){if(typeof(size)!='undefined'){this.size=size;}this.c(this.size);com.wjstc.Util.moveToCenter(this.graphics);this.graphics.style.visibility='visible';com.wjstc.HideSelectIE6.hs.registerObj(this.chart_div_id);if(com.wjstc.Graphics.gr.show){com.wjstc.Common.ZoomSensor.addEventListener('fontSize',com.wjstc.Graphics.gr.show,com.wjstc.Graphics.gr);}};com.wjstc.Graphics.Graph.prototype.hideChart=function(){com.wjstc.HideSelectIE6.hs.unregisterObj(this.chart_div_id);this.graphics.style.visibility='hidden';if(com.wjstc.Graphics.gr.show){com.wjstc.Common.ZoomSensor.removeEventListener('fontSize',com.wjstc.Graphics.gr.show);}};com.wjstc.Graphics.gr=new com.wjstc.Graphics.Graph('Sales by Quarters',['Est. Sale Amount/ Total ','Est. Sale Amount/ Average ','Revenue Forecast/ Total','Revenue Forecast/ Average'],[[135000.00,508750.00,586000.00,396500.00],[700000.00,350000.00,577000.00,288500.00],[788000.00,596000.00,485000.00,495000.00],[170000.00,170000.00,150000.00,150000.00],[305000.00,152500.00,242000.00,121000.00],[659000.00,219666.67,494000.00,164666.67],[836000.00,278666.67,680000.00,226666.67]],'Y','Y',30,20,['Canada','Europe','Japan','Mid-Atlantic','Midwest','Southeast','Southwest'],',0,1,2,3,4,5,6,',',0,1,2,3,','N','#f0f0f0',2,'#999999',null,1,'#000000','#ffeecc',1,'#336699','#cccccc','#cccccc');