forked from toshirot/ccchart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ccchart-min.js
1 lines (1 loc) · 82.6 KB
/
ccchart-min.js
1
window.ccchart=(function(a){return{aboutThis:{name:"ccchart",version:"1.11.06",update:20160203,updateMemo:"http://ccchart.com/update.json",license:"MIT",memo:"This is a Simple and Realtime JavaScript chart that does not depend on libraries such as jQuery or google APIs.",demoCurrent:"http://ccchart.com/",demoDevelopment:"http://ccchart.org/",writer:"Toshiro Takahashi @toshirot",see:"http://www.facebook.com/javascripting",blog:"http://ngw.jp/~tato/wp/?cat=6",branched:"This project has branched from the jQchart, that made by Toshiro Takahashi jQchart is the jQuery plugin. since 2007. http://archive.plugins.jquery.com/project/jQchart",plugins:[]},m:[],init:function c(d,g,n){this.drawing=false;var j;if((""+d.nodeName).toLowerCase()==="canvas"){this.canvas=d;this.id=d.id}else{if(j=document.getElementById(d)){this.canvas=j;this.id=d}else{throw new Error("Please check the ID. For example, spell, or single-byte and double-byte is different")}}if(typeof this.ids!=="object"){this.ids=[];this.cxs=[];this.ops=[];this.gcf=this.gcf||{};this.wses=[];this.wsuids=[];this.wsidoj={};this.wsReCnt=[];this.idsLen=0;this.moveDly=0;this.moveStack=[];this.moveStackDly=[];this.cssgs=[];this.cssTooltips=[]}if(typeof this._addsFlg==="undefined"){this._addsFlg=0}for(var f in a.ccchart.m){var m=!!f;break}if(m){for(var f in this.m){if(this.m[f]){this.moduleExtend(this,this.m[f],f,this.m[f].update)}}}this.callback=n;this.idsLen++;var e=" "+this.canvas.getAttribute("class")+" ";if(e.indexOf(" -ccchart ")!==-1){this.canvas.setAttribute("class","-ccchart "+this.canvas.getAttribute("class"))}this.ids[this.id]=this.canvas;this.ctx=this.cxs[this.id]=this.canvas.getContext("2d");if(!g.data){g.data=g.data||[[""],[""]]}this.ops[this.id]=this.ops[this.id]||[];if(a.ccchart._added_unloadEvent!=="on"){a.addEventListener("unload",function(){a.ccchart=null});a.ccchart._added_unloadEvent="on"}var l=document.getElementById("-ccchart-css-hybrid");if(l){var h=document.getElementById("-ccchart-css-groupbox");var k=document.getElementById("-ccchart-css-group-"+this.id);if(h&&k){h.removeChild(k)}}this.loadBranch(g,n);return this},preProcessing:function(h,m){if(!h){h={}}if(!this.gcf){this.gcf={}}if(!h.config){h.config={}}this.deep=h.config.deep||this.gcf.deep||"yes";if(this.deep==="yes"){h=this.util.deepJSONCopy(h)}this.op=h;this.display=h.config.display||this.gcf.display||this.canvas.style.display||"block";this.canvas.style.display=this.display;this.width=h.config.width||this.gcf.width||600;this.height=h.config.height||this.gcf.height||400;this.bg=h.config.bg||this.gcf.bg||undefined;this.bgGradient=h.config.bgGradient||this.gcf.bgGradien||"";if(this.bgGradient===""&&this.bg===undefined){this.bgGradient={direction:"vertical",from:"#687478",to:"#222"}}this.type=h.config.type||this.gcf.type||"line";if((h.config.useToolTip==="yes"||this.gcf.useToolTip==="yes")&&(this.type==="bar"||this.type==="stacked")){h.config.useMarker="css-maru";this.barTipAnchorColor=this.op.config.barTipAnchorColor||this.gcf.barTipAnchorColor||"rgba(0,0,0,0.7)"}this.useToolTip=h.config.useToolTip||this.gcf.useToolTip||"no";this.useCss=h.config.useCss||this.gcf.useCss||"no";this.useMarker=h.config.useMarker||this.gcf.useMarker||"none";if(this.useMarker==="css-ring"||this.useMarker==="css-maru"){if(!(this.type==="pie")){this.useCss="yes";this.useToolTip="yes"}}else{if(this.useToolTip==="yes"){if(!(this.type==="pie")){this.useCss="yes"}this.useMarker="css-maru"}}if(this.useToolTip==="yes"){this.tmpToolTip=h.config.tmpToolTip||this.gcf.tmpToolTip}if(this.type==="pie"){this.useMarker="none"}this.markerWidth=h.config.markerWidth||this.gcf.markerWidth||this.lineWidth*2||2;if(this.useCss==="yes"){this.bind("scroll","_adjustcsspos");this.bind("load","_adjustcsspos");this.bind("resize","_adjustcsspos")}this.defaultZindex=(h.config.defaultZindex!==undefined)?h.config.defaultZindex:(this.gcf.defaultZindex!==undefined)?this.gcf.defaultZindex:0;this.changeRC=h.config.changeRC||this.gcf.changeRC||"no";if(this.changeRC!=="no"){h.data=this.util.changeRowsAndCols(h.data)}this.wkdata=h.data||[];this.useFirstToColName=(h.config.useFirstToColName===false)?false:((this.gcf.useFirstToColName===false)?false:true);this.useFirstToColName=(this.useFirstToColName===false)?((this.type==="scatter")?true:false):true;if(this.wkdata.length===1){this.useFirstToColName=false}this.useFirstToRowName=(h.config.useFirstToRowName===false)?false:((this.gcf.useFirstToRowName===false)?false:true);this.useFirstToRowName=(this.useFirstToRowName===false)?false:true;this.colNames=(this.useFirstToColName===true)?this.wkdata.slice(0,1)[0]:"";this.wkdata=this.data=(this.useFirstToColName===true)?this.wkdata.slice(1):this.wkdata;this.rowNames=[];this.data=[];if(this.useFirstToRowName===true){this.colNamesTitle=this.colNames.slice(0,1)[0]||"";this.colNames=this.colNames.slice(1);for(var f=0;f<this.wkdata.length;f++){this.rowNames.push(this.wkdata[f][0]);this.data.push(this.wkdata[f].slice(1))}}else{this.colNamesTitle="";if(this.useFirstToColName===true){}else{this.colNames=this.colNames.slice(1)}for(var f=0;f<this.wkdata.length;f++){this.rowNames.push("");this.data.push(this.wkdata[f])}}this.hanreiNames=this.rowNames;this.useRow0thToHanrei=h.config.useRow0thToHanrei||this.gcf.useRow0thToHanrei||"none";if(this.type==="scatter"){this.colNamesTitle=this.rowNames[0]||"";this.rowNamesTitle=this.rowNames[1]||"";if(this.useRow0thToHanrei==="yes"){this.hanreiNames=""}else{this.hanreiNames=this.util.uniq(this.colNames.slice(0))}}this.dataRowLen=this.data.length;this.dataColLen=this.data[0].length;this.maxWsColLen=this.op.config.maxWsColLen||this.gcf.maxWsColLen||10;this.wsDbg=this.op.config.wsDbg||false;this.wsInfo=this.op.config.wsInfo||false;var d=[];for(var f=0;f<this.data.length;f++){d[f]=[];for(var e=0;e<this.data[f].length;e++){d[f][e]=parseFloat((""+this.data[f][e]).split(",").join("")||0)}}this.data=d;this.yScalePercent=this.op.config.yScalePercent||this.gcf.yScalePercent||"no";if((this.type==="stacked%"||this.type==="pie")&&this.op.config.percentVal!="no"){this.op.config.percentVal="yes"}this.percentVal=this.op.config.percentVal||this.gcf.percentVal||"no";this.title=h.config.title||this.gcf.title||"";this.subtitle=h.config.subTitle||h.config.subtitle||this.gcf.subTitle||"";this.canvas.setAttribute("title",this.title);this.useHanrei=h.config.useHanrei||h.config.useHanrei||this.gcf.useHanrei||"yes";if(this.useFirstToRowName===false){this.useHanrei="no"}if(this.type==="candle"){this.useHanrei="no"}this.onlyChart=h.config.onlyChart||this.gcf.onlyChart||"no";this.onlyChartWidthTitle=h.config.onlyChartWidthTitle||this.gcf.onlyChartWidthTitle||"no";this.paddingDefault=h.config.paddingDefault||this.gcf.paddingDefault||10;if(this.onlyChartWidthTitle==="yes"){this.paddingBottomDefault=this.paddingLeftDefault=this.paddingRightDefault=this.paddingDefault;this.paddingTopDefault=90;this.onlyChart="yes"}else{if(this.onlyChart==="yes"){this.paddingTopDefault=this.paddingBottomDefault=this.paddingLeftDefault=this.paddingRightDefault=this.paddingDefault}else{this.paddingTopDefault=90;if(this.title===""){this.paddingTopDefault=this.paddingTopDefault-30}if(this.subtitle===""){this.paddingTopDefault=this.paddingTopDefault-15}this.paddingBottomDefault=40;this.paddingLeftDefault=110;if(this.yScalePercent==="no"){this.paddingLeftDefault=70}this.paddingRightDefault=120;if(this._addsFlg>0){this.paddingRightDefault=160}}}if(this.useHanrei!=="yes"&&!this.type==="candle"){this.paddingRightDefault=60;if(this._addsFlg>0){this.paddingRightDefault=110;this.paddingRightDefault=this.paddingLeftDefault}}this.useVal=h.config.useVal||this.gcf.useVal||"no";if(this.type==="stacked%"&&this.useVal==="yes"){this.paddingTopDefault=90}this.paddingTop=h.config.paddingTop||this.gcf.paddingTop||this.paddingTopDefault;this.paddingBottom=h.config.paddingBottom||this.gcf.paddingBottom||this.paddingBottomDefault;this.paddingLeft=h.config.paddingLeft||this.gcf.paddingLeft||this.paddingLeftDefault;this.paddingRight=h.config.paddingRight||this.gcf.paddingRight||this.paddingRightDefault;this.chartWidth=this.width-this.paddingLeft-this.paddingRight;this.chartHeight=this.height-this.paddingTop-this.paddingBottom;this.chartTop=this.paddingTop;this.chartBottom=this.height-this.paddingBottom;this.chartLeft=this.paddingLeft;this.chartRight=this.width-this.paddingRight;this.roundDigit=this.op.config.roundDigit;if(this.roundDigit===undefined){this.gcf.roundDigit}if(typeof this.roundDigit==="number"){this._useDecimal="yes";this.roundDigit=parseInt(this.roundDigit)}else{if(this.roundDigit===undefined){if(JSON.stringify(this.data).indexOf(".")!==-1){this._useDecimal="yes";this.roundDigit=3}else{this._useDecimal="no";this.roundDigit=0}}else{this._useDecimal="no"}}this.yScaleOrder=this.op.config.yScaleOrder||this.gcf.yScaleOrder||"DESC";this.xScaleDecimal=this._useDecimal;this.yScaleDecimal=this._useDecimal;this.maxY=l(this,"maxY")||0;if(this.yScaleDecimal!=="yes"){k(this,"maxY","roundedUpMaxY")}this.minY=g(this,"minY")||0;if(typeof this.op.config.axisXLen==="number"){this.axisXLen=this.op.config.axisXLen}else{if(typeof this.gcf.axisXLen==="number"){this.axisXLen=this.gcf.axisXLen}else{this.axisXLen=10;if(this.yScaleDecimal==="no"){if((this.maxY-this.minY)<this.axisXLen){this.axisXLen=parseInt((this.maxY-this.minY))}}}}this.yGapValue=(this.maxY-this.minY)/(this.axisXLen);this.unitH=this.chartHeight/(this.maxY-this.minY);if(isFinite(this.unitH)===false){this.unitH=this.chartHeight}if(this.type==="stacked%"){this.unitH=this.chartHeight/100}this.wkYScale=this.minY;this.yGap=this.chartHeight/(this.axisXLen);this.axisYLen=this.dataColLen;this.xGap=(this.chartWidth)/this.axisYLen;this.xColor=h.config.xColor||this.gcf.xColor||"rgba(180,180,180,0.3)";this.yColor=h.config.yColor||this.gcf.yColor||"rgba(180,180,180,0.3)";if(this.type==="scatter"){if(this.op.config.maxX){this.maxX=this.op.config.maxX||this.gcf.maxX}else{var n=this.util.hCopy(this.data[0]);this.maxX=n.sort(function(j,i){return i-j})[0]}k(this,"maxX","roundedUpMaxX");this.minX=this.op.config.minX||this.gcf.minX;if(typeof this.minX==="number"){this.minX=this.minX||0}else{var n=this.util.hCopy(this.data[0]);this.minX=n.sort(function(i,j){return i-j})[0]}this.axisYLen=this.op.config.axisYLen||this.gcf.axisYLen||10;this.xGap=(this.chartWidth)/this.axisYLen;this.xGapValue=parseFloat((this.maxX-this.minX)/this.axisYLen,10);this.unitW=this.chartWidth/(this.maxX-this.minX);this.wkXScale=this.minX}this.axisYs=[];this.axisXs=[];this.colorSet=h.config.colorSet||this.gcf.colorSet||["red","#FF9114","#3CB000","#00A8A2","#0036C0","#C328FF","#FF34C0","#F33","#FB4","#3E3","#0EE","#07E","#C7F","#F7E","#F66","#FD7","#3F7","#3EE","#0AE","#CAF","#FAF","#F99","#FEA","#3FF","#4FF","#0DF","#DCF","#FDF"];this.textColor=h.config.textColor||this.gcf.textColor||false;this.textColors=h.config.textColors||this.gcf.textColors||{title:"#ccc",subTitle:"#ddd",x:"#aaa",y:"#aaa",hanrei:"#ccc",unit:"#aaa",memo:"#ccc"};if(this.textColors){this.textColors.all=this.textColors.all||undefined}else{if(this.gcf.textColors){this.textColors.all=this.gcf.textColors.all||undefined}}this.hanreiMarkerStyle=h.config.hanreiMarkerStyle||this.gcf.hanreiMarkerStyle||"arc";this.lineWidth=h.config.lineWidth||this.gcf.lineWidth||2;this.lineWidthSet=this.util.setLineWidthSet(this,h);this.pieHoleRadius=h.config.pieHoleRadius||this.gcf.pieHoleRadius||40;this.pieRingWidth=this.op.config.pieRingWidth||this.gcf.pieRingWidth||40;this.barPadding=h.config.barPadding||this.gcf.barPadding||10;this.barWidth=h.config.barWidth||this.gcf.barWidth||10;this.barGap=h.config.barGap||this.gcf.barGap||1;this.unit=h.config.unit||this.gcf.unit||"";this.flipDirection=h.config.flipDirection||this.gcf.flipDirection||"x";this.xLines=h.config.xLines||this.gcf.xLines||"none"||[{color:"rgba(204,153,0,0.7)",width:"1",val:0,vColor:"rgba(204,153,0,0.7)",xOffset:2,yOffset:4,fillOver:null,fillUnder:null,keep:"no"}];this._memo=h.config.memo||this.gcf.memo||null;this._img=h.config.img||this.gcf.img||null;this.imgAlpha=h.config.imgAlpha||this.gcf.imgAlpha||1;this.useShadow=h.config.useShadow||this.gcf.useShadow||"yes";if(this.useShadow==="yes"){this.shadows=h.config.shadows||this.gcf.shadows||{hanrei:["#222",5,5,5],xline:["#444",7,7,5],line:["#222",5,5,5],bar:["#222",5,5,5],stacked:["#222",5,-5,5],stackedarea:["#222",5,5,5],bezi:["#222",5,5,5],bezi2:["#222",5,5,5],scatter:["#222",5,5,5],pie:["#444",3,3,3]};if(this.shadows){this.shadows.all=this.shadows.all||(this.gcf.shadows?this.gcf.shadows.all:undefined)||undefined}}this.ua=navigator.userAgent.toLowerCase();this.prefix=this.ua.match(/webkit/)?"-webkit":this.ua.match(/firefox/)?"-moz":this.ua.match(/opera/)?"-o":"-ms";this.pfx=[];this.util.setPfx("transform");this.util.setPfx("transform-origin");this.util.setPfx("transition");this.util.setPfx("box-sizing");this.borderWidth=h.config.borderWidth||this.gcf.borderWidth||3;this.opsLen=0;for(var f in this){this.ops[this.id][f]=this[f];this.opsLen++}this.ops[this.id].targetPos=null;if(this.useCss==="yes"){if(this.useCssSetting){this.useCssSetting(h)}}this.ondrew=m||function(){};if(this._addsFlg!==-1){this._ondrew=this._ondrew_old=function(i){i.drawing=false;if(i.useCss==="yes"){i.adjustCss("drew",i.id,i.type)}if(i.ondrew){this.ondrew(i)}}}this.draw(h);function l(i,j){if(typeof h.config[j]==="undefined"||typeof h.config[j]===null||typeof h.config[j]==="none"){if(i.type==="stacked"||i.type==="stackedarea"||i.type==="stacked%"){return i.util.getMaxSum(i)}else{return i.util.getMax(i)}}else{return parseFloat(h.config[j])}}function k(o,i,j){if(o.yScalePercent==="no"){var p=Math.pow(10,(""+o[i]).split(".")[0].length-2);o[j]=(h.config[j]!==undefined)?h.config[j]:p;if(o[j]!==0){o[i]=Math.ceil(o[i]/o[j])*o[j]}else{o[i]=o[i]}}}function g(i,j){if(i.type==="line"||i.type==="bar"||i.type==="candle"||i.type==="bezi2"||i.type==="bezi"||i.type==="area"||i.type==="scatter"||i.type==="ampli"){if(typeof h.config[j]==="undefined"){return i.util.getMin(i)}else{return parseFloat(h.config[j])||0}}}},get:function(d,h,e){var g=this;var e=(e===false)?false:true;var f=new XMLHttpRequest();f.open("GET",d,e);f.setRequestHeader("Content-type","application/x-www-form-urlencoded");f.setRequestHeader("Pragma","no-cache");f.setRequestHeader("Cache-Control","no-cache");f.onreadystatechange=function(i){if(f.readyState==4&&f.status==200){if(f.responseText===""){return f}var j=decodeURIComponent(f.responseText);if(h){h(j)}}};f.send();return f},bind:function(h,j){var g=this;var i=this.canvas;if(h==="click"||h==="touchstart"){var e=this.util.isMobile();h=(e)?"touchstart":"click"}if(typeof this.ids!=="object"){i=a}if(j!=="_adjustcsspos"){if(typeof j==="function"){i.removeEventListener(h,function(k){j.call(g,k,g.canvas)});if(h==="load"){j.call(g,a.event,g.canvas)}else{i.addEventListener(h,function(k){j.call(g,k,g.canvas)})}if(this.useCss==="yes"&&this.hybridBox){this.hybridBox.addEventListener(h,function(k){j.call(g,k,g.canvas)})}}}if(this.useCss!=="yes"){return this}else{if(h==="load"){d(this,a,"load")}if(h==="resize"){d(this,a,"resize")}if(h==="scroll"){d(this,document,"scroll")}}function f(){g.adjustCss(h)}function d(l,m,k){if(l["_added_css_"+k+"Event"]!=="on"){m.addEventListener(k,f);l["_added_css_"+k+"Event"]="on"}}return this},$:function(d){if(typeof d==="function"){this.bind("load",d)}},draw:function(d){this.drawing=true;if(this._addsFlg===0||this._addsFlg===1){this.canvas.width=this.width;this.canvas.height=this.height;this.ctx.scale(1,1);this.ctx.translate(0,0);this.ctx=this.util.setDefaultCtxProps(this,"font","100 12px 'Arial'");if(this.bgGradient){this.drawGradient()}else{if(typeof this.bg==="string"){this.drawBG()}}if(this.type!=="pie"){if(this._addsFlg===0){this.drawAxisX();this.drawAxisY()}else{if(this._addsFlg===1){this.drawAxisX()}}}else{if(this._addsFlg===1){this.drawAxisX();this.drawAxisY()}}if(this.onlyChart==="no"||this.onlyChartWidthTitle==="yes"){this.drawTitle()}if(this.onlyChart==="no"){this.drawSubTitle()}}else{if(this._addsFlg===2){this.drawAxisX();this.drawAxisY()}}if(this.onlyChart==="no"&&this.useHanrei!=="no"){this.drowHanrei()}if(typeof this._img==="object"){this.drawImg(this._img)}if(typeof this._memo==="object"){this.drawMemo()}if(this.unit!==""){this.drawUnit(this)}if(d){this.swtGraph()}if(this.useMarker!=="none"&&this.type!=="scatter"){this.drawMarkers()}if(this.xLines!=="none"){this.drawXLine()}},swtGraph:function(){switch(this.type){case ("line"):this.drawLine();break;case ("bar"):this.drawBar();break;case ("pie"):this.drawPie();break;case ("bezi"):this.drawbeziLine();break;case ("bezi2"):this.drawbeziLine2();break;case ("stacked"):this.drawStackedBar();break;case ("area"):this.drawArea();break;case ("stackedarea"):this.drawStackedArea();break;case ("stacked%"):this.drawStackedPercent();break;case ("ampli"):this.drawAmplitude();break;case ("scatter"):this.drawScatter();break;case ("candle"):this.drawCandle();break;default:this.drawBar();break}},drawBG:function(d){if(typeof d==="string"){this.bg=this.op.config.bg=d}if(this.canvas.style){this.canvas.style.setProperty("background-color",(this.bg),"")}return this},drawGradient:function(){var f=this.bgGradient;var g=(f.direction==="vertical")?this.height:0;var d=(f.direction==="horizontal")?this.width:0;var e=this.ctx.createLinearGradient(0,0,d,g);e.addColorStop(0,f.from);e.addColorStop(1,f.to);this.ctx.fillStyle=e;this.ctx.fillRect(0,0,this.width,this.height);return this},drawAxisX:function(){var f=this;this.axisXWidth=this.util.setNumberOfConfigVal(this,"axisXWidth",1);var e=this.axisXWidth;if(this.type==="line"||this.type==="bezi2"||this.type==="bezi"){if(this.yScaleOrder==="ASC"){for(var h=this.chartTop,d=0;h<=this.chartBottom;h+=this.yGap,d++){g(h,d)}}else{for(var h=this.chartBottom,d=0;h>=this.chartTop;h-=this.yGap,d++){g(h,d)}}}else{for(var h=this.chartBottom,d=0;h>=this.chartTop;h-=this.yGap,d++){g(h,d)}}function g(j,i){f.axisXs.push({top:j});if(f.wkYScale===0){f.axisXWidth=e+2}else{f.axisXWidth=e}if(f._addsFlg<2&&f.axisXWidth>0){f.ctx.beginPath();f.ctx.lineWidth=f.axisXWidth;f.ctx.strokeStyle=f.xColor;f.ctx.moveTo(f.chartLeft,j);f.ctx.lineTo(f.chartRight,j);f.ctx.stroke()}if(f.type!=="pie"){if(f.onlyChart==="no"){f.drawYscale(j,i)}}}return this},drawAxisY:function(){this.axisYWidth=this.util.setNumberOfConfigVal(this,"axisYWidth",1);this.xScaleSkip=this.util.setNumberOfConfigVal(this,"xScaleSkip",0);this.axisYSkipWidth=this.util.setNumberOfConfigVal(this,"axisYSkipWidth",3);var d=this.axisYWidth;for(var f=this.chartLeft,e=0;f<=this.chartRight;f+=this.xGap,e++){this.axisYs.push({left:f,yTitle:this.op.data[0][e]});if(this.xScaleSkip>0){if(e%this.xScaleSkip===0){d=this.axisYSkipWidth}else{d=this.axisYWidth}}if(d>0){this.ctx.beginPath();this.ctx.lineWidth=d;this.ctx.strokeStyle=this.yColor;this.ctx.moveTo(f,this.chartTop);this.ctx.lineTo(f,this.chartBottom);this.ctx.stroke()}if(this.type!=="pie"){if(this.useFirstToColName&&this.onlyChart==="no"){if(this.xScaleSkip!==0){if(e%this.xScaleSkip===0){this.drawXscale(f,e)}}else{this.drawXscale(f,e)}}}}return this},drawXscale:function(h,k){if(this.type!=="scatter"){if(!this.colNames[k]){return this}}this.ctx.save();var i=this.xScaleDecimal;var r=this.op.config.xScaleColor||this.gcf.xScaleColor||this.textColor||this.gcf.textColor||this.textColors.all||(this.gcf.textColors?this.gcf.textColors.all:(this.textColors.x||this.gcf.x))||"#aaa";var e=this.op.config.xScaleFont||this.gcf.xScaleFont;var f=this.op.config.xScaleAlign||this.gcf.xScaleAlign||"center";var n=this.op.config.xScaleXOffset||this.gcf.xScaleXOffset||0;var j=this.op.config.xScaleYOffset||this.gcf.xScaleYOffset||22;var m=this.op.config.colNamesTitleOffset||this.gcf.colNamesTitleOffset||22;if(this.type==="scatter"){m+=this.xGap/2}var d=this.op.config.xScaleRotate||this.gcf.xScaleRotate||0;if(this.type==="scatter"){var g="",l="";if(h>=this.chartRight){this.wkXScale=this.maxX}g=this.util.addComma(this,this.wkXScale,i);l=(this.xScalePercent==="yes")?(" ("+k*10+"%)"):"";this.wkXScaleStr=g+l}var q=(this.type==="scatter")?0:this.xGap/2-n;if(e){this.ctx.font=e}if(this.type!=="pie"){var g=(this.type==="scatter")?this.wkXScaleStr:this.colNames[k];this.ctx.save();this.ctx.textAlign=f;this.ctx.fillStyle=r;this.ctx.translate(h+q,this.chartBottom+j);this.ctx.rotate(d*2*Math.PI/360);this.ctx.fillText(g,0,0);this.ctx.restore()}if(k===0){var s=(this.colNamesTitle==="")?"":"("+this.colNamesTitle+")";var p=this.chartRight+m;var o=this.chartBottom+j;this.ctx.fillStyle=r;this.ctx.fillText(s,p,o)}else{this.drawMemo({val:"text",left:this.chartLeft+(this.chartRight-this.chartLeft)/2,top:o+15,align:"center",color:r,font:e})}if(this.type==="scatter"){this.wkXScale=parseFloat(this.wkXScale);this.wkXScale+=this.xGapValue}this.ctx.restore();return this},drawYscale:function(m,h){this.ctx.save();var n=this.yScaleDecimal;var g=this.op.config.yScaleColor||this.gcf.yScaleColor||this.textColor||this.textColors.all||this.textColors.y||"#aaa";var e=this.op.config.yScaleFont||this.gcf.yScaleFont;var p=this.op.config.yScaleAlign||this.gcf.yScaleAlign||"right";var j=this.op.config.yScaleXOffset||this.gcf.yScaleXOffset||this.paddingLeft-10;var f=this.op.config.yScaleYOffset||this.gcf.yScaleYOffset||6;var r=this.op.config.yScaleRotate||this.gcf.yScaleRotate||0;j=(this._addsFlg===2)?(this.chartRight+10):j;p=(this._addsFlg===2)?"left":p;var k=m<=this.chartTop;if(this.type==="line"||this.type==="bezi2"||this.type==="bezi"){if(this.yScaleOrder==="ASC"){k=m>=this.chartBottom}}var d="",i="";if(this.type==="stacked%"){d=Math.round(h*100/this.axisXLen)+"%"}else{if(k){this.wkYScale=this.maxY}d=this.util.addComma(this,this.wkYScale,n);i=(this.yScalePercent==="yes")?(" ("+Math.round(h*100/this.axisXLen)+"%)"):""}this.wkYScaleStr=d+i;this.ctx.save();if(e){this.ctx.font=e}this.ctx.fillStyle=g;this.ctx.textAlign=p;this.ctx.translate(j,m+f);this.ctx.rotate(r*2*Math.PI/360);this.ctx.fillText(this.wkYScaleStr,0,0);this.ctx.restore();this.wkYScale=parseFloat(this.wkYScale);this.wkYScale+=this.yGapValue;if(h===0){if(this.type==="scatter"){var q=(this.rowNamesTitle==="")?"":"("+this.rowNamesTitle+")";var o=this.chartLeft+-10;var l=this.chartTop+(this.chartHeight/2);if(e){this.ctx.font=e}this.ctx.fillStyle=g;this.ctx.textAlign=p;this.ctx.textAlign="center";this.ctx.translate(24,this.chartTop+(this.chartHeight/2));this.ctx.rotate(45*2*Math.PI/12);this.ctx.fillText(q,0,0)}}this.ctx.restore();return this},drawTitle:function(){if(this.title===""){return this}this.ctx.save();var j=this.title||this.gcf.title||"";var h=this.op.config.titleFont||this.gcf.titleFont||"100 28px 'Arial'";var f=this.op.config.titleTextAlign||this.gcf.titleTextAlign||"center";var i=this.op.config.titleColor||this.gcf.titleColor||this.textColor||this.textColors.all||this.textColors.title||"#ccc";var d=this.util.setNumberOfConfigVal(this,"titleX",this.width/2);var g=this.util.ajustTitlesX(this,f,d);var e=this.util.setNumberOfConfigVal(this,"titleY",38);this.ctx.font=h;this.ctx.textAlign=f;this.ctx.fillStyle=i;this.ctx.fillText(j,g,e);this.ctx.restore();return this},drawSubTitle:function(){if(this.subtitle===""){return this}this.ctx.save();var j=this.subtitle||"";var g=this.op.config.subTitleFont||this.gcf.subTitleFont;var i=this.op.config.subTitleTextAlign||this.gcf.subTitleTextAlign||"center";var f=this.op.config.subTitleColor||this.gcf.subTitleColor||this.textColor||this.textColors.all||this.textColors.subTitle||"#ddd";var e=this.util.setNumberOfConfigVal(this,"subTitleX",this.width/2);var h=this.util.ajustTitlesX(this,i,e);var d=this.util.setNumberOfConfigVal(this,"subTitleY",55);if(this.title===""){d=25}if(g){this.ctx.font=g}this.ctx.textAlign=i;this.ctx.fillStyle=f;this.ctx.fillText(j,h,d);this.ctx.restore();return this},drowHanrei:function(){this.ctx.save();var z=this.hanreiNames.length;var B=this.op.config.hanreiXOffset||this.gcf.hanreiXOffset||14;var k=this.op.config.hanreiYOffset||this.gcf.hanreiYOffset||20;var l=this.op.config.hanreisYSpace||this.gcf.hanreisYSpace||12;if(!this._baseY){this._baseY=0}var h=this.op.config.hanreiRadius||this.gcf.hanreiRadius||((z<10)?8:(z<20)?5:3);var m=0;if(this.type==="line"||this.type==="bezi"||this.type==="bezi2"){m=h/5;h=h-m}var f=this.op.config.hanreiLineHeight||this.gcf.hanreiLineHeight||((z<10)?20:(z<20)?14:8);var A=(z<10)?12:(z<20)?9:6;var r=this.op.config.hanreiFont||this.gcf.hanreiFont||"100 "+A+"px 'Arial'";var u=this.op.config.hanreiColor||this.gcf.hanreiColor||this.textColor||this.textColors.all||this.textColors.hanrei||"#ccc";var v=this.op.config.hanreiAlign||this.gcf.hanreiAlign||"left";var g=(this.shadows)?this.shadows.hanrei||this.shadows.all||["#222",5,5,5]:"";if(this._addsFlg>0){if(v==="left"){B=B+42}else{B=B}}var o=0;if(this._addsFlg===2){o=this._baseY+l}for(var w=0;w<this.hanreiNames.length;w++){var t=(f*w)+k+o;this.ctx.beginPath();if(this.useShadow==="yes"){this.drawShadow(g[0],g[1],g[2],g[3])}this.ctx.fillStyle=this.colorSet[w];this.ctx.strokeStyle=this.colorSet[w];var p,n=this.chartBottom-t;var e=this.ctx.font.split("px")[0]||12;var s=this.hanreiNames[w];var d=(s)?((this.hanreiNames[w].length||0)*e):0;if(v==="left"){p=this.chartRight+B}if(v==="right"){p=this.chartRight+this.paddingRight-B}if(v==="center"){p=this.chartRight+(this.paddingRight/2-d/2)}if(this.hanreiMarkerStyle==="arc"){q(this,p,n)}else{j(this,p,n)}this.ctx.font=r;this.ctx.textAlign=v||"left";this.ctx.fillStyle=u;this.ctx.fillText(this.hanreiNames[w],(v==="left")?(p+h*2):(v==="right")?(p-(h*2)):(v==="center")?(p+(d/2)+(h*2)):(p+(d/2)+(h*2)),this.chartBottom-t);if(this._addsFlg>=1){this._baseY=t}this.ctx.closePath()}this.ctx.restore();function q(C,i,D){var i=i;var D=D-4;C.ctx.arc(i,D,h,0,Math.PI*2);C.ctx.arc(i,D,h,0,Math.PI*2);C.ctx.fill();if(C.type==="line"||C.type==="bezi"||C.type==="bezi2"){C.ctx.beginPath();C.ctx.lineWidth=3;C.ctx.moveTo(i-m*2-6,D);C.ctx.lineTo(i+h*2-m*2,D);C.ctx.stroke()}}function j(C,i,D){var i=i-h;var D=D-3-h;C.ctx.fillRect(i,D,h*2,h*2);C.ctx.fill();if(C.type==="line"||C.type==="bezi"||C.type==="bezi2"){C.ctx.lineWidth=3;C.ctx.moveTo(i-m*2,D+h);C.ctx.lineTo(i+h*2+m*2,D+h);C.ctx.stroke()}}return this},drawUnit:function(f){if(this.type==="scatter"){return}var j=navigator.language==="ja"?"単位:":"";var h=this.chartLeft-(this.op.config.unitXOffset||this.gcf.unitXOffset||50);var g=this.chartTop-(this.op.config.unitYOffset||this.gcf.unitYOffset||12);var e=this.op.config.unitColor||this.gcf.unitColor||this.textColor||this.textColors.all||this.textColors.unit||"#aaa";var d=this.op.config.unitFont||this.gcf.unitFont||"100 12px 'Arial'";var i=this.op.config.unitAlign||this.gcf.unitAlign||"right";h=(this._addsFlg===2)?(this.chartRight+10):h;i=(this._addsFlg===2)?"left":i;if(typeof f==="string"){this.unit=this.unit;this.drawMemo({val:"("+j+this.unit+")",left:h,top:g,align:i,color:e,font:d})}else{if(typeof f==="object"){this.unit=f.unit;this.drawMemo({val:"("+j+f.unit+")",left:f.left||h,top:f.top||g,align:f.align||"left",color:f.color||e,font:f.font||d})}}return this},_drawVals:function(j){var i=j.that;var g=j.row;var f=j.col;if(i.useVal==="no"){return i}i.ctx.save();i.valColor=i.op.config.valColor||i.gcf.valColor;var n=i.valXOffset=i.op.config.valXOffset||j.xoff||i.gcf.valXOffset||10;var e=i.valYOffset=i.op.config.valYOffset||j.yoff||i.gcf.valYOffset||-20;var d=i.valFont=i.op.config.valFont||j.font||i.gcf.valFont;if(typeof i.useVal==="object"){if(i.useVal[g]==="no"){return i}}if(typeof i.valXOffset==="object"){n=i.valXOffset[g]||0}if(typeof i.valYOffset==="object"){e=i.valYOffset[g]||0}if(typeof i.valFont==="object"){d=i.valFont[g]||j.font}var h=(typeof i.valColor==="string")?i.valColor:(typeof i.valColor==="object"&&i.valColor.length>0)?i.valColor[g]:j.color;val=j.val;var m=this.util.mkPercentVal(i,val,g,f);val=(i.percentVal==="yes")?m:val;if(d){i.ctx.font=d}i.ctx.fillStyle=h;i.ctx.textAlign=j.align||"right";val=val||0;j.x=j.x||0;j.y=j.y||0;i.ctx.fillText(val,j.x+n,j.y+e);i.ctx.restore();return i},drawMarkers:function(m){if(this.type==="stacked"){return}if(this.type==="pie"){return}if(this.type==="bezi2"){return}if(this.type==="bezi"){return}if(this.type==="ampli"){return}var j=this;this.ctx.save();if(!m){var m=this.op||{}}var w=m.markerWidth||this.markerWidth;var h=m.colorSet||this.colorSet;var f=(this.type==="scatter")?0:this.xGap/2;var e=0;if(this.type==="stackedarea"){var z=this.stackedData}else{if(this.type==="stacked%"){var z=this.stackedPData}else{var z=this.data}}if(this.useCss==="yes"&&this.hybridBox){var g=document.querySelector("#-ccchart-css-group-"+this.id);g.innerHTML=""}if(this.type==="scatter"){for(var t=0;t<this.dataColLen;t++){e=this.hanreiNames.indexOf(this.colNames[t]);if(e<0){e=0}var r=(z[0])?((z[0][t]||0)*this.unitW):0;var p=r+this.chartLeft-this.minX*this.unitW;var q=(z[1])?((z[1][t]||0)*this.unitH):0;var n=(this.chartBottom-(q-this.minY*this.unitH));s(p||0,n||0,0,t,z,h,e)}}else{if(this.type==="stacked"){var p=this.barPadding+this.chartLeft+this.barWidth/2;for(var v=0;v<this.dataColLen;v++){var u=0;for(var t=0;t<this.dataRowLen;t++){var n=(this.chartBottom-((this.data[t][v]||0)+u)*this.unitH)+this.barWidth/2;u=this.data[t][v];s(p,n,v,t,z,this.colorSet[v],e)}p+=this.xGap}}else{if(this.type==="bar"){var p=this.barPadding+this.chartLeft+this.barWidth/2;var o=p;var i=0;for(var v=0;v<this.dataRowLen;v++){for(var t=0;t<this.data[v].length;t++){var d=((this.data[v][t]>0)?this.barWidth/2:-this.barWidth/2);d=((this.data[v][t]==0)?-this.markerWidth/4:d);var n=(this.chartBottom-(this.data[v][t]-this.minY)*this.unitH)+d;s(p,n,v,t,z,this.colorSet[v],e);p+=this.xGap}i+=this.barWidth+this.barGap;p=o+i}}else{if(this.type==="stacked%"||this.type==="stackedarea"){for(var v=0;v<this.dataRowLen;v++){var p=this.chartLeft;p+=f;for(var t=0;t<z[v].length;t++){e=v;var q=z[v][t]*this.unitH;var n=this.chartBottom-(q-this.minY*this.unitH);s(p,n,v,t,z,h,e);p+=this.xGap}}}else{for(var v=0;v<this.dataRowLen;v++){var p=this.chartLeft;p+=f;for(var t=0;t<z[v].length;t++){e=v;var n=(this.chartBottom-(this.data[v][t]-this.minY)*this.unitH);if(this.type==="line"||this.type==="bezi2"||this.type==="bezi"){if(this.yScaleOrder==="ASC"){var n=this.chartTop+(this.data[v][t]-this.minY)*this.unitH}}s(p,n,v,t,z,h,e);p+=this.xGap}}}}}}this.ctx.restore();function s(D,C,H,l,A,I,E){var k=A[H][l];if(k===""||k===undefined||isNaN(k)){return}j.ctx.beginPath();j.ctx.fillStyle=I[E];var G=(j.type==="scatter")?((A[0])?(A[0][l]):""):"";var F=(j.type==="scatter")?((A[1])?(A[1][l]):""):"";if(j.useCss==="yes"&&(j.useMarker==="css-ring"||j.useMarker==="css-maru")){var B={x:D,y:C,radius:w/2,row:H,col:l,data:k,percent:j.util.mkPercentVal(j,k,H,l),scatterX:G,scatterY:F,colorSet:I,colorIndex:E};if(j.useMarker==="css-ring"){j.css_ring(B)}else{if(j.useMarker==="css-maru"){j.css_maru(B)}}}else{j.ctx.arc(D,C,w/2,0,Math.PI*2)}j.ctx.closePath();j.ctx.fill()}return this},drawXLine:function(){var k=this.xLines;this.ctx.save();for(var j=0;j<k.length;j++){var f=k[j].font||"100 18px 'Arial'";var u=k[j].val||0;if(this.type==="line"){if(k[j].useRow!==undefined){var o=k[j].useRow||((k[j].useRow===0)?0:this.dataRowLen-1);if(o>this.dataRowLen-1||o<=0){o=0}u=(this.data[o][this.data[0].length-1])}}u=u||0;var t=k[j].color||"rgba(204,153,0,0.7)";var l=k[j].vColor||t;var m=k[j].width||1;var h=k[j].fillOver||null;var n=k[j].fillUnder||null;var q=this.chartRight-(k[j].xOffset||2);var g=-(k[j].yOffset||4);var e=this.unitH*u;var r=(this.shadows)?this.shadows.xline||this.shadows.all||["#444",7,7,5]:"";var d=k[j].keep||"no";var p=this.getWsById(this.id);if(p){if(d==="high"){if(p.op_xLines_keep===undefined){p.op_xLines_keep=u}else{if(p.op_xLines_keep<u){p.op_xLines_keep=u}}}else{if(d==="low"){if(p.op_xLines_keep===undefined){p.op_xLines_keep=u}else{if(p.op_xLines_keep>u){p.op_xLines_keep=u}}}else{p.op_xLines_keep=undefined}}if(p.op_xLines_keep!==undefined){u=p.op_xLines_keep;e=this.unitH*u}}var s=(this.chartBottom-(e-this.minY*this.unitH))||0;this.ctx.beginPath();if(typeof h==="string"){this.ctx.fillStyle=h;this.ctx.fillRect(this.chartLeft,this.chartTop,this.width-this.chartLeft-this.paddingRight,s-this.paddingTop)}if(typeof n==="string"){this.ctx.fillStyle=n;this.ctx.fillRect(this.chartLeft,s,this.width-this.chartLeft-this.paddingRight,this.height-s-this.paddingBottom)}this.ctx.lineWidth=m;this.ctx.strokeStyle=t;if(this.useShadow==="yes"){this.drawShadow(r[0],r[1],r[2],r[3])}this.ctx.moveTo(this.chartLeft,s);this.ctx.lineTo(this.chartRight,s);this.ctx.stroke();this.xLineStr=u;this.ctx.textAlign="right";this.ctx.font=f;this.ctx.fillStyle=l;this.ctx.fillText(this.xLineStr,q,s+g)}this.ctx.restore();return this},_drawLine:function(g,d){this.ctx.save();if(!g){var g=this.op||{}}this.lineWidth=g.lineWidth||this.lineWidth;var h=this.util.setLineWidthSet(this,g);var n=g.colorSet||this.colorSet;var i=(this.shadows)?this.shadows.line||this.shadows.all||["#222",5,5,5]:"";for(var f=0;f<this.dataRowLen;f++){var m=this.chartLeft;m+=this.xGap/2;this.ctx.beginPath();this.ctx.lineJoin="round";this.ctx.lineWidth=this.lineWidthSet[f];this.ctx.strokeStyle=n[f];this.ctx.fillStyle=this.colorSet[f];if(this.useShadow==="yes"){if(this.lineWidthSet[f]>1){this.drawShadow(i[0],i[1],i[2],i[3])}}if(this.type==="area"){this.ctx.moveTo(m,this.chartBottom)}for(var e=0;e<this.data[f].length;e++){var j=this.chartBottom-(this.data[f][e]-this.minY)*this.unitH;if(this.type==="line"||this.type==="bezi2"||this.type==="bezi"){if(this.yScaleOrder==="ASC"){j=this.chartTop+(this.data[f][e]-this.minY)*this.unitH}}if(this.type==="area"){this.ctx.lineTo(m,j)}else{if(e===0){this.ctx.moveTo(m,j)}else{this.ctx.lineTo(m,j)}}this._drawVals({that:this,val:(this.data[f][e]||0),row:f,col:e,align:"left",xoff:-25,yoff:1,x:m,y:j});m+=this.xGap}if(this.type==="area"){this.ctx.lineTo(m-this.xGap,this.chartBottom)}if(d){d(this)}else{this.ctx.stroke()}}this.ctx.restore();this._ondrew(this);return this},drawLine:function(d){this._drawLine(d,function(e){e.ctx.stroke()});return this},drawAmplitude:function(d){this._drawLine(d,function(e){e.ctx.fill()});return this},drawArea:function(d){this._drawLine(d,function(e){e.ctx.fill()});return this},_drawStackedArea:function(h,d){this.ctx.save();if(!h){var h=this.op||{}}this.lineWidth=h.lineWidth||this.lineWidth;var i=this.util.setLineWidthSet(this,h);var q=h.colorSet||this.colorSet;var m=(this.shadows)?this.shadows.stackedarea||this.shadows.all||["#222",5,5,5]:"";var p=[];var g=[];for(var f=0;f<this.dataRowLen;f++){p[f]=[];for(var e=0;e<this.data[f].length;e++){p[f][e]=((this.data[f][e]||0)+(p[f-1]?p[f-1][e]:0));g[e]=p[f][e]}}this.stackedData=p;this.stackedPData=[];for(var f=p.length-1;f>=0;f--){var o=this.chartLeft;o+=this.xGap/2;this.ctx.beginPath();this.ctx.lineWidth=i[f];this.ctx.strokeStyle=q[f];this.ctx.fillStyle=q[f];if(this.useShadow==="yes"){if(i[f]>1){this.drawShadow(m[0],m[1],m[2],m[3])}}this.ctx.moveTo(o,this.chartBottom);this.stackedPData[f]=[];for(var e=0;e<p[f].length;e++){var j=p[f][e]*this.unitH;if(this.type==="stacked%"){this.stackedPData[f][e]=p[f][e]*100/g[e];j=this.stackedPData[f][e]*this.unitH}var n=this.chartBottom-(j);this.ctx.lineTo(o,n);this._drawVals({that:this,val:(this.data[f][e]||0),percent:Math.round((this.data[f][e]||0)*100/g[e],10),row:f,col:e,align:"left",xoff:-10,yoff:-10,x:o,y:n});o+=this.xGap}this.ctx.lineTo(o-this.xGap,this.chartBottom);this.ctx.fill()}this.ctx.restore();this._ondrew(this);return this},drawStackedArea:function(d){this._drawStackedArea(d,function(e){});return this},drawStackedPercent:function(d){this._drawStackedArea(d,function(e){});return this},drawBar:function(){var g=this;var e=(this.shadows)?this.shadows.bar||this.shadows.all||["#222",5,5,5]:"";g.widthOfAllBar=f();if(this.widthOfAllBar>this.xGap){this.barPadding=0;this.barGap=1;this.barWidth=this.xGap/g.dataRowLen-1;d()}else{d()}this._ondrew(this);function f(){return g.barPadding+g.barWidth*g.dataRowLen+g.barGap*(g.dataRowLen-1)}function d(){h(function(o,m,j,i,p,n){o.ctx.fillRect(i,p,o.barWidth,(o.data[m][j]-o.minY)*o.unitH)});h(function(o,m,j,i,q,n){if(n<0){var p=15}else{var p=-15}o._drawVals({that:o,val:o.data[m][j],row:m,col:j,align:"left",xoff:2,yoff:p,x:i,y:q})});function h(o){g.ctx.save();for(var m=0;m<g.dataRowLen;m++){var i=g.barPadding+g.chartLeft;g.ctx.beginPath();g.ctx.fillStyle=g.colorSet[m];if(g.useShadow==="yes"){g.drawShadow(e[0],e[1],e[2],e[3])}for(var j=0;j<g.data[m].length;j++){var p=g.chartBottom-(g.data[m][j]-g.minY)*g.unitH;var n=g.data[m][j];o(g,m,j,i,p,n);i+=g.xGap}g.ctx.translate(g.barWidth+g.barGap,0)}g.ctx.restore();return this}}},drawStackedBar:function(){this.ctx.save();var h=this;var d=h.barPadding+h.chartLeft;var f=(this.shadows)?this.shadows.stacked||this.shadows.all||["#222",5,-5,5]:"";for(var g=0;g<h.dataColLen;g++){var i=0;for(var e=0;e<h.dataRowLen;e++){var j=(h.chartBottom-(h.data[e][g]||0)*h.unitH);h.ctx.beginPath();h.ctx.fillStyle=h.colorSet[e];if(h.useShadow==="yes"){h.drawShadow(f[0],f[1],f[2],f[3])}h.ctx.fillRect(d,j,h.barWidth,h.chartBottom-j);h._drawVals({that:h,color:"#eee",val:(h.data[e][g]||0),row:g,col:e,align:"left",xoff:2,yoff:-20,x:d,y:h.chartBottom+15});h.ctx.translate(0,-(h.chartBottom-j));i+=h.chartBottom-j}h.ctx.translate(0,i);d+=h.xGap}h.ctx.restore();this._ondrew(this);return this},drawCandle:function(){var e=this;var g;var n;var w;var h;var m;var d;var f=this.op.config.candleLineWidth||this.gcf.candleLineWidth||1;var q=this.op.config.candleBoxWidth||this.gcf.candleBoxWidth||10;if(q>this.xGap){q=this.xGap-1}var j=this.op.config.candleColorLine||this.gcf.candleColorLine||"#888";var p=this.op.config.candleColorUp||this.gcf.candleColorUp||"deeppink";var l=this.op.config.candleColorDown||this.gcf.candleColorDown||"#888";var s=e.chartLeft+(this.xGap/2);var x=e.chartLeft+(this.xGap/2)-(q/2);this.ctx.save();for(var o=0;o<=e.dataColLen;o++){var i=e.data;g=parseInt(i[0][o],10);n=parseInt(i[1][o],10);w=parseInt(i[2][o],10);h=parseInt(i[3][o],10);d=h-g;if(d>0){color=p;m=h}else{if(d===0){d=1;color=j;m=h}else{color=l;m=g}}var v=e.chartBottom-(n-e.minY)*e.unitH;var r=e.chartBottom-(w-e.minY)*e.unitH;this.ctx.beginPath();this.ctx.lineWidth=f;this.ctx.strokeStyle=j;this.ctx.moveTo(s,v);this.ctx.lineTo(s,r);this.ctx.stroke();var u=e.chartBottom-(m-e.minY||0)*this.unitH;var t=Math.abs(d)*this.unitH;this.ctx.beginPath();this.ctx.fillStyle=color;this.ctx.fillRect(x,u,q,t);s+=this.xGap;x+=this.xGap}this.ctx.restore();this._ondrew(this);return this},drawbeziLine:function(){this.ctx.save();this.lineWidth=this.lineWidth||this.lineWidth;var j=this.util.setLineWidthSet(this,this.op);var i=0,g=0;var f=(this.shadows)?this.shadows.bezi||this.shadows.all||["#222",5,5,5]:"";for(var h=0;h<this.dataRowLen;h++){var d=this.chartLeft;d+=this.xGap/2;this.ctx.beginPath();this.ctx.lineWidth=j[h];this.ctx.strokeStyle=this.colorSet[h];if(this.useShadow==="yes"){this.drawShadow(f[0],f[1],f[2],f[3])}for(var e=0;e<this.data[h].length;e++){var m=this.chartBottom-(this.data[h][e]-this.minY)*this.unitH;if(e==0){this.ctx.moveTo(d,m)}else{this.ctx.quadraticCurveTo(i,g,d,m)}d+=this.xGap;i=d,g=m}this.ctx.stroke()}this.ctx.restore();this._ondrew(this);return this},drawbeziLine2:function(){var f=(this.shadows)?this.shadows.bezi2||this.shadows.all||["#222",5,5,5]:"";this.lineWidth=this.op.lineWidth||this.lineWidth;var j=this.util.setLineWidthSet(this,this.op);this.ctx.save();for(var g=0;g<this.dataRowLen;g++){var d=this.chartLeft;d+=this.xGap/2;this.ctx.beginPath();this.ctx.lineWidth=this.lineWidthSet[g];this.ctx.strokeStyle=this.colorSet[g];if(this.useShadow==="yes"){this.drawShadow(f[0],f[1],f[2],f[3])}for(var e=0;e<this.data[g].length;e++){var m=this.chartBottom-(this.data[g][e]-this.minY)*this.unitH;var i=d+(this.xGap)/2;var h=this.chartBottom-(((this.data[g][e+1]+this.data[g][e])/2)*this.unitH-this.minY*this.unitH);if(e==0){this.ctx.moveTo(d,m)}else{if(e==this.data[g].length-1){this.ctx.quadraticCurveTo(d,m,d,m)}else{this.ctx.quadraticCurveTo(d,m,i,h)}}d+=this.xGap}this.ctx.stroke()}this.ctx.restore();this._ondrew(this);return this},drawScatter:function(){this.ctx.save();this.drawMarkers();this.ctx.restore();this._ondrew(this);return this},drawPie:function(){this.ctx.save();var r=this;var m=(this.shadows)?this.shadows.pie||this.shadows.all||["#444",3,3,3]:"";var H=(this.op.config.pieDataIndex!=undefined)?this.op.config.pieDataIndex:(this.gcf.pieDataIndex?this.gcf.pieDataIndex:(this.dataColLen-1));if(H<0||H>(this.dataColLen-1)){H=(this.dataColLen-1)}var B=this.op.config.colNameFont||this.op.font||this.gcf.colNameFont||"100 18px 'Arial'";var K=this.util.getFontSizeFromStyle(B);var i=this.valFont=this.op.config.valFont||this.op.font||this.gcf.valFont||"100 12px 'Arial'";var z=this.util.getFontSizeFromStyle((this.op.config.subTitleFont||this.gcf.subTitleFont||"100 12px 'Arial'"));var N=this.op.config.pieXOffset||this.gcf.pieXOffset||0;var s=this.op.config.pieYOffset||this.gcf.pieYOffset||0;var h=this.op.config.pieValPosOffset||this.gcf.pieValPosOffset||8;var t=this.chartWidth/2;var F=(this.chartHeight-z)/2;var J=20;var p=50;var f=this.pieHoleRadius;if((f>=t)||(f>=F)){d=J}f=Math.min(((f>=t)?(t-J):f),((f>=F)?(F-J):f));var d=this.pieRingWidth;var n=g(f,d);d=Math.min(((n>=t)?(t-f):d),((n>=F)?(F-f):d));n=g(f,d);var L=Math.min(this.chartHeight,this.chartWidth);var v=this.chartTop+this.chartHeight/2+s;var w=this.width/2+N;var I=[];var e=[];var o=[];var q=0,M=0;var A=2*Math.PI/360;var j=H;this.drawXscale(this.chartLeft,0);for(var E=H;E<=j;E++){I[E]=e[E]=[];deg=0;for(var C=0;C<this.dataRowLen;C++){I[E].push(this.data[C][E]||0)}e[E]=this.util.aryToDeg(I[E]);o[E]=this.util.aryToPercent(I[E]);for(var D=0;D<e[E].length;D++){q+=e[E][D];var O=I[E][D];G(w,v,n,M*A,q*A,this.colorSet[D],E,D,O);M=q}}this.ctx.restore();this._ondrew(this);function g(l,k){return l+k/2}function u(k,l){return k*2-l}function G(Z,Y,P,R,aa,T,U,S,Q){r.ctx.save();r.ctx.beginPath();r.ctx.strokeStyle=r.colorSet[S];r.ctx.lineWidth=d;var X=R+(aa-R)/2;var ac=Z+(n+d/2+h)*Math.cos(X);var ab=Y+(n+d/2+h)*Math.sin(X);var Q=parseInt(Q);if(r.wsuids.length===0){Q=Q+" ("+parseInt(o[U][S])+"%)"}r._drawVals({that:r,color:r.ctx.strokeStyle,val:Q,row:U,col:S,align:(ac<Z)?"right":"left",font:i,xoff:1,yoff:5,x:ac,y:ab});try{r.ctx.arc(Z,Y,n,R,aa)}catch(W){}var V=r.colNames[U]||"";r.ctx.textAlign="center";r.ctx.fillStyle=r.textColor||r.textColors.all||"#333";r.ctx.font=B;if(u(n,d)*2<(V.length*K)){Y=Y+n+d/2}r.ctx.fillText(V,Z,Y+K/2-2);r.ctx.stroke();r.ctx.restore()}},drawShadow:function(e,d,i,h){if(this.useShadow!=="yes"){return this}var f=navigator.userAgent.toLowerCase();var g=/(android) ([0-9])/.exec(f);if(g){i=(g[2]<4)?-i:i}this.ctx.shadowColor=e||"#222";this.ctx.shadowOffsetX=d||5;this.ctx.shadowOffsetY=i||5;this.ctx.shadowBlur=h||5;return this},flip:function(g,o,d){var j=this;var i=this.util.xbcss;var l=d?d:this.flipDirection;var h=(l==="x")?"scaleX":"scaleY";var k=parseInt(this.canvas.getAttribute("data-flipIndex"),10);if(isNaN(k)){this.flipLists=o;this.flipLists.unshift(this.op);k=1}var f=this.flipLists[k];var n=5;var e=8;m(g,f,n);if(k>=this.flipLists.length-1){k=0}else{k++}g.setAttribute("data-flipIndex",k);function m(s,r,q){var p=q;clearInterval(this.flipID);this.flipID=setInterval(function(){try{var t=p/q;if(p<=-q){clearInterval(this.flipID)}if(p>=0){s.setAttribute("style",i.enjoy(i[h](t)))}else{if(p<0){s.setAttribute("style",i.enjoy(i[h](Math.abs(t))))}}if(p===0){if(j.callback){j.init(s,r,j.callback)}else{j.init(s,r)}}p--}catch(u){clearInterval(this.flipID);console.log("err")}},e)}return this},flipX:function(e,d){this.flip(e,d,"x");return this},flipY:function(e,d){this.flip(e,d,"y");return this},move:function(f,e,d,g){if((""+f.nodeName).toLowerCase()==="canvas"){this.move1(f,e,d,g)}else{if(this.util.isArray(f)){this.move2(f,e)}}return this},ws:function(d,g){var h=this;var d=d.toLowerCase().replace(/\/$/,"");var g=g||{};g={autoReConnect:(g.autoReConnect===false)?false:true,autoReConnectInterval:(g.autoReConnectInterval!==undefined)?g.autoReConnectInterval:5000,maxReConnect:(g.maxReConnect!==undefined)?g.maxReConnect:5000,useHb:(!g.useHb)?g.useHb:true,hbStr:(g.hbStr!==undefined)?g.hbStr:"Heartbeat",hbInterval:(g.hbInterval!==undefined)?g.hbInterval:null,protocol:g.protocol||"ws.ccchart.com",wscaseName:(g.wscaseName!==undefined)?g.wscaseName:"_wscaseFnc_"+(new Date().getTime())};var e=this.id;var i="-ccchart-ws-"+this.util.uuidv4();var l=this.wsuids[i];if(l){if(l.readyState===l.OPEN&&l.on){}else{this.wsDelTarget(l);l=k(true)}}else{l=k(true);if(h.wsDbg||h.wsInfo){console.log("\n================================","\n init a WebSocket ","\n canvas: #"+e,"\n url: "+d,"\n instance: ccchart.wsuids['"+l.op.uid+"']","\n date: "+(new Date))}}return l;function k(o){if(!h.wsuids[i]){var n=true}h.wsuids[i]=h.wsidoj[e]=h.wsRecent=new (a.WebSocket||a.MozWebSocket)(d,g.protocol);if(n){h.wsuids[i].opOrg=JSON.parse(JSON.stringify(h.ops[e].op));n=false}h.wsuids[i].uid=i;h.wsuids[i].op=g;var m="";if(o){g.autoReConnect=(g.autoReConnect===false)?false:true;if(h.wsReCnt["-ccchart-ws-"+e+"-"+d]===undefined){h.wsReCnt["-ccchart-ws-"+e+"-"+d]=0}if(!h.ops[e].wsReConnecting){h.wsReCnt["-ccchart-ws-"+e+"-"+d]=0}m="ws opend"}else{}h.wsuids[i].wsIncomingCounter=0;h.wsuids[i].wsThinOutInterval=h.ops[e].op.config.wsThinOutInterval||h.ops[e].gcf.wsThinOutInterval||0;h.wsuids[i].on=function(p,q){h.wsuids[i].addEventListener(p,q);return this};h.wsuids[i].op.id=e;h.wsuids[i].op.uid=i;h.wsuids[i].op.url=d;h.wsuids[i].op._noReConnectClose=function(){var p=h.wsuids[i];p.op.autoReConnect=false;if(p.readyState===p.OPEN){p.close()}};h.wsuids[i].on("open",function(){var p=h.wsuids[i];if(!p){return}if(h.wsDbg||h.wsInfo){console.log("\n--------------------------------","\n",m+": #"+e+" "," "+d,"\n "+i)}if(g.autoReConnect){if(h.wsReCnt["-ccchart-ws-"+e+"-"+d]===undefined){if(!h.ops[e].wsReConnecting){h.wsReCnt["-ccchart-ws-"+e+"-"+d]=0}}}j(p)});h.wsuids[i].on("close",function(){var r=h.wsuids[i];if(!r){return}var q="";if(h.wsDbg||h.wsInfo){if(h.ops[e].wsReConnecting){var p=h.wsReCnt["-ccchart-ws-"+e+"-"+d];var s=g.maxReConnect;q="ws wsReConnecting closed. times "+h.wsReCnt["-ccchart-ws-"+e+"-"+d]+"/"+g.maxReConnect;console.log(q+": #"+e+" "+d+" "+i);if(p===s){console.log("// Reconnected retry has ended: for #"+e+" "+d+" check the sever");h.ops[e].wsReConnecting=false}}else{q="ws closd--";console.log(q+": #"+e+" "+d+" "+i)}}if(h.wsDbg){if(r){console.log("\n--------------------------------","\n");console.log(2,e,"autoReConnect:",g.autoReConnect);console.log(2,'that.ops["'+e+'"].wsReConnecting: ',h.ops[e].wsReConnecting);console.log(2,"wsReCnt: ",h.wsReCnt["-ccchart-ws-"+e+"-"+d],h.wsReCnt);console.log(2,"wscaseName:",g.wscaseName);console.log(2,"ws closed: #"+e,"\n "+d,"\n "+i)}}if(g.autoReConnect){setTimeout(function(){f(r)},g.autoReConnectInterval)}});return h.wsuids[i]}function f(o){if(!o){return}if(!g.autoReConnect){h.wsDelTarget(o);return}if(g.maxReConnect<=h.wsReCnt["-ccchart-ws-"+e+"-"+d]){g.autoReConnect=false;h.ops[e].wsReConnecting=false}else{h.ops[e].wsReConnecting=true}if(g.autoReConnect===false){return}h.wsReCnt["-ccchart-ws-"+e+"-"+d]++;if(h.wsDbg||h.wsInfo){var n=h.wsReCnt["-ccchart-ws-"+e+"-"+d];var p=g.maxReConnect;openinfo="ws retry to open. times "+n+"/"+p;console.log(openinfo+": #"+e+" "+d)}if(o.op.wscaseName===""){g.autoReConnect=false;return}h.wsCloseAll();var m=h.init(e,h.ops[e].op,h.ops[e].ondrew).ws(d,g).on("open",function(){h.wsReCnt["-ccchart-ws-"+e+"-"+d]=0}).on("message",ccchart.wscase[g.wscaseName]);if(h.wsDbg){console.log("\n================================","\n re inited ",e,("-ccchart-ws-"+e+"-"+d),"\n ws option: ",g,"\n ws: ",m)}return m}function j(o){if(!g.useHb){return}var m=5000;var n=60000;g.hbInterval=(typeof g.hbInterval==="number")?(g.hbInterval>=m)?g.hbInterval:n:n;o.on("message",function(r){try{var p=JSON.parse(r.data)}catch(q){return}if(p===o.op.hbStr){o.op.bncEnd=(new Date).getTime();o.op.RTT=((o.op.bncEnd-o.op.bncStart)||" - ");if(h.wsDbg||h.wsInfo){console.log("Heartbeat returned: RTT",o.op.RTT+"ms",p,"#"+e,i)}return}return});clearInterval(o.op.hbTimer);o.op.hbTimer=setInterval(function(){if(o.readyState!==o.OPEN){f(o)}else{o.op.bncStart=(new Date).getTime();o.send(o.op.hbStr);if(h.wsDbg){console.log("\n--------------------------------","\n Heartbeat send:",("#"+e,d),("\n readyState: "+o.readyState),("\n hbInterval: "+g.hbInterval),("\n instance: ccchart.wsuids['"+i+"']"),("\n date: "+(new Date)))}}},g.hbInterval)}},wsDelTarget:function(d){if(d.readyState===d.OPEN){d.op._noReConnectClose()}clearInterval(d.op.hbTimer);delete this.wsuids[d.op.uid];delete d;return this},getWs:function(d){if(!d){return}return this.wsuids[d]},getWsById:function(d){if(!d){return}return this.wsidoj[d]},_wsOnClose:function(f,e){var d=this;if(!f){return}f.on("close",function(){if(d.wsDbg){console.log(e+" \n id: #"+f.op.id+" \n url: "+f.url)}d.wsDelTarget(f)});f.op._noReConnectClose();return this},wsCloseByUid:function(d){if(!d){return}if(!this.wsuids){return}var e=this.wsuids[d];if(!e){return}this._wsOnClose(e,"this closed was by the wsCloseByUid. ")},wsCloseById:function(f){if(!f){return}if(!this.wsuids){return}for(var d in this.wsuids){var e=this.wsuids[d];if(!e){continue}if(e.op.id===f){this._wsOnClose(e,"this closed was by the wsCloseById. ")}}},wsCloseByUrl:function(d){if(!d){return}if(!this.wsuids){return}for(var e in this.wsuids){var f=this.wsuids[e];var g=f.op.url.toLowerCase().replace(/\/$/,"");var d=d.toLowerCase().replace(/\/$/,"");if(!f){continue}if(g===d){this._wsOnClose(f,"this closed was by the wsCloseByUrl. ")}}},wsCloseByIdUrl:function(h,d){if(!h){return}if(!d){return}if(!this.wsuids){return}for(var e in this.wsuids){var f=this.wsuids[e];var g=f.op.url.toLowerCase().replace(/\/$/,"");var d=d.toLowerCase().replace(/\/$/,"");if(!f){continue}if(g===d){this._wsOnClose(f,"this closed was by the wsCloseByIdUrl. ")}}},wsClose:function(g,d){var e=this;if(!g){return}if(!d){return}var f=this.wsuids["-ccchart-ws-"+g+"-"+d];console.log(g,d,this.wsuids["-ccchart-ws-"+g+"-"+d],3333333333333333);f.on("close",function(h){if(e.wsDbg){console.log("this closed was by the wsClose method: "+h.target.op.url)}e.wsDelTarget(h.target)});f.op._noReConnectClose();return this},wsCloseAll:function(){var e=this;if(!this.wsuids){return}for(var d in this.wsuids){var f=this.wsuids[d];if(!f){continue}f.on("close",function(g){if(e.wsDbg){console.log("this closed was by the wsCloseAll method: "+g.target.op.url)}e.wsDelTarget(g.target)});f.op._noReConnectClose()}return this},_wsThinout:function(e,d){if(e.wsIncomingCounter===0){if(d>0){e.wsIncomingCounter++}return false}else{if(e.wsIncomingCounter>=d){e.wsIncomingCounter=0;return true}else{e.wsIncomingCounter++;return true}}},wscase:{oneColAtATime:function(l){this.op.wscaseName="oneColAtATime";try{var j=JSON.parse(l.data)}catch(k){return}if(typeof j==="string"){if(this.wsDbg){console.log("ws message type is bad, it is string : "+j)}return}var h=ccchart.ops[this.op.id];var g=this.opOrg;if(h._wsThinout(this,this.wsThinOutInterval)){return}for(var f=0;f<j.length;f++){var d=(g.data[f])?(g.data[f][0]||""):"";if(!h.op.data[f]){h.op.data[f]=[];h.rowNames[f]=(g.data[f])?(g.data[f][0]||""):""}h.op.data[f].shift();h.op.data[f].push(j[f]);if(h.op.data[f].length>h.maxWsColLen){h.op.data[f].shift()}h.op.data[f].unshift(d)}for(var f=0;f<h.op.data.length;f++){if(j[f]===undefined){h.op.data.splice(f,1)}}if(h.type==="pie"){h.op.config.maxWsColLen=1}h.ops[h.id]["s"]=(new Date).getTime();ccchart.init(h.id,h.op,function(){h.ops[h.id].e=(new Date).getTime()})},someColsAtATime:function(m){this.op.wscaseName="someColsAtATime";try{var k=JSON.parse(m.data)}catch(l){return}var h=ccchart.ops[this.op.id];if(h.drawing){console.log("I threw away the data: ",JSON.stringify(k));return}for(var d=0;d<k.length;d++){for(var f=0;f<k[d].length;f++){var g=h.op.data[f].shift();h.op.data[f].push(k[d][f]);if(h.op.data[f].length>h.maxWsColLen){h.op.data[f].shift()}h.op.data[f].unshift(g)}}if(h.callback){ccchart.init(h.id,h.op,h.callback)}else{ccchart.init(h.id,h.op)}},reStart:function(d){if(d.callback){ccchart.init(d.id,d.op,d.callback)}else{ccchart.init(d.id,d.op)}},parseMsg:function(d,h){try{var f=JSON.parse(h.data)}catch(g){return false}if(typeof f!=="object"){if(d.wsDbg){console.log("ws message type is bad: "+f)}return false}if(d.drawing){console.log("I threw away the data: ",JSON.stringify(f));return false}return f},mkOpData:function(g,f,h){for(var d=0;d<g.length;d++){if(!f[d]){continue}var e=f[d].shift();f[d].push(g[d]);if(f[d].length>h){f[d].shift()}f[d].unshift(e)}return f}},move1:function(l,g,k,f){console.log("調整中");return;var j=this;var d=(f!==undefined)?f:100;var e=this.util.isArray(g);var h=0;clearInterval(this.moveTid);this.moveTid=setInterval(function(){try{if(h<k.length-1){h++;var m={config:(e)?g[h]:g,data:k[h]};j.init(l,m)}else{clearInterval(this.moveTid)}}catch(i){clearInterval(this.moveTid)}},d);return this},move2:function(k,g){console.log("調整中");return;var h=this;if(!k){return this}if(this.moveStack.length===0){if(!this.moveIntOpData){this.moveIntOpData=JSON.stringify(this.op.data);if(this.useFirstToRowName){this.moveIntRowNames=this.rowNames}}else{if(this.moveIntOpData!==this.op.data){this.moveDly=0;this.moveStack=[];this.moveStackDly=[];this.op.data=JSON.parse(this.moveIntOpData)}}}var n=g||200;this.moveDly+=n;var m=this.op.config;var j=this.op.data;for(var f=0;f<j.length;f++){j[f].shift();j[f].shift();j[f].push(k[f]);j[f].unshift(this.moveIntRowNames[f-1]);if(f===j.length-1){this.moveStack.push(JSON.stringify(j))}}this.moveStackDly.push(this.moveDly);if(this.moveStack.length===0){l(h)}else{var e=setTimeout(function(){clearTimeout(e);l(h)},this.moveStackDly.shift())}function l(d){var i=JSON.parse(d.moveStack.shift());d.init({config:m,data:i})}return this},drawImg:function(d){if(!d){var d=this._img||[]}if(!this.util.isArray(d)){return}if(typeof d[0]==="string"){this.drawImgs(d)}else{if(this.util.isArray(d[0])){for(var e=0;e<d.length;e++){this.drawImgs(d[e])}}}},drawImgs:function(o){if(!o){var o=this._img||[]}var e=o[0]||"";if(e===""){return this}var i=o.length;var h=this;var l,k,m,g,p,n,d,j;var f=new Image();f.canvasId=this.id;f.src=e;f.onload=function(q){h.currImgTargetCtx=h.cxs[this.canvasId];h.currImgTargetCtx.save();h.currImgTargetCtx.globalAlpha=h.ops[this.canvasId].imgAlpha;if(i===1){p=0;n=0;d=h.width;j=h.height;h.currImgTargetCtx.drawImage(f,p,n,d,j)}else{if(i<=3){p=o[1]||0;n=o[2]||0;h.currImgTargetCtx.drawImage(f,p,n)}else{if(i<=5){p=o[1]||0;n=o[2]||0;d=o[3]||0;j=o[4]||0;h.currImgTargetCtx.drawImage(f,p,n,d,j)}else{if(i<=9){l=o[1]||0;k=o[2]||0;m=o[3]||0;g=o[4]||0;p=o[5]||0;n=o[6]||0;d=o[7]||0;j=o[8]||0;h.currImgTargetCtx.drawImage(f,l,k,m,g,p,n,d,j)}}}}h.currImgTargetCtx.restore()}},drawMemo:function(l){this.ctx.save();if(!l){var l=this._memo||{}}var f=l.val||"";var j=l.left||0;var r=l.top||0;var h=l.lineTo||false;var k=l.lineTo2||false;if(!(f&&((j&&r)||h||k))){return this}var g=l.font||"100 14px 'Arial'";var e=l.align||"left";var t=l.color||this.textColor||this.textColors.all||this.textColors.memo||"#ccc";var o=l.opacity||this.textOpacity||1;if(this.util.isArray(h)){if(h.length===2){var i=(typeof l.lineToXOffset==="number")?l.lineToXOffset:50;var q=(typeof l.lineToYOffset==="number")?l.lineToYOffset:3;var s=(typeof l.lineToWidth==="number")?l.lineToWidth:1;var d=l.lineToColor||t}else{h=false}}else{h=false}this.ctx.font=g;this.ctx.textAlign=e;this.ctx.globalAlpha=o;this.ctx.fillStyle=t;this.ctx.fillText(f,j,r);if(h){var n=this;p(decodeURIComponent(m(this.id,"rowNames",h[0])),decodeURIComponent(m(this.id,"colNames",h[1])))}this.ctx.restore();return this;function p(w,v){var u=n.chartLeft+n.xGap/2+n.xGap*v;var z=n.chartBottom-(n.data[w][v]-n.minY)*n.unitH;n.ctx.save();n.ctx.beginPath();n.ctx.lineWidth=s;n.ctx.strokeStyle=d;n.ctx.moveTo(j+i,r+q);n.ctx.lineTo(u,z);n.ctx.stroke();n.ctx.restore()}function m(x,w,v){for(var u=0;u<n.ops[x][w].length;u++){if(""+n.ops[x][w][u]===""+v){return u}}}},drowText:function(i,f,l,g,m,e){var j=this;var d=this.id;var k=this.drowText;k.startLeft=m;if(k.resetPos){k.left=undefined;k.top=undefined;k.resetPos=false}if(!k.left){k.left=k.startLeft}k.left+=f;if(!k.top){k.top=k.startTop}k.top+=l;if(!k.interval){k.interval=0}k.interval+=e;var h={val:i,left:k.left,top:k.top,color:g,font:"100 "+m+"px 'Arial'"};setTimeout(function(){j.ops[d].memo(h)},k.interval);return this},setDrowText:function(e,d,f,g){if(f){this.drowText.resetPos=true}else{this.drowText.resetPos=false}if(g){this.drowText.interval=0}this.drowText.startLeft=e||0;this.drowText.startTop=d||0;return this},thanx:function(){this.setDrowText(120,180).drowText("T",0,0,"orange",120,100).drowText("h",70,0,"orange",120,100).drowText("a",60,0,"orange",120,100).drowText("n",60,0,"orange",120,100).drowText("k",60,0,"orange",120,100).drowText(" ",50,0,"orange",120,100).drowText("y",40,0,"orange",120,100).drowText("o",50,0,"orange",120,100).drowText("u",60,0,"orange",120,100).setDrowText(120,280,true).drowText("F",0,0,"red",120,100).drowText("o",60,0,"red",120,100).drowText("r",60,0,"red",120,100).drowText(" ",40,0,"red",120,100).drowText("Y",30,0,"red",120,100).drowText("o",60,0,"red",120,100).drowText("u",60,0,"red",120,100).drowText("r",60,0,"red",120,100).setDrowText(120,380,true).drowText("S",0,0,"white",120,100).drowText("u",80,0,"white",120,100).drowText("p",60,0,"white",120,100).drowText("p",60,0,"white",120,100).drowText("r",60,0,"white",120,100).drowText("t",45,0,"white",120,100).drowText("!",60,0,"white",120,100);return this},toData:function(d){var f,e;if(typeof d!=="object"){f="image/png";e=this.canvas}else{f=(d.type)?d.type:"image/png";if((""+d.canvas.nodeName).toLowerCase()==="canvas"){e=d.canvas}else{e=document.getElementById(d.canvas)}}return e.toDataURL(f)},_add:function(g,e){var f=this;this._addsFlg=-1;this.addFront=g;this.addBack=e;var d=["title","titleColor","titleFont","titleTextAlign","titleX","titleY","subTitle","subtitle","subTitleColor","subTitleFont","subTitleTextAlign","subTitleX","subTitleY","onlyChart","onlyChartWidthTitle","xScaleColor","xScaleFont","xScaleAlign","xScaleXOffset","xScaleYOffset","xScaleSkip","colNamesTitleOffset","yScaleColor","yScaleFont","yScaleAlign","yScaleXOffset","yScaleYOffset","height","width","useHanrei","paddingTop","paddingRight","paddingLeft","paddingBottom","axisXLen","axisYLen","axisXWidth","axisYWidth","axisYSkipWidth","xColor","yColor","bg","bgGradient","textColors","shadows"];this._ondrew=function(h){i(e.op.config,g.op.config,d);h._addsFlg=1;h.init(e.id,e.op,function(){i(g.op.config,e.op.config,d);h._addsFlg=2;h.init(g.id,g.op,function(){if(e.callback){e.callback()}if(g.callback){g.callback();e=undefined;g=undefined}h._addsFlg=undefined;h._ondrew=h._ondrew_old})});function i(l,m,j){for(var k=0;k<j.length;k++){l[j[k]]=m[j[k]]}}};if(!f.drawing){f._ondrew(this)}return this},add:function(g,f){var e=this.util.deepJSONCopy({id:this.id,op:this.ops[this.id].op,callback:this.ops[this.id].callback});var d=this.util.deepJSONCopy({id:this.id,op:g,callback:f});d.op.config.title=e.op.config.title;d.op.config.subTitle=e.op.config.subTitle||e.op.config.subtitle;this._add(e,d);return this},after:function(e,d){this.add(e,d)},before:function(g,f){var e=this.util.deepJSONCopy({id:this.id,op:this.ops[this.id].op,callback:this.ops[this.id].callback});var d=this.util.deepJSONCopy({id:this.id,op:g,callback:f});e.op.config.title=d.op.config.title;e.op.config.subTitle=d.op.config.subTitle||d.op.config.subtitle;this._add(d,e);return this},line:function(d){this.drawLine(d);return this},markers:function(d){this.drawMarkers(d);return this},memo:function(d){this.drawMemo(d);return this},setOp:function(e,d){return this.ops[this.id][e]=this[e]=d},moduleExtend:function(g,k,e,h){if(!g){return}if(!k){k=g;g=this}if(!k.aboutThis_module){k.aboutThis_module={name:e}}for(var f in k){if(f==="aboutThis_module"){g.aboutThis["plugins"][k[f].name]=k[f]}if(f==="init"){}else{if(!g[f]||h){g[f]=k[f]}else{for(var d in k[f]){if(g[f][d]){if(f!=="aboutThis_module"){}}else{g[f][d]=k[f][d]}}}}}return g},loadBranch:function(h,g){var f=(typeof h==="string");var d=(typeof h.config==="string");var e=(typeof h.data==="string");if(f){this.getOption(h,g,false)}else{if(e||d){if(e&&d){this.getOptionCnfData(h,g,false)}else{if(d){this.getOptionCnf(h,g,false)}else{if(e){this.getOptionData(h,g,false)}}}}else{if(this.util.isArray(h.data)){this.preProcessing(h,g)}}}},base:function b(){var g=this;var h=arguments.length;var j="";if(h===0){this.gcf={};d(g.m.Theme._default||g._default||{})}else{if(h===1){if(!this.gcf){this.gcf={}}j=this.util.cnfExtend({config:this.gcf},k(arguments[0]));d(j)}else{var l="";for(var e=0;e<h;e++){var m=arguments[e];if(m===""||m===null){this.gcf={};continue}l=k(arguments[e]);j=this.util.cnfExtend({config:this.gcf},l);d(j)}}}for(var e in this.ids){var f=this.ids[e];this.init(f,this.ops[f.id].op,this.ops[f.id].callback)}return this;function k(n){var i;var n=n?n:"_default";if(typeof n==="string"){i=g.m.Theme[n]||g[n]||{}}else{if(typeof n==="object"){if(!n.config){return g}i=n||{}}}return i}function d(i){g.gcf=i.config;g.gdata=i.data||[[""],[""]];return g}},toggleRC:function(f,e,d){var e=e;e.data=this.util.changeRowsAndCols(e.data);this.init(this.id,e,d);return this},getOption:function(g,f,d){var e=this;this.get(g,function(h){try{g=JSON.parse(h);e.loadBranch(g,f)}catch(i){}},d)},getOptionCnfData:function(g,f,d){var e=this;this.get(g.config,function(h){try{g.config=JSON.parse(h);e.getOptionData(g,f,false)}catch(i){}},d)},getOptionCnf:function(g,f,d){var e=this;this.get(g.config,function(h){try{g.config=JSON.parse(h);e.preProcessing(g,f)}catch(i){}},d)},getOptionData:function(g,f,d){var e=this;this.get(g.data,function(h){try{g.data=JSON.parse(h);e.preProcessing(g,f)}catch(i){}},d)},util:{setLineWidthSet:function(f,g){if(!g){g=f.op}var d=f.lineWidth;_lineWidthSet=g.config.lineWidthSet||f.gcf.lineWidthSet||undefined;if(typeof _lineWidthSet==="object"){if(_lineWidthSet.length===0){_lineWidthSet=[];for(var e=0;e<f.dataRowLen;e++){_lineWidthSet[e]=d}}else{}}else{_lineWidthSet=[];for(var e=0;e<f.dataRowLen;e++){_lineWidthSet[e]=d}}return _lineWidthSet},setNumberOfConfigVal:function(e,g,f){var d=(e.op.config[g]!==undefined)?e.op.config[g]:(e.gcf[g]!==undefined)?e.gcf[g]:f;return e[g]=d},ajustTitlesX:function(g,e,d){var f=(e==="center")?(0+d):(e==="left")?(0+d):(e==="right")?(g.width-d):(0+d);return f},setPfx:function(d){return ccchart.pfx[d]=ccchart.prefix+"-"+d},getAxisIndex:function(e,h){var g=(e==="axisYs")?"left":"top";var f=ccchart[e];for(var d=0;d<f.length;d++){if(e==="axisYs"){if(h<f[d][g]){return[d,h,f[d][g]]}}if(e==="axisXs"){if(h>f[d][g]){return[d,h,f[d][g]]}}}},getValWidth:function(e,g,f){if(typeof g==="number"){var d=Math.floor(Math.log(g)/Math.log(10))+1;return d*f}else{if(typeof g==="string"){return g.length*f}}return 5*this.getCurrFontSize(e)},setDefaultCtxProps:function(d,f,e){d.ctx[f]=d.cxs[d.id][f]=e;return d.ctx},getCurrFontSize:function(d){var e=d.ctx.font;if(typeof e!=="string"){return 12}return +e.match(/(\d*)px/)[1]},changeRowsAndCols:function(f){var d=[];for(var e=0;e<f.length;e++){for(var g=0;g<f[e].length;g++){if(!d[g]){d[g]=[]}d[g].push(f[e][g])}}return d},uuidv4:function(){var e="",d,f;for(d=0;d<32;d++){f=Math.random()*16|0;if(d==8||d==12||d==16||d==20){e+="-"}e+=(d==12?4:(d==16?(f&3|8):f)).toString(16)}return e},deepJSONCopy:function(d){return JSON.parse(JSON.stringify(d))},cnfExtend:function(g,e){var f=ccchart.util.deepJSONCopy(g);return d(f,e);function d(l,h){for(var j in h){var k=h[j];if(j==="config"||j==="data"){if(typeof k==="object"&&!ccchart.util.isArray(k)){d(l[j],k)}else{l[j]=k}}else{l[j]=k}}return l}},uniq:function(e){var d=null;var f=[];e.sort().forEach(function(g,j,h){if(g===null){return}if(d!==g){f.push(g)}d=g});return f},addComma:function(h,k,l){if(isNaN(parseFloat(k))){return k}var g="";var e="";var d=".";if(l==="yes"){g=ccchart.util.round00(k,h.roundDigit);e=g.split(d)[1];g=g.split(d)[0]}else{g+=parseInt(k);d=""}var j=g.charAt(0);j=(j==="-"||j==="+")?j:"";g=(j==="")?g:g.substr(1);for(var f=3;f<g.length;f+=4){g=g.substring(0,g.length-f)+","+g.substring(g.length-f)}e=isNaN(e)?"":d+e;return j+g+e},round00:function(h,j){var e=Math.pow(10,j);var i=parseFloat(h);var g=""+Math.round(i*e)/e;if(j<=0){return g}var f=d(j);if(g.indexOf(".")<0){return g+"."+f}else{g=g+f;return g.split(".")[0]+"."+g.split(".")[1].substring(0,j)}function d(m){var l="";for(var k=0;k<m;k++){l=l+"0"}return l}},getMax:function(d){return this._preGetMinMax(d).sort(function(f,e){return e-f})[0]},getMin:function(d){return this._preGetMinMax(d).sort(function(f,e){return f-e})[0]},_preGetMinMax:function(h){var g=[];for(var f=0;f<h.dataRowLen;f++){var e=[];for(var d=0;d<h.data[f].length;d++){if(!(h.data[f][d]===null||h.data[f][d]===undefined)){if(h.type==="candle"){if(f===1||f===2){e=e.concat(h.data[f][d])}}else{e=e.concat(h.data[f][d])}}}g=g.concat(e)}return g},mkPercentVal:function(g,i,f,e){var d=g.util.getSumCols(g);var h=Math.round(i*100/d[f],10)+"%";if(g.type==="stacked"){h=Math.round(i*100/d[f],10)+"%"}else{if(g.type==="pie"){if(g.wsuids.length===0){h=i}else{h=i+" ("+Math.round(i*100/d[e])+"%)"}}else{h=Math.round(i*100/d[e],10)+"%"}}return h},getSumCols:function(h){var e=[];var g=[];for(var f=0;f<h.dataRowLen;f++){e[f]=[];for(var d=0;d<h.data[f].length;d++){e[f][d]=((h.data[f][d]||0)+(e[f-1]?e[f-1][d]:0));g[d]=e[f][d]}}return g},getMaxSum:function(h){var f=[];var g=0;for(var e=0;e<h.dataColLen;e++){for(var d=0;d<h.dataRowLen;d++){if(h.data[d][e]){g+=parseFloat(h.data[d][e])}}f.push(g);g=0}return f.sort(function(j,i){return i-j})[0]},aryToPercent:function(f){var e=0,d=[];f.forEach(function(g,h){e+=(g||0)});f.forEach(function(g,h){d.push(((g||0)/e)*100)});return d},aryToDeg:function(f){var d=[];var e=this.aryToPercent(f);e.forEach(function(g,h){d.push((g/100)*360)});return d},isMobile:function(){var e=navigator.userAgent.toLowerCase();var d=/(android|iphone|ipad|iemobile)/.exec(e);return d?d[0]:null},isArray:function(d){if(typeof d==="object"&&d.length>=0){return true}return Object.prototype.toString.call(d).toLowerCase()==="[object array]"},bGgradient:function(f,e,d){var d=d||"left";return";;background-image:-webkit-gradient(linear, "+d+" top, "+d+" bottom, color-stop(0, "+f+"), color-stop(.5, "+e+"));background-image:-webkit-linear-gradient("+d+", "+f+" 0%, "+e+" 50%);background-image:-moz-linear-gradient("+d+", "+f+" 0%, "+e+" 50%);background-image:-ms-linear-gradient("+d+", "+f+" 0%, "+e+" 50%);background-image:-o-linear-gradient("+d+", "+f+" 0%, "+e+" 50%);"},setBG:function(e,h,g,f){if(e.nodeType===1){e.style.cssText=ccchart.util.bGgradient(h,g,f)}else{if(e.length>0){for(var d=0;d<e.length;d++){e[d].style.cssText=ccchart.util.bGgradient(h,g,f)}}}},getFontSizeFromStyle:function(e){var d=(e).split(" ")[1]||0;return parseFloat(d)},hCopy:function(d){return JSON.parse(JSON.stringify(d))},xbcss:{enjoy:function(){var d=this.enjoy.arguments;if(!this[d[0].split("(")[0]]){return}var h={transform:document.body.style.transform,"-webkit-transform":document.body.style.webkitTransform,"-moz-transform":document.body.style.MozTransform,"-ms-transform":document.body.style.msTransform,"-o-transform":document.body.style.OTransform};var g="";for(var f in h){if(h[f]!==undefined){g=f+":";for(var e=0;e<d.length;e++){g+=" "+d[e]}}}return g},translate:function(f,e){var d=(e)?(f+","+e):(f+", 0px");return"translate("+d+") "},translateX:function(d){return"translateX("+d+")"},translateY:function(d){return"translateY("+d+")"},scale:function(e,d){var d=(d)?d:e;return"scale("+e+","+d+")"},scaleX:function(d){return"scaleX("+d+")"},scaleY:function(d){return"scaleY("+d+")"},skew:function(f,e){var d=(e)?(f+","+e):f;return"skew("+d+")"},skewX:function(d){return"skewX("+d+")"},skewY:function(d){return"skewY("+d+")"},matrix:function(h,f,j,i,g,e){return"matrix("+h+","+f+","+j+","+i+","+g+","+e+")"},matrix3d:function(s,r,p,n,k,j,i,h,g,f,e,d,q,o,m,l){return"matrix3d("+s+","+r+","+p+","+n+","+k+","+j+","+i+","+h+","+g+","+f+","+e+","+d+","+q+","+o+","+m+","+l+")"},rotate:function(d){return"rotate("+d+"deg)"}}}}})(window);window.ccchart.m.CssHybrid=(function(window){return{aboutThis_module:{name:"CssHybrid",varsion:"0.05",create:20120610,update:20131224,dependent:"ccchart-v1.08.1",writer:"Toshiro Takahashi @toshirot"},useCssSetting:function(){if(this.useCss!=="yes"){return this}if(this.type==="pie"){return this}var id=this.id;var that=this;var style=getComputedStyle(this.canvas);var top=getNum("top");var left=getNum("left");var marginTop=getNum("margin-top");var marginLeft=getNum("margin-left");var paddingTop=getNum("padding-top");var paddingLeft=getNum("padding-left");var borderTopWidth=getNum("border-top-width");var borderLeftWidth=getNum("border-left-width");var currZindex=getNum("z-index");var position=style.position;var position=(position==="relative"||position==="static")?"absolute":position;this.canvasZindex=(this.defaultZindex<currZindex)?currZindex:this.defaultZindex;var operaTop=(this.ua.match(/opera/)&&position==="fixed")?(getNum("top")+Math.max(getNum("margin"),getNum("margin-top"))):0;var operaLeft=(this.ua.match(/opera/)&&position==="fixed")?(getNum("left")+Math.max(getNum("margin"),getNum("margin-left"))):0;this.ops[this.id]["adjustTop"]=paddingTop+borderTopWidth+operaTop;this.ops[this.id]["adjustLeft"]=paddingLeft+borderLeftWidth+operaLeft;this.ops[this.id].TMP_tooltipIni=";position: absolute;top: -10000px;left: -10000px";this.ops[this.id].TMP_tooltip=";width:120px;height:40px;box-shadow: 6px 6px 6px rgba(000,000,000,0.6), inset 2px 2px 3px 3px rgba(180,180,180,0.2);border: 1px solid rgba(180,180,180,0.7);border-radius: 12px;font-size: 10px;line-height: 11px;padding-top: 5px;text-align: center;text-shadow: 0px;";this.ops[this.id].TMP_tooltip_fukidashi='{;content: " ";position: absolute;z-index: 2;left: 20px;top: 45px;background: transparent;border : 12px solid;border-color: rgba(200,200,200,0.9) transparent transparent;}';var cssText="";this.hybridCssEl=document.querySelector("#-ccchart-css-styles");this.hybridCss=getHybridCss();if(this.hybridCssEl===null){this.hybridCssEl=document.createElement("style");this.hybridCssEl.setAttribute("id","-ccchart-css-styles");this.hybridCssEl.setAttribute("title","-ccchart-css-styles");cssText+="\n.-ccchart-css-arc{background-color: rgba(0,0,0,0.5);}";cssText+="\ndiv.-ccchart-css-arc:hover{";cssText+=" box-shadow: 0px 0px 30px rgba(255,255,255,1);";cssText+=" background-color: rgba(255,255,255,0.5);";cssText+="}";cssText+="\n.line{border-top: 1px solid #000;}";cssText+="\ndiv.line:hover{";cssText+=" box-shadow: 0px 0px 30px rgba(255,255,255,1);";cssText+=" background-color: rgba(255,255,255,0.5);";cssText+="}";cssText+="\n\n"}this.cssTooltip=this.op.config.cssTooltip||this.gcf.cssTooltip||"";this.cssTooltipFukidashi=this.op.config.cssTooltipFukidashi||this.ops[this.id].TMP_tooltip_fukidashi;if(!this.cssgs[this.id]){if(!(this.op.config.cssTooltip||this.gcf.cssTooltip)){cssText+="\n.-ccchart-css-tooltip {"+this.ops[this.id].TMP_tooltipIni+"}";cssText+="\n #-ccchart-css-tooltip-"+this.id+"{"+this.ops[this.id].TMP_tooltip+"}"}else{var css="";if(typeof this.cssTooltip==="object"){css="{";for(var i in this.cssTooltip){css+=";"+i+":"+this.cssTooltip[i]}css+="}"}else{if(typeof this.cssTooltip==="string"){css+=this.cssTooltip}}cssText+="\n.-ccchart-css-tooltip {"+this.ops[this.id].TMP_tooltipIni+"}";cssText+="\n #-ccchart-css-tooltip-"+this.id+(css)}cssText+="\n.-ccchart-css-tooltip:before "+this.cssTooltipFukidashi}this.hybridCssEl.innerHTML+=cssText;document.head.appendChild(this.hybridCssEl);cssText="";this.hybridCssEl=null;this.hybridCss=document.styleSheets["-ccchart-css-styles"];this.hybridBox=document.querySelector("#-ccchart-css-hybrid");if(this.hybridBox===null){var hybridBox=document.createElement("div");hybridBox.setAttribute("id","-ccchart-css-hybrid");this.hybridBox=document.body.appendChild(hybridBox)}this.cssgs[id]=document.querySelector("#-ccchart-css-group-"+id);if(!this.cssgs[id]){var cssGrpBox=document.getElementById("-ccchart-css-groupbox");var cssGrpBox=cssGrpBox?cssGrpBox:document.createElement("div");cssGrpBox.setAttribute("id","-ccchart-css-groupbox");var cssGrp=document.createElement("div");cssGrp.setAttribute("class","-ccchart-css-group");this.hybridBox.appendChild(cssGrpBox);this.cssgs[id]=cssGrpBox.appendChild(cssGrp);this.cssgs[id].setAttribute("id","-ccchart-css-group-"+id);cssGrpBox=null}var cssText="";cssText+=";width:"+getCvsVal("width",this.width)+"px";cssText+=";height:"+getCvsVal("height",this.height)+"px";cssText+=";position:"+position;if(position==="fixed"){var fixedZ=this.canvasZindex+2;cssText+=";z-index:"+(""+fixedZ);this.canvas.style.zIndex=(""+fixedZ)}else{cssText+=";z-index:"+(this.canvasZindex+1)}this.cssgs[id].setAttribute("style",cssText+";background:transparent;border-color:transparent;");if(this.useToolTip==="yes"){addToolTip(this)}return this;function addToolTip(that){var id=that.id;that.cssTooltips[id]=document.querySelector("#-ccchart-css-tooltip-"+id);if(!that.cssTooltips[id]){var csstooltip=document.createElement("div");csstooltip.setAttribute("class","-ccchart-css-tooltip");csstooltip.setAttribute("id","-ccchart-css-tooltip-"+id);var cssText="";cssText+=";z-index:"+(that.canvasZindex+1);setTimeout(function(){that.cssTooltips[id]=that.cssgs[id].appendChild(csstooltip);try{var _tooltipop=that.cssTooltip;if(_tooltipop){if(!_tooltipop.bgGradient){defaultToolTipBG(id)}else{that.util.setBG(document.querySelectorAll("#-ccchart-css-tooltip-"+id),_tooltipop.bgGradient.from,_tooltipop.bgGradient.to,"top")}}else{defaultToolTipBG(id)}}catch(e){}},0)}}function defaultToolTipBG(id){that.util.setBG(document.querySelectorAll("#-ccchart-css-tooltip-"+id),"rgba(200,200,200,0.6)","rgba(255,255,255,0.6)","top")}function getHybridCss(){var sheet=null;for(var i=0;i<document.styleSheets.length;i++){if(document.styleSheets[i].title==="-ccchart-css-styles"){sheet=document.styleSheets[i]}break}return sheet}function getCvsVal(prop,defaultVal){return that.canvas.style[prop]||that.canvas.getAttribute(prop)||defaultVal}function getComputedStyle(elm){return elm.currentStyle||document.defaultView.getComputedStyle(elm,null)}function getNum(prop){return parseFloat(document.defaultView.getComputedStyle(that.canvas,null).getPropertyValue(prop),10)||0}},adjustCss:function(type){var that=this;for(var i in this.ops){if(that.ops[i].useCss!=="yes"){continue}var el=document.getElementById(i);var level=0;var group=document.getElementById("-ccchart-css-group-"+i);if(!group){return}getPos(i,el,level,10,0,0,function(numAry){var topOff=that.ops[i]["adjustTop"];var leftOff=that.ops[i]["adjustLeft"];var top=topOff+numAry[0]||0;var left=leftOff+numAry[1]||0;group.style.top=top+"px";group.style.left=left+"px"})}function getPos(id,el,level,deep,numT,numL,fn){var current=el.nodeName.toUpperCase();if(current==="BODY"){return}if(!deep){var deep=5}var css=el.currentStyle||document.defaultView.getComputedStyle(el,null);var parentoffNode=el.offsetParent||el.parentNode;if(!parentoffNode){return}if(css){if(!that.ops[id].targetPos){that.ops[id].targetPos=css.position}if(that.ops[id].targetPos==="fixed"){if(current==="CANVAS"){numT+=el.offsetTop;numL+=el.offsetLeft}}else{if(that.ops[id].targetPos==="static"||that.ops[id].targetPos==="relative"||that.ops[id].targetPos==="absolute"){if(current==="CAPTION"||current==="TD"||current==="TH"||current==="TABLE"){var borderTopW=parseInt(css.borderTopWidth,10);var borderLeftW=parseInt(css.borderLeftWidth,10);var syusei=that.ua.match(/firefox/)?2:1;numT+=el.offsetTop+borderTopW/syusei;numL+=el.offsetLeft+borderLeftW/syusei}else{numT+=el.offsetTop;numL+=el.offsetLeft}}else{}}if(parentoffNode.nodeName.toUpperCase()==="BODY"){if(fn){fn([numT,numL])}}else{getPos(id,parentoffNode,++level,deep,numT,numL,fn)}delete css}}},_css_arc:function(op){var that=this;var id=this.id;if(!op){var op=this.op||{}}var x=op.x||0;var y=op.y||0;var radius=op.radius||5;var borderWidth=this.borderWidth||3;var colorIndex=((this.type==="scatter")?op.colorIndex:op.row)||0;var borderColor=op.borderColor||op.colorSet[colorIndex]||op.colorSet[colorIndex];var bgcolor=op.bgColor||op.colorSet[colorIndex]||op.colorSet[colorIndex];var tipBgcolor=bgcolor;if((this.type==="bar"||this.type==="stacked")&&this.useToolTip==="yes"){bgcolor=(this.barTipAnchorColor==="colorSet")?bgcolor:this.barTipAnchorColor}var etc=(op.etcStyle?op.etcStyle:"");var el=document.createElement("div");if(borderWidth>radius){radius=borderWidth}var dataX=(this.type==="scatter")?(this.rowNames[0]):this.colNames[op.col];var dataY=(this.type==="scatter")?(this.rowNames[1]):this.rowNames[op.row];var unit=that.ops[id].unit;if(typeof unit==="string"){unit=unit}else{if(typeof unit==="object"){unit=unit.unit}}if((this.dataRowLen-1)===op.row&&(this.dataColLen-1)===op.col){this.adjustCss("adjusting");var _cnt=0;var _tid=setInterval(function(){if(_cnt>=5){clearInterval(_tid)}that.adjustCss("adjusting");_cnt++},200)}el.setAttribute("class","-ccchart-css-arc "+op.classStr);el.setAttribute("data-row",op.row);el.setAttribute("data-col",op.col);el.setAttribute("data-colname",this.colNames[op.col]);el.setAttribute("data-colnamestitle",this.colNamesTitle);el.setAttribute("data-y",dataY);el.setAttribute("data-x",dataX);el.setAttribute("data-scatter-y",op.scatterY);el.setAttribute("data-scatter-x",op.scatterX);el.setAttribute("data-data",op.data);el.setAttribute("data-percent",op.percent);el.setAttribute("data-unit",op.unit);el.setAttribute("data-bg",tipBgcolor);var xyr="position: absolute;left:"+(x-radius)+"px;top:"+(y-radius)+"px;width:"+radius*2+"px;height:"+radius*2+"px;border-radius:"+radius*2+"px;"+((this.type==="bar")?"opacity: 0.5;":"")+((op.classStr==="css-maru")?("background: "+bgcolor+";"):"")+((op.classStr==="css-ring")?("border:"+borderWidth+"px solid "+borderColor+";"):"")+"box-sizing: border-box;"+this.pfx["transform-origin"]+": 0px 0px;"+this.pfx["box-sizing"]+": border-box;"+this.pfx.transition+": background-color 200ms linear";el.setAttribute("style",xyr+etc);var arc=this.cssgs[id].appendChild(el);el=null;function showTooltip(id,e,op){that.csstoolRock=!!that.csstoolRock;var rowNum=e.target.getAttribute("data-row");var rowName=e.target.getAttribute("data-y");var colName=e.target.getAttribute("data-x");var scatterXData=e.target.getAttribute("data-scatter-x");var scatterYData=e.target.getAttribute("data-scatter-y");var colname=e.target.getAttribute("data-colname");var colnamestitle=e.target.getAttribute("data-colnamestitle");var data=e.target.getAttribute("data-data");var percent=(that.percentVal==="yes")?"( "+e.target.getAttribute("data-percent")+" )":"";var unit=e.target.getAttribute("data-unit");var bgcolor=e.target.getAttribute("data-bg");var colNamesTitle=(that.type==="scatter")?colname:((that.colNamesTitle)?that.colNamesTitle:"");var unit=that.ops[id].unit;if(typeof unit==="string"){unit=unit}else{if(typeof unit==="object"){unit=unit.unit}}var toolTemp=!that.ops[id].tmpToolTip?"":that.ops[id].tmpToolTip;toolTemp=toolTemp.replace(/{{colNamesTitle}}/g,'<span class="-ccchart-ttip-colnamestitle">'+colNamesTitle+"</span> ").replace(/{{colName}}/g,'<span class="-ccchart-ttip-colname">'+colName+"</span>").replace(/{{rowName}}/g,'<span class="-ccchart-ttip-rowname">'+rowName+"</span>").replace(/{{data}}/g,'<span class="-ccchart-ttip-data">'+data+"</span>").replace(/{{unit}}/g,'<span class="-ccchart-ttip-unit">'+unit+"</span>").replace(/{{percent}}/g,'<span class="-ccchart-ttip-percent">'+percent+"</span>");var re=/{{(\w*)}}/g;var res=[];var other=[];while(res=re.exec(toolTemp)){try{var _other=eval(res[1]);if(typeof _other==="object"){toolTemp=toolTemp.replace("{{"+RegExp.$1+"}}",'<span class="-ccchart-ttip-'+res[1]+'">'+_other[(op.row+1)][(op.col+1)]+"</span>")}}catch(e){}}var computedStyle=document.defaultView.getComputedStyle(that.cssTooltips[id],null);setTimeout(function(){if(!computedStyle){return}var height=parseFloat(computedStyle.getPropertyValue("height"),10)||0;var borderTop=parseFloat(computedStyle.getPropertyValue("border-top"),10)||0;var borderBottom=parseFloat(computedStyle.getPropertyValue("border-bottom"),10)||0;var paddingTop=parseFloat(computedStyle.getPropertyValue("padding-top"),10)||0;var paddingBottom=parseFloat(computedStyle.getPropertyValue("padding-bottom"),10)||0;computedStyle=null;that.cssTooltips[id].style.left=(x-radius-20)+"px";that.cssTooltips[id].style.top=(y-radius-70-height)+"px";that.hybridCss.insertRule("#-ccchart-css-tooltip-"+id+":before {top:"+((borderBottom+paddingTop+paddingBottom)+height)+"px}",0)},0);if(that.type==="scatter"){var htm='<span class="-ccchart-ttip-sct-colnamestitle">'+colNamesTitle+'</span><br><span class="-ccchart-ttip-sct-colname">'+colName+'</span> <span class="-ccchart-ttip-sct-data-x">'+scatterXData+'</span><br><span class="-ccchart-ttip-sct-rowname">'+rowName+'</span> <span class="-ccchart-ttip-sct-data-y">'+scatterYData+"</span><br>";that.cssTooltips[id].innerHTML=htm}else{var htm='<span class="-ccchart-ttip-colnamestitle">'+colNamesTitle+'</span> <span class="-ccchart-ttip-colname">'+colName+'</span><br><span class="-ccchart-ttip-rowname">'+rowName+'</span><br><span class="-ccchart-ttip-data">'+data+"</span>"+(" "+unit+""||"")+'<span class="-ccchart-ttip-percent"> '+percent+" </span>";if(that.cssTooltips[id]){that.cssTooltips[id].innerHTML=toolTemp||htm}toolTemp=htm=""}that.deleteCssRule("#-ccchart-css-tooltip-"+id+"::before");that.hybridCss.insertRule("#-ccchart-css-tooltip-"+id+":before{ border-color:"+bgcolor+" transparent transparent;}",that.hybridCss.cssRules.length)}function hideTooltip(id){if(that.csstoolRock){return}if(that.cssTooltips[id]){that.cssTooltips[id].style.left=-10000+"px";that.cssTooltips[id].style.top=-10000+"px";that.cssTooltips[id].innerHTML=""}}if(this.useToolTip==="yes"){var mbl=this.util.isMobile();var over=(mbl)?"touchstart":"mouseover";var out=(mbl)?"touchend":"mouseout";arc.addEventListener(over,function(e){showTooltip(id,e,op)});arc.addEventListener(out,function(){setTimeout(function(){if(!that.csstoolRock){hideTooltip(id)}},500)});arc.addEventListener("dblclick",function(){if(that.csstoolRock){that.csstoolRock=false}else{that.csstoolRock=true}})}return el},css_ring:function(op){op.classStr="css-ring";if(this.type!=="scatter"){op.borderColor=op.borderColor||this.colorSet[op.row]}this._css_arc(op)},css_maru:function(op){op.classStr="css-maru";if(this.type!=="scatter"){op.bgColor=op.bgColor||this.colorSet[op.row]}this._css_arc(op)},css_lineTo:function(op){op.classStr="css_lineTo";op.bgColor=op.bgColor||this.colorSet[op.row]},deleteCssRule:function(selectorText){for(var i=0;i<this.hybridCss.cssRules.length;i++){if(this.hybridCss.cssRules[i].selectorText===selectorText){this.hybridCss.deleteRule(i)}}}}})(window);window.ccchart.m.Theme={aboutThis_module:{name:"Theme",varsion:"0.01",create:20131224,dependent:"ccchart-v1.08.1",writer:"Toshiro Takahashi @toshirot"},white:{config:{bg:"#fff",colorSet:["red","#FF9114","#3CB000","#00A8A2","#0036C0","#C328FF","#FF34C0"],xColor:"rgba(180,180,180,0.3)",yColor:"rgba(180,180,180,0.3)",textColors:{title:"#777",subTitle:"#777",x:"#999",y:"#999",hanrei:"#777",unit:"#777",memo:"#666"},shadows:{hanrei:["#ccc",5,5,5],xline:["#ccc",7,7,5],line:["#ccc",5,5,5],bar:["#ccc",5,5,5],stacked:["#ccc",5,-5,5],stackedarea:["#ccc",5,5,5],bezi:["#ccc",5,5,5],bezi2:["#ccc",5,5,5]}}},black:{config:{bg:"#000",colorSet:["red","#FF9114","#3CB000","#00A8A2","#0036C0","#C328FF","#FF34C0"],xColor:"rgba(180,180,180,0.6)",yColor:"rgba(180,180,180,0.6)",textColors:{title:"#777",subTitle:"#777",x:"#999",y:"#999",hanrei:"#777",unit:"#777",memo:"#666"},shadows:{hanrei:["#222",5,5,5],xline:["#222",7,7,5],line:["#222",5,5,5],bar:["#222",5,5,5],stacked:["#222",5,-5,5],stackedarea:["#222",5,5,5],bezi:["#222",5,5,5],bezi2:["#222",5,5,5],scatter:["#222",5,5,5],pie:["#222",5,5,5]}}},_default:{config:{lineWidth:2,bgGradient:{direction:"vertical",from:"#687478",to:"#222"},xColor:"rgba(180,180,180,0.3)",yColor:"rgba(180,180,180,0.3)",colorSet:["red","#FF9114","#3CB000","#00A8A2","#0036C0","#C328FF","#FF34C0"],textColors:{title:"#ccc",subTitle:"#ddd",x:"#aaa",y:"#aaa",hanrei:"#ccc",unit:"#aaa",memo:"#ccc"},shadows:{hanrei:["#222",5,5,5],xline:["#444",7,7,5],line:["#222",5,5,5],bar:["#222",5,5,5],stacked:["#222",5,-5,5],stackedarea:["#222",5,5,5],bezi:["#222",5,5,5],bezi2:["#222",5,5,5],scatter:["#222",5,5,5],pie:["#222",5,5,5]}}},set:function(a){var b=ccchart.util.cnfExtend(this.white);b.config.bg=a;return b}};window.ccchart.m.MyTest={aboutThis_module:{name:"MyTest",varsion:"0.01",create:20140101,update:20140101,dependent:"ccchart-v1.08+",howtouse:"",demo:"http://ccchart.org/test/module/test-1.htm",Author:"Toshiro Takahashi @toshirot"},mytest:{log:function(a){console.log(a)},alert:function(a){alert(a)}}};