/*
Copyright DHTMLX LTD. http://www.dhtmlx.com
You allowed to use this component or parts of it under GPL terms
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
*/
window.dhtmlx||(dhtmlx={});dhtmlx.version="3.0";dhtmlx.codebase="./";dhtmlx.extend=function(a,b){for(var c in b)a[c]=b[c];b.k&&a.k();return a};
dhtmlx.proto_extend=function(){for(var a=arguments,b=a[0],c=[],d=a.length-1;d>0;d--){if(typeof a[d]=="function")a[d]=a[d].prototype;for(var e in a[d])if(e=="_init")c.push(a[d][e]);else b[e]||(b[e]=a[d][e])}a[0].k&&c.push(a[0].k);b.k=function(){for(var g=0;g=0)this.splice(a,b||1)},remove:function(a){this.removeAt(this.find(a))},insertAt:function(a,b){if(!b&&b!==0)this.push(a);else{var c=this.splice(b,this.length-b);this[b]=a;this.push.apply(this,c)}},find:function(a){for(i=0;i0;){str=this.fb[a%16]+str;a=Math.floor(a/16)}for(;str.length")},addSector:function(a,b,c,d,e,f,g){var i=[];i.push(d);i.push(Math.floor(e*g));for(var j=b;j"+this.s.join("\n")+"";a.v=b;this.s=[]}};
dhtmlx.chart={};
dhtmlx.chart.area={pvt_render_area:function(a,b,c,d,e,f){var g=this.C(a,b,c,d,e),i=Math.floor(g.cellWidth/2);if(b.length){a.globalAlpha=this.e.alpha.call(this,b[0]);a.fillStyle=this.e.color.call(this,b[0]);var j=this.p(b[0],c,d,g),k=this.e.offset?c.x+g.cellWidth*0.5:c.x;a.beginPath();a.moveTo(k,d.y);a.lineTo(k,j);f.addRect(b[0].id,[k-i,j-i,k+i,j+i]);this.e.yAxis||this.renderTextAt(false,!this.e.offset?false:true,k,j-this.e.labelOffset,this.e.label(b[0]));for(var h=1;h=0;l--){n=h+Math.floor(g.cellWidth*l)-0.5;var s=b[l].$startY;a.lineTo(n,s)}else a.lineTo(h+Math.floor(g.cellWidth*(length-1))-0.5,k);a.lineTo(h,k);a.fill();for(l=0;l=1;h--)e[h]=(d[h]-
b[h]*e[h+1])/c[h];f=[];g=[];i=[];j=[];for(h=0;hn)q=n/this.h.length-4;var v=Math.floor((n-q*this.h.length)/2),p=typeof this.e.radius!="undefined"?parseInt(this.e.radius,
10):Math.round(q/5),u=false,r=this.e.gradient;if(r&&typeof r!="function"){u=r;r=false}else if(r){r=a.createLinearGradient(c.x,c.y,d.x,c.y);this.e.gradient(r)}m||this.i(a,c.x-0.5,c.y,c.x-0.5,d.y,"#000000",1);for(d=0;dg)w=g;w-=i;w*=j;var x=c.x,y=c.y+v+d*n+(q+1)*e;if(w<0||this.e.yAxis&&w===0)this.renderTextAt("middle",true,x+10,y+q/2+v,this.e.label(b[d]));else{m||(w+=t/s);var B=r||this.e.color.call(this,b[d]);if(this.e.border){a.beginPath();a.fillStyle=
B;this.o(a,x,y,q,p,s,w,0);a.lineTo(x,0);a.fill();a.fillStyle="#000000";a.globalAlpha=0.37;a.beginPath();this.o(a,x,y,q,p,s,w,0);a.fill()}a.globalAlpha=this.e.alpha.call(this,b[d]);a.fillStyle=r||this.e.color.call(this,b[d]);a.beginPath();var z=this.o(a,x,y,q,p,s,w,this.e.border?1:0);if(r&&!u)a.lineTo(c.x+h,y+(this.e.border?1:0));a.fill();a.globalAlpha=1;if(u!=false){var A=this.G(a,c.x,y+q,c.x+s*w+2,y,u,B,"x");a.fillStyle=A.gradient;a.beginPath();z=this.o(a,x,y+A.offset,q-A.offset*2,p,s,w,A.offset);
a.fill();a.globalAlpha=1}this.renderTextAt("middle",false,z[0]+3,parseInt(y+(z[1]-y)/2,10),this.e.label(b[d]));f.addRect(b[d].id,[x,y,z[0],z[1]],e)}}},o:function(a,b,c,d,e,f,g,i){var j=0;if(e>f*g){var k=(e-f*g)/e;j=-Math.asin(k)+Math.PI/2}a.moveTo(b,c+i);var h=b+f*g-e-(e?0:i);el)k=l-4;var s=Math.floor((l-k)/2),t=0,q=false,v=this.e.gradient;q=false;if(v=this.e.gradient)q=true;m||this.i(a,c.x-0.5,c.y,
c.x-0.5,d.y,"#000000",1);for(d=0;dg)p=g;p-=i;p*=j;var u=c.x,r=c.y+s+d*l;if(e)u=b[d].$startX;if(p<0||this.e.yAxis&&p===0)this.renderTextAt("middle",true,u+10,r+k/2,this.e.label(b[d]));else{m||(p+=o/n);var w=this.e.color.call(this,b[d]);if(this.e.border){a.beginPath();a.fillStyle=w;this.o(a,u,r,k,t,n,p,0);a.lineTo(u,0);a.fill();a.fillStyle="#000000";a.globalAlpha=0.37;a.beginPath();this.o(a,u,r,k,t,n,p,0);a.fill()}a.globalAlpha=
1;a.globalAlpha=this.e.alpha.call(this,b[d]);a.fillStyle=this.e.color.call(this,b[d]);a.beginPath();var x=this.o(a,u,r,k,t,n,p,this.e.border?1:0);if(v&&!q)a.lineTo(c.x+h,r+(this.e.border?1:0));a.fill();if(q!=false){w=this.G(a,u,r+k,u,r,q,w,"x");a.fillStyle=w.gradient;a.beginPath();x=this.o(a,u,r,k,t,n,p,0);a.fill();a.globalAlpha=1}this.renderTextAt("middle",true,b[d].$startX+(x[0]-b[d].$startX)/2-1,r+(x[1]-r)/2,this.e.label(b[d]));f.addRect(b[d].id,[b[d].$startX,r,x[0],x[1]],e);b[d].$startX=x[0]}}}};
dhtmlx.chart.stackedBar={pvt_render_stackedBar:function(a,b,c,d,e,f){var g,i,j,k=d.y-c.y;j=!!this.e.yAxis;var h=!!this.e.xAxis;i=this.Q(b);g=i.max;i=i.min;var m=Math.floor((d.x-c.x)/b.length);e||this.N(a,b,c,d,i,g,m);if(j){g=parseFloat(this.e.yAxis.end);i=parseFloat(this.e.yAxis.start)}g=this.z(i,g);j=g[0];g=g[1];j=j?k/j:10;var l=parseInt(this.e.width,10);if(l+4>m)l=m-4;var n=Math.floor((m-l)/2),o=this.e.gradient?this.e.gradient:false;h||this.i(a,c.x,d.y+0.5,d.x,d.y+0.5,"#000000",1);for(h=0;hf)d=b.y;if(a10?f.unit:10;f.unit=
a?(f.totalHeight-f.startValue)/a:10}return f}};
dhtmlx.chart.bar={pvt_render_bar:function(a,b,c,d,e,f){var g,i,j,k,h=d.y-c.y,m=!!this.e.yAxis,l=!!this.e.xAxis;i=this.O();g=i.max;i=i.min;var n=Math.floor((d.x-c.x)/b.length);!e&&!(this.e.origin!="auto"&&!m)&&this.N(a,b,c,d,i,g,n);if(m){g=parseFloat(this.e.yAxis.end);i=parseFloat(this.e.yAxis.start)}j=this.z(i,g);k=j[0];j=j[1];var o=k?h/k:k;if(!m&&!(this.e.origin!="auto"&&l)){var s=10;o=k?(h-s)/k:s}!e&&this.e.origin!="auto"&&!m&&this.e.origin>i&&this.da(a,b,c,d,n,d.y-o*(this.e.origin-i));h=parseInt(this.e.width,
10);if(this.h&&h*this.h.length+4>n)h=n/this.h.length-4;k=Math.floor((n-h*this.h.length)/2);var t=typeof this.e.radius!="undefined"?parseInt(this.e.radius,10):Math.round(h/5),q=false,v=this.e.gradient;if(v&&typeof v!="function"){q=v;v=false}else if(v){v=a.createLinearGradient(0,d.y,0,c.y);this.e.gradient(v)}l||this.i(a,c.x,d.y+0.5,d.x,d.y+0.5,"#000000",1);for(var p=0;pg)u=g;u-=i;u*=j;var r=c.x+k+p*n+(h+1)*e,w=d.y;if(u<0||this.e.yAxis&&u===0&&
!(this.e.origin!="auto"&&this.e.origin>i))this.renderTextAt(true,true,r+Math.floor(h/2),w,this.e.label(b[p]));else{if(!m&&!(this.e.origin!="auto"&&l))u+=s/o;var x=v||this.e.color.call(this,b[p]);this.e.border&&this.va(a,r,w,h,i,t,o,u,x);a.globalAlpha=this.e.alpha.call(this,b[p]);var y=this.ua(a,c,r,w,h,i,t,o,u,x,v,q);a.globalAlpha=1;q&&this.wa(a,r,w,h,i,t,o,u,x,q);y[0]!=r?this.renderTextAt(false,true,r+Math.floor(h/2),y[1],this.e.label(b[p])):this.renderTextAt(true,true,r+Math.floor(h/2),y[3],this.e.label(b[p]));
f.addRect(b[p].id,[r,y[3],y[2],y[1]],e)}}},K:function(a,b,c,d,e,f,g){var i=this.e.xAxis,j=c;if(i&&this.e.origin!="auto"&&this.e.origin>g){c-=(this.e.origin-g)*e;j=c;d-=this.e.origin-g;if(d<0){d*=-1;a.translate(b+f,c);a.rotate(Math.PI);c=b=0}c-=0.5}return{value:d,x0:b,y0:c,start:j}},ua:function(a,b,c,d,e,f,g,i,j,k,h,m){a.save();a.fillStyle=k;var l=this.K(a,c,d,j,i,e,f);e=this.H(a,l.x0,l.y0,e,g,i,l.value,this.e.border?1:0);if(h&&!m)a.lineTo(l.x0+(this.e.border?1:0),b.y);a.fill();a.restore();a=l.x0;
b=l.x0!=c?c+e[0]:e[0];d=l.x0!=c?l.start-e[1]:d;c=l.x0!=c?l.start:e[1];return[a,d,b,c]},va:function(a,b,c,d,e,f,g,i,j){a.save();b=this.K(a,b,c,i,g,d,e);a.fillStyle=j;this.H(a,b.x0,b.y0,d,f,g,b.value,0);a.lineTo(b.x0,0);a.fill();a.fillStyle="#000000";a.globalAlpha=0.37;this.H(a,b.x0,b.y0,d,f,g,b.value,0);a.fill();a.restore()},wa:function(a,b,c,d,e,f,g,i,j,k){a.save();b=this.K(a,b,c,i,g,d,e);j=this.G(a,b.x0,b.y0,b.x0+d,b.y0-g*b.value+2,k,j,"y");a.fillStyle=j.gradient;this.H(a,b.x0+j.offset,b.y0,d-j.offset*
2,f,g,b.value,j.offset);a.fill();a.restore()},H:function(a,b,c,d,e,f,g,i){a.beginPath();var j=0;if(e>f*g){var k=(e-f*g)/e;j=-Math.acos(k)+Math.PI/2}a.moveTo(b+i,c);var h=c-Math.floor(f*g)+e+(e?0:i);e=0||d>=0&&e<=Math.PI||d<=Math.PI&&e>=Math.PI){if(d<=0&&e>=0){d=0;g=false;this.ca(a,b,c,f,d,e)}if(d<=Math.PI&&e>=Math.PI){e=Math.PI;g=false;this.ca(a,b,c,f,d,e)}var i=
(this.e.height||Math.floor(f/4))/this.e.cant;a.beginPath();a.arc(b,c,f,d,e,false);a.lineTo(b+f*Math.cos(e),c+f*Math.sin(e)+i);a.arc(b,c+i,f,e,d,true);a.lineTo(b+f*Math.cos(d),c+f*Math.sin(d));a.fill();g&&a.stroke()}},ca:function(a,b,c,d,e,f){a.beginPath();a.arc(b,c,d,e,f,false);a.stroke()},sa:function(a,b,c,d){for(var e=["#676767","#7b7b7b","#a0a0a0","#bcbcbc","#d1d1d1","#d6d6d6"],f=e.length-1;f>-1;f--){a.beginPath();a.fillStyle=e[f];a.arc(b+2,c+2,d+f,0,Math.PI*2,true);a.fill()}},Fa:function(a){a.addColorStop(0,
"#ffffff");a.addColorStop(0.7,"#7a7a7a");a.addColorStop(1,"#000000");return a},bb:function(a,b,c,d,e,f){a.globalAlpha=0.3;a.beginPath();var g;if(typeof this.e.gradient!="function"){g=a.createRadialGradient(e,f,d/4,b,c,d);g=this.Fa(g)}else g=this.e.gradient(g);a.fillStyle=g;a.arc(b,c,d,0,Math.PI*2,true);a.fill();a.globalAlpha=1},ba:function(a,b,c,d,e,f,g,i){var j=this.renderText(0,0,g,0,1);if(j){var k=j.scrollWidth;j.style.width=k+"px";if(k>a)k=a;var h=8;if(i)h=k/1.8;var m=d+(e-d)/2;c-=(h-8)/2;var l=
-h,n=-8,o="left";if(m>=Math.PI/2&&m=Math.PI){l=-k-l+1;o="right"}d=(b+Math.floor(c*Math.sin(m)))*f+n;h=a+Math.floor((c+h/2)*Math.cos(m))+l;var s=eb*f)d+=this.e.height||Math.floor(c/4);j.style.top=d+"px";j.style.left=h+"px";j.style.width=k+"px";j.style.textAlign=o;j.style.whiteSpace="nowrap"}}};
dhtmlx.chart.pie3D={pvt_render_pie3D:function(a,b,c,d,e,f){this.na(a,b,c,d,this.e.cant,f)}};
dhtmlx.Template={J:{},empty:function(){return""},setter:function(a,b){return dhtmlx.Template.fromHTML(b)},obj_setter:function(a,b){var c=dhtmlx.Template.setter(a,b),d=this;return function(){return c.apply(d,arguments)}},fromHTML:function(a){if(typeof a=="function")return a;if(this.J[a])return this.J[a];a=(a||"").toString();a=a.replace(/[\r\n]+/g,"\\n");a=a.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,'"+(obj.$1?"$2":"$3")+"');a=a.replace(/\{common\.([^}\(]*)\}/g,'"+common.$1+"');a=a.replace(/\{common\.([^\}\(]*)\(\)\}/g,
'"+(common.$1?common.$1(obj):"")+"');a=a.replace(/\{obj\.([^}]*)\}/g,'"+obj.$1+"');a=a.replace(/#([a-z0-9_]+)#/gi,'"+obj.$1+"');a=a.replace(/\{obj\}/g,'"+obj+"');a=a.replace(/\{-obj/g,"{obj");a=a.replace(/\{-common/g,"{common");a='return "'+a+'";';return this.J[a]=Function("obj","common",a)}};
dhtmlx.Type={add:function(a,b){if(!a.types&&a.prototype.types)a=a.prototype;var c=b.name||"default";this.T(b);this.T(b,"edit");this.T(b,"loading");a.types[c]=dhtmlx.extend(dhtmlx.extend({},a.types[c]||this.ta),b);return c},ta:{css:"default",template:function(){return""},template_edit:function(){return""},template_loading:function(){return"..."},width:150,height:80,margin:5,padding:0},T:function(a,b){b="template"+(b?"_"+b:"");var c=a[b];if(c&&typeof c=="string"){if(c.indexOf("->")!=-1){c=c.split("->");
switch(c[0]){case "html":c=dhtmlx.html.getValue(c[1]).replace(/\"/g,'\\"');break;case "http":c=(new dhtmlx.ajax).sync().get(c[1],{uid:(new Date).valueOf()}).responseText;break;default:break}}a[b]=dhtmlx.Template.fromHTML(c)}}};
dhtmlx.SingleRender={k:function(){},eb:function(a){return this.type.Oa(a,this.type)+this.type.template(a,this.type)+this.type.Na},render:function(){if(!this.callEvent||this.callEvent("onBeforeRender",[this.data])){if(this.data)this.L.innerHTML=this.eb(this.data);this.callEvent&&this.callEvent("onAfterRender",[])}}};
dhtmlx.ui.Tooltip=function(a){this.name="Tooltip";this.version="3.0";if(typeof a=="string")a={template:a};dhtmlx.extend(this,dhtmlx.Settings);dhtmlx.extend(this,dhtmlx.SingleRender);this.B(a,{type:"default",dy:0,dx:20});this.L=this.g=document.createElement("DIV");this.g.className="dhx_tooltip";dhtmlx.html.insertBefore(this.g,document.body.firstChild)};
dhtmlx.ui.Tooltip.prototype={show:function(a,b){if(!this.Z){if(this.data!=a){this.data=a;this.render(a)}this.g.style.top=b.y+this.e.dy+"px";this.g.style.left=b.x+this.e.dx+"px";this.g.style.display="block"}},hide:function(){this.data=null;this.g.style.display="none"},disable:function(){this.Z=true},enable:function(){this.Z=false},types:{"default":dhtmlx.Template.fromHTML("{obj.id}")},template_item_start:dhtmlx.Template.empty,template_item_end:dhtmlx.Template.empty};
dhtmlx.AutoTooltip={tooltip_setter:function(a,b){var c=new dhtmlx.ui.Tooltip(b);this.attachEvent("onMouseMove",function(d,e){c.show(this.get(d),dhtmlx.html.pos(e))});this.attachEvent("onMouseOut",function(){c.hide()});this.attachEvent("onMouseMoving",function(){c.hide()});return c}};dhtmlx.DataStore=function(){this.name="DataStore";dhtmlx.extend(this,dhtmlx.EventSystem);this.setDriver("xml");this.pull={};this.order=dhtmlx.toArray();this.gb=false};
dhtmlx.DataStore.prototype={setDriver:function(a){this.driver=dhtmlx.DataDriver[a]},qa:function(a){if(a.item){if(!(a.item instanceof Array))a.item=[a.item];for(var b=0;bb){var c=b;b=a;a=c}}else{a=this.min||0;b=Math.min(this.max||Infinity,this.dataCount()-1)}return this.getIndexRange(a,b)},getIndexRange:function(a,b){b=Math.min(b,this.dataCount()-1);var c=dhtmlx.toArray();for(a=a;a<=b;a++)c.push(this.get(this.order[a]));return c},dataCount:function(){return this.order.length},exists:function(a){return!!this.pull[a]},move:function(a,b){if(!(a<0||b<0)){var c=this.idByIndex(a),d=this.get(c);this.order.removeAt(a);this.order.insertAt(c,
Math.min(this.order.length,b));this.callEvent("onStoreUpdated",[c,d,"move"])}},add:function(a,b){var c=this.id(a),d=this.dataCount();if(dhtmlx.isNotDefined(b)||b<0)b=d;if(b>d)b=Math.min(this.order.length,b);if(this.callEvent("onbeforeAdd",[c,b])){if(this.exists(c))return null;this.pull[c]=a;this.order.insertAt(c,b);if(this.m){var e=this.m.length;if(!b&&this.order.length)e=0;this.m.insertAt(c,e)}this.callEvent("onafterAdd",[c,b]);this.callEvent("onStoreUpdated",[c,a,"add"]);return c}},remove:function(a){if(a instanceof
Array)for(var b=0;bb?1:ab?1:ab?1:ac)c=a(d)*1});return c},cb:function(a){var b=function(j,k){j=dhtmlx.Template.setter(0,j);return j(k[0])},c=dhtmlx.Template.setter(0,a.by);a.map[c]||(a.map[c]=[c,b]);var d={},e=[];this.data.each(function(j){var k=c(j);
if(!d[k]){e.push({id:k});d[k]=dhtmlx.toArray()}d[k].push(j)});for(var f in a.map){var g=a.map[f][1]||b;if(typeof g!="function")g=this[g];for(var i=0;i5?10:5;c=parseInt(i,10)*g;if(c>Math.abs(a))d=a<0?-c:0;else{var j=Math.abs(a),k=Math.floor(this.ga(j)),h=j/Math.pow(10,k);d=Math.ceil(h*10)/10*Math.pow(10,k)-c;if(a<0)d=-d-2*c}for(e=d;e1)for(var d=1;db)b=e;if(fb)b=a[d].$sum;if(a[d].$min0)c=0}return{max:b,min:c}},G:function(a,b,c,d,e,f,g,i){if(f=="light"){a=i=="x"?a.createLinearGradient(b,c,d,c):a.createLinearGradient(b,c,b,e);a.addColorStop(0,"#FFFFFF");a.addColorStop(0.9,g);a.addColorStop(1,g);g=2}else{a.globalAlpha=0.37;g=0;a=i=="x"?a.createLinearGradient(b,e,b,c):a.createLinearGradient(b,c,d,c);a.addColorStop(0,"#000000");a.addColorStop(0.5,
"#FFFFFF");a.addColorStop(0.6,"#FFFFFF");a.addColorStop(1,"#000000")}return{gradient:a,offset:g}}};dhtmlx.compat("layout");