/* Copyright 2012 Beta Cubed. All rights reserved. Polychart.js charting library. This library uses the following projects. JSON2.js d3.js underscore.js underscore.string.js raphael.js */ var gg=function(){function zf(a){for(var b=-1,c=a.length,d=[];++barguments.length)return g&& g.on;g&&(g.on=null,c=c.slice(0,k=c.indexOf(g)).concat(c.slice(k+1)),d.remove(b));f&&c.push(d.set(b,{on:f}));return a};return b}function Ud(a,b){return b-(a?1+Math.floor(Math.log(a+Math.pow(10,1+Math.floor(Math.log(a)/Math.LN10)-b))/Math.LN10):1)}function Ef(a){return a+""}function Vd(a){for(var b=a.lastIndexOf("."),c=0<=b?a.substring(b):(b=a.length,""),d=[];0b?a(2*b):2-a(2-2*b))}}function Pc(a){return a}function Qc(a){return function(b){return Math.pow(b,a)}}function Ff(a){return 1-Math.cos(a*Math.PI/2)}function Gf(a){return Math.pow(2,10*(a-1))}function Hf(a){return 1-Math.sqrt(1-a*a)}function If(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375}function Jf(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return(c-a)*b}}function Kf(a,b){b=b-(a=+a)?1/(b-a):0; return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function ib(a,b,c){return new rb(a,b,c)}function rb(a,b,c){this.r=a;this.g=b;this.b=c}function Hb(a){return 16>a?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function Rc(a,b,c){var d=0,e=0,f=0,g,k;if(g=/([a-z]+)\((.*)\)/i.exec(a))switch(k=g[2].split(","),g[1]){case "hsl":return c(parseFloat(k[0]),parseFloat(k[1])/100,parseFloat(k[2])/100);case "rgb":return b(Sc(k[0]),Sc(k[1]),Sc(k[2]))}if(c=jc.get(a))return b(c.r,c.g,c.b);null!= a&&"#"===a.charAt(0)&&(4===a.length?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):7===a.length&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function Yd(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g=(e+d)/2;f?(d=0.5>g?f/(e+d):f/(2-e-d),a=60*(a==e?(b-c)/f+(ba&&(a+=360);return 60>a?e+(f-e)*a/60:180>a?f:240>a?e+(f-e)*(240-a)/60:e}var e,f;a%=360;0>a&&(a+=360);b=0>b?0:1c?0:1=c?c*(1+b):c+b-c*b;e=2*c-f;return ib(Math.round(255*d(a+120)),Math.round(255*d(a)),Math.round(255*d(a-120)))}function Lf(a){return la(a,Mf).join(",")}function Mf(a){return/[",\n]/.test(a)?'"'+a.replace(/\"/g, '""')+'"':a}function Tc(a){var b=a[0];a=a[a.length-1];return b=d?e*=10:0.35>=d?e*=5:0.75>=d&&(e*=2);c[0]=Math.ceil(c[0]/e)*e;c[1]=Math.floor(c[1]/e)*e+0.5*e;c[2]=e;return c}function Vc(a,b){return j.range.apply(j,be(a,b))}function Wc(a,b){return j.format(",."+ Math.max(0,-Math.floor(Math.log(be(a,b)[2])/Math.LN10+0.01))+"f")}function Pf(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function Of(a,b,c,d){var e=[],f=[],g=0,k=Math.min(a.length,b.length)-1;a[k]e[0]?lc:Xc;d=b.pow;a.domain(la(e,b));return c};c.nice=function(){a.domain(Uc(a.domain(),Nf));return c};c.ticks=function(){var c=Tc(a.domain()),f=[];if(c.every(isFinite)){var g=Math.floor(c[0]),k=Math.ceil(c[1]),p=d(c[0]),c=d(c[1]);if(b===lc)for(f.push(d(g));g++F;F++)f.push(d(g)*F);f.push(d(g))}for(g=0;f[g]c;k--);f=f.slice(g,k)}return f}; c.tickFormat=function(a,f){2>arguments.length&&(f=Qf);if(1>arguments.length)return f;var g=a/c.ticks().length,k=b===lc?(p=-1E-12,Math.floor):(p=1E-12,Math.ceil),p;return function(a){return a/d(k(b(a)+p))a?0:a)/Math.LN10}function lc(a){return-Math.log(0b?-Math.pow(-b,a):Math.pow(b,a)}}function ee(a,b){function c(b){return f[((e.get(b)||e.set(b,a.push(b)))-1)%f.length]} function d(b,c){return la(j.range(a.length),function(a){return b+c*a})}var e,f,g;c.domain=function(d){if(!arguments.length)return a;a=[];e=new Tb;for(var f=-1,g=d.length,h;++farguments.length&&(p=0);var F=e[0],h=e[1],n=(h-F)/(a.length-1+p);f=d(2>a.length?(F+h)/2:F+n*p/2,n);g=0;b={t:"rangePoints",x:e,p:p};return c};c.rangeBands= function(e,p){2>arguments.length&&(p=0);var F=e[1]arguments.length&&(p=0);var F=e[1]=k)return-1;e=b.charCodeAt(f++);if(37==e){if(e=Rf[b.charAt(f++)],!e||0>(d=e(a,c,d)))return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function ie(a,b,c){pa.lastIndex=0;return(b=pa.exec(b.substring(c,c+2)))?(a.d=+b[0],c+b[0].length):-1}function je(a,b,c){pa.lastIndex=0;return(b=pa.exec(b.substring(c, c+2)))?(a.H=+b[0],c+b[0].length):-1}function Yc(a){return a.toISOString()}function ub(a,b,c){function d(b){var c=a(b),d=f(c,1);return b-c=d.computed&&(d={value:a,computed:e})});return d.value};s.min=function(a,b,c){if(!b&&s.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!b&&s.isEmpty(a))return Infinity;var d={computed:Infinity};t(a,function(a,e,f){e=b?b.call(c,a,e,f):a;ed?1:0}),"value")};s.groupBy=function(a,b){var c={},d=s.isFunction(b)?b:function(a){return a[b]};t(a,function(a,b){var e=d(a,b);(c[e]||(c[e]=[])).push(a)});return c};s.sortedIndex=function(a,b,c){c||(c=s.identity);for(var d=0,e=a.length;d>1;c(a[f])a.length&&(b=!0);s.reduce(c,function(c,e,f){if(b?s.last(c)!==e||!c.length:!s.include(c,e))c.push(e),d.push(a[f]);return c},[]);return d};s.union=function(){return s.uniq(s.flatten(arguments,!0))};s.intersection=s.intersect=function(a){var b=g.call(arguments,1);return s.filter(s.uniq(a),function(a){return s.every(b,function(b){return 0<= s.indexOf(b,a)})})};s.difference=function(a){var b=s.flatten(g.call(arguments,1),!0);return s.filter(a,function(a){return!s.include(b,a)})};s.zip=function(){for(var a=g.call(arguments),b=s.max(s.pluck(a,"length")),c=Array(b),d=0;d=arguments.length&&(b=a||0,a=0);c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=Array(d);e=a?b():function(){if(1>--a)return b.apply(this,arguments)}};s.keys=q||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],c;for(c in a)s.has(a,c)&&(b[b.length]=c);return b}; s.values=function(a){return s.map(a,s.identity)};s.functions=s.methods=function(a){var b=[],c;for(c in a)s.isFunction(a[c])&&b.push(c);return b.sort()};s.extend=function(a){t(g.call(arguments,1),function(b){for(var c in b)a[c]=b[c]});return a};s.defaults=function(a){t(g.call(arguments,1),function(b){for(var c in b)null==a[c]&&(a[c]=b[c])});return a};s.clone=function(a){return!s.isObject(a)?a:s.isArray(a)?a.slice():s.extend({},a)};s.tap=function(a,b){b(a);return a};s.isEqual=function(b,c){return a(b, c,[])};s.isEmpty=function(a){if(null==a)return!0;if(s.isArray(a)||s.isString(a))return 0===a.length;for(var b in a)if(s.has(a,b))return!1;return!0};s.isElement=function(a){return!!(a&&1==a.nodeType)};s.isArray=f||function(a){return"[object Array]"==p.call(a)};s.isObject=function(a){return a===Object(a)};s.isArguments=function(a){return"[object Arguments]"==p.call(a)};s.isArguments(arguments)||(s.isArguments=function(a){return!(!a||!s.has(a,"callee"))});s.isFunction=function(a){return"[object Function]"== p.call(a)};s.isString=function(a){return"[object String]"==p.call(a)};s.isNumber=function(a){return"[object Number]"==p.call(a)};s.isNaN=function(a){return a!==a};s.isBoolean=function(a){return!0===a||!1===a||"[object Boolean]"==p.call(a)};s.isDate=function(a){return"[object Date]"==p.call(a)};s.isRegExp=function(a){return"[object RegExp]"==p.call(a)};s.isNull=function(a){return null===a};s.isUndefined=function(a){return void 0===a};s.has=function(a,b){return F.call(a,b)};s.noConflict=function(){b._= c;return this};s.identity=function(a){return a};s.times=function(a,b,c){for(var d=0;d/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};s.result=function(a,b){if(null==a)return null;var c=a[b];return s.isFunction(c)?c.call(a):c};s.mixin=function(a){t(s.functions(a),function(b){var c=s[b]=a[b];I.prototype[b]=function(){var a=g.call(arguments);k.call(a,this._wrapped); return Y(c.apply(s,a),this._chain)}})};var C=0;s.uniqueId=function(a){var b=C++;return a?a+b:b};s.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var E=/.^/,B={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},D;for(D in B)B[B[D]]=D;var G=/\\|'|\r|\n|\t|\u2028|\u2029/g,K=/\\(\\|'|r|n|t|u2028|u2029)/g,J=function(a){return a.replace(K,function(a,b){return B[b]})};s.template=function(a,b){var c=s.templateSettings,c="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+ a.replace(G,function(a){return"\\"+B[a]}).replace(c.escape||E,function(a,b){return"',\n_.escape("+J(b)+"),\n'"}).replace(c.interpolate||E,function(a,b){return"',\n"+J(b)+",\n'"}).replace(c.evaluate||E,function(a,b){return"');\n"+J(b)+"\n;__p.push('"})+"');\n}\nreturn __p.join('');",d=new Function("obj","_",c);if(b)return d(b,s);var e=function(a){return d.call(this,a,s)};e.source="function(obj){\n"+c+"\n}";return e};s.chain=function(a){return s(a).chain()};var I=function(a){this._wrapped=a};s.prototype= I.prototype;var Y=function(a,b){return b?s(a).chain():a};s.mixin(s);t("pop push reverse shift sort splice unshift".split(" "),function(a){var b=e[a];I.prototype[a]=function(){var c=this._wrapped;b.apply(c,arguments);var d=c.length;("shift"==a||"splice"==a)&&0===d&&delete c[0];return Y(c,this._chain)}});t(["concat","join","slice"],function(a){var b=e[a];I.prototype[a]=function(){return Y(b.apply(this._wrapped,arguments),this._chain)}});I.prototype.chain=function(){this._chain=!0;return this};I.prototype.value= function(){return this._wrapped}}).call(this);var me=String.prototype.trim,ne=String.prototype.trimRight,oe=String.prototype.trimLeft,Jb=function(a,b,c){a+="";b=~~b;for(var d=[];0",quot:'"',apos:"'",amp:"&"},pe={},dd;for(dd in rc)pe[rc[dd]]=dd;var Ub,ed=function(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()},Ya=function(){Ya.cache.hasOwnProperty(arguments[0])|| (Ya.cache[arguments[0]]=Ya.parse(arguments[0]));return Ya.format.call(null,Ya.cache[arguments[0]],arguments)};Ya.format=function(a,b){var c=1,d=a.length,e="",f=[],g,k,p,F;for(g=0;g]+>/g, "")},capitalize:function(a){a+="";return a.charAt(0).toUpperCase()+a.substring(1)},chop:function(a,b){a+="";b=~~b||a.length;for(var c=[],d=0;d"']/g,function(a){return"&"+pe[a]+";"})},unescapeHTML:function(a){return(""+a).replace(/\&([^;]+);/g,function(a, c){var d;return c in rc?rc[c]:(d=c.match(/^#x([\da-fA-F]+)$/))?String.fromCharCode(parseInt(d[1],16)):(d=c.match(/^#(\d+)$/))?String.fromCharCode(~~d[1]):a})},escapeRegExp:function(a){return a.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")},insert:function(a,b,c){a=K.chars(a);a.splice(~~b,0,""+c);return a.join("")},include:function(a,b){return!!~(""+a).indexOf(b)},join:function(){var a=Array.prototype.slice.call(arguments);return a.join(a.shift())},lines:function(a){return(""+a).split("\n")},reverse:function(a){return K.chars(a).reverse().join("")}, splice:function(a,b,c,d){a=K.chars(a);a.splice(~~b,~~c,d);return a.join("")},startsWith:function(a,b){a+="";b+="";return a.length>=b.length&&a.substring(0,b.length)===b},endsWith:function(a,b){a+="";b+="";return a.length>=b.length&&a.substring(a.length-b.length)===b},succ:function(a){a+="";var b=K.chars(a);b.splice(a.length-1,1,String.fromCharCode(a.charCodeAt(a.length-1)+1));return b.join("")},titleize:function(a){return(""+a).replace(/\b./g,function(a){return a.toUpperCase()})},camelize:function(a){return K.trim(a).replace(/[-_\s]+(.)?/g, function(a,c){return c&&c.toUpperCase()})},underscored:function(a){return K.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(a){return K.trim(a).replace(/[_\s]+/g,"-").replace(/([A-Z])/g,"-$1").replace(/-+/g,"-").toLowerCase()},classify:function(a){return K.titleize((a+"").replace(/_/g," ")).replace(/\s/g,"")},humanize:function(a){return K.capitalize(this.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:function(a,b){a+="";if(!b&&me)return me.call(a); b=qc(b);return a.replace(RegExp("^"+b+"+|"+b+"+$","g"),"")},ltrim:function(a,b){a+="";if(!b&&oe)return oe.call(a);b=qc(b);return a.replace(RegExp("^"+b+"+"),"")},rtrim:function(a,b){a+="";if(!b&&ne)return ne.call(a);b=qc(b);return a.replace(RegExp(b+"+$"),"")},truncate:function(a,b,c){a+="";b=~~b;return a.length>b?a.slice(0,b)+(c||"..."):a},prune:function(a,b,c){a+="";b=~~b;c=null!=c?""+c:"...";var d,e=a.replace(/\W/g,function(a){return a.toUpperCase()!==a.toLowerCase()?"A":" "});d=e.charAt(b);b= e.slice(0,b);d&&d.match(/\S/)&&(b=b.replace(/\s\S+$/,""));b=K.rtrim(b);return(b+c).length>a.length?a:a.substring(0,b.length)+c},words:function(a,b){return K.trim(a,b).split(b||/\s+/)},pad:function(a,b,c,d){a+="";var e=0;b=~~b;c?1e[n].zIndex&&(p[e[n].zIndex]=e[n]));for(k.sort(Vf);0>k[f];)if(g=p[k[f++]],F.push(g.apply(b,d)),Za)return Za=c,F;for(n=0;nd;d+=2){var f=[{x:+a[d-2],y:+a[d-1]}, {x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]});c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c},Kb=function(a,b,c,d,e,f,g,k,p){null==p&&(p=1);p=(1p?0:p)/2;for(var F=[-0.1252,0.1252,-0.3678,0.3678,-0.5873,0.5873,-0.7699, 0.7699,-0.9041,0.9041,-0.9816,0.9816],h=[0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472],n=0,j=0;12>j;j++)var r=p*F[j]+p,l=r*(r*(-3*a+9*c-9*e+3*g)+6*a-12*c+6*e)-3*a+3*c,r=r*(r*(-3*b+9*d-9*f+3*k)+6*b-12*d+6*f)-3*b+3*d,n=n+h[j]*G.sqrt(l*l+r*r);return p*n},Wf=function(a,b,c,d,e,f,g,k,p){if(!(0>p||Kb(a,b,c,d,e,f,g,k)da(I.x-G.x)?"y":"x",K=0.001>da(D.x-q.x)?"y":"x",Y;b:{Y=G.x;var L=G.y,M=I.x,O=I.y,P=q.x,Q=q.y,R=D.x,S=D.y;if(!(X(Y,M)X(P,R)||X(L,O)X(Q,S))){var U=(Y*O-L*M)*(P-R)-(Y-M)*(P*S- Q*R),V=(Y*O-L*M)*(Q-S)-(L-O)*(P*S-Q*R),T=(Y-M)*(Q-S)-(L-O)*(P-R);if(T){var U=U/T,V=V/T,T=+U.toFixed(2),W=+V.toFixed(2);if(!(T<+ba(Y,M).toFixed(2)||T>+X(Y,M).toFixed(2)||T<+ba(P,R).toFixed(2)||T>+X(P,R).toFixed(2)||W<+ba(L,O).toFixed(2)||W>+X(L,O).toFixed(2)||W<+ba(Q,S).toFixed(2)||W>+X(Q,S).toFixed(2))){Y={x:U,y:V};break b}}}Y=void 0}Y&&C[Y.x.toFixed(4)]!=Y.y.toFixed(4)&&(C[Y.x.toFixed(4)]=Y.y.toFixed(4),G=G.t+da((Y[J]-G[J])/(I[J]-G[J]))*(I.t-G.t),q=q.t+da((Y[K]-q[K])/(D[K]-q[K]))*(D.t-q.t),0<=G&& (1>=G&&0<=q&&1>=q)&&(z?E++:E.push({x:Y.x,y:Y.y,t1:G,t2:q})))}z=E}else z=z?0:[];if(c)r+=z;else{s=0;for(v=z.length;sd*a.top){c=a.percents[n];N=a.percents[n-1]||0;j=j/a.top*(c-N);h=a.percents[n+1];g=a.anim[c];break}else d&&b.attr(a.anim[a.percents[n]]); if(g){if(k)k.initstatus=d,k.start=new Date-k.ms*d;else{for(var z in g)if(g[V](z)&&(kd[V](z)||b.paper.customAttributes[V](z)))switch(r[z]=b.attr(z),null==r[z]&&(r[z]=Yf[z]),l[z]=g[z],kd[z]){case ga:u[z]=(l[z]-r[z])/j;break;case "colour":r[z]=m.getRGB(r[z]);n=m.getRGB(l[z]);u[z]={r:(n.r-r[z].r)/j,g:(n.g-r[z].g)/j,b:(n.b-r[z].b)/j};break;case "path":n=Xb(r[z],l[z]);H=n[1];r[z]=n[0];u[z]=[];n=0;for(y=r[z].length;ng;g++){p=((f*k+e)*k+d)*k-a;if(da(p)< b)return k;c=(3*f*k+2*e)*k+d;if(1E-6>da(c))break;k-=p/c}c=0;g=1;k=a;if(kg)return g;for(;cp?c=k:g=k;k=(g-c)/2+c}return k}(a,1/(200*j));return((g*a+c)*a+b)*a}}else z=ag;n=g.start||a.start||+new Date;H={anim:a,percent:c,timestamp:n,start:n+(a.del||0),status:0,initstatus:d||0,stop:!1,ms:j,easing:z,from:r,diff:u,to:l,el:b,callback:g.callback,prev:N,next:h,repeat:f||a.times,origin:b.attr(),totalOrigin:e};J.push(H);if(d&&(!k&&!p)&&(H.stop=!0,H.start= new Date-j*d,1==J.length))return md();p&&(H.start=new Date-H.ms*d);1==J.length&&te(md)}eve("raphael.anim.start."+b.id,b,a)}},ue=function(a){for(var b=0;b';vc=td.firstChild;vc.style.behavior="url(#default#VML)";if(!(vc&&"object"==typeof vc.adj)){m.type="";break a}td=null}m.svg=!(m.vml="VML"==m.type);m._Paper=we;m.fn=U=we.prototype=m.prototype;m._id=0;m._oid=0;m.is=function(a,b){b=tc.call(b);return"finite"==b?!hg[V](+a):"array"==b?a instanceof Array:"null"==b&&null===a||b==typeof a&&null!==a||"object"==b&&a===Object(a)||"array"==b&&Array.isArray&&Array.isArray(a)||eg.call(a).slice(8,-1).toLowerCase()== b};m.angle=function(a,b,c,d,e,f){return null==e?(a-=c,b-=d,!a&&!b?0:(180*G.atan2(-b,-a)/ta+540)%360):m.angle(a,b,e,f)-m.angle(c,d,e,f)};m.rad=function(a){return a%360*ta/180};m.deg=function(a){return 180*a/ta%360};m.snapTo=function(a,b,c){c=m.is(c,"finite")?c:10;if(m.is(a,Da))for(var d=a.length;d--;){if(da(a[d]-b)<=c)return a[d]}else{a=+a;d=b%a;if(da-c)return b-d+a}return b};var ng=/[xy]/g,og=function(a){var b=16*G.random()|0;return("x"==a?b:b&3|8).toString(16)};m.createUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(ng, og).toUpperCase()};m.setWindow=function(a){eve("raphael.setWindow",m,D.win,a);D.win=a;D.doc=D.win.document;m._engine.initWin&&m._engine.initWin(D.win)};var wc=function(a){if(m.vml){var b=/^\s+|\s+$/g,c;try{var d=new ActiveXObject("htmlfile");d.write("");d.close();c=d.body}catch(e){c=createPopup().document.body}var f=c.createTextRange();wc=Ma(function(a){try{c.style.color=sa(a).replace(b,"");var d=f.queryCommandValue("ForeColor");return"#"+("000000"+((d&255)<<16|d&65280|(d&16711680)>>>16).toString(16)).slice(-6)}catch(e){return"none"}})}else{var g= D.doc.createElement("i");g.title="Rapha\u00ebl Colour Picker";g.style.display="none";D.doc.body.appendChild(g);wc=Ma(function(a){g.style.color=a;return D.doc.defaultView.getComputedStyle(g,"").getPropertyValue("color")})}return wc(a)},pg=function(){return"hsb("+[this.h,this.s,this.b]+")"},qg=function(){return"hsl("+[this.h,this.s,this.l]+")"},Be=function(){return this.hex},Ce=function(a,b,c){null==b&&(m.is(a,"object")&&"r"in a&&"g"in a&&"b"in a)&&(c=a.b,b=a.g,a=a.r);null==b&&m.is(a,"string")&&(c= m.getRGB(a),a=c.r,b=c.g,c=c.b);if(1c?c:1-c);b=g*(1-da(a%2-1));c=e=f=c-g/2;a=~~a;c+=[g,b,0,0,b,g][a];e+=[b,g,g,b,0,0][a];f+=[0,0,b,g,g,b][a];return De(c,e,f,d)};m.rgb2hsb=function(a,b,c){c=Ce(a,b,c);a=c[0];b=c[1];c=c[2];var d,e;d=X(a,b,c);e=d-ba(a,b,c);a=60*(((0==e?0:d==a?(b-c)/e:d==b?(c-a)/e+2:(a-b)/e+4)+360)%6)/360;return{h:a,s:0==e?0:e/d,b:d,toString:pg}};m.rgb2hsl=function(a,b,c){c=Ce(a,b,c);a=c[0];b=c[1];c=c[2];var d,e,f;d=X(a,b,c);e=ba(a,b,c);f=d-e;a=60*(((0==f?0: d==a?(b-c)/f:d==b?(c-a)/f+2:(a-b)/f+4)+360)%6)/360;d=(d+e)/2;return{h:a,s:0==f?0:0.5>d?f/(2*d):f/(2-2*d),l:d,toString:qg}};m._path2string=function(){return this.join(",").replace(jg,"$1")};m._preload=function(a,b){var c=D.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em";c.onload=function(){b.call(this);this.onload=null;D.doc.body.removeChild(this)};c.onerror=function(){D.doc.body.removeChild(this)};D.doc.body.appendChild(c);c.src=a};m.getRGB=Ma(function(a){if(!a|| (a=sa(a)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:sc};if("none"==a)return{r:-1,g:-1,b:-1,hex:"none",toString:sc};!(ig[V](a.toLowerCase().substring(0,2))||"#"==a.charAt())&&(a=wc(a));var b,c,d,e,f;if(a=a.match(fg)){a[2]&&(d=wb(a[2].substring(5),16),c=wb(a[2].substring(3,5),16),b=wb(a[2].substring(1,3),16));a[3]&&(d=wb((f=a[3].charAt(3))+f,16),c=wb((f=a[3].charAt(2))+f,16),b=wb((f=a[3].charAt(1))+f,16));a[4]&&(f=a[4][Va](qd),b=R(f[0]),"%"==f[0].slice(-1)&&(b*=2.55),c=R(f[1]), "%"==f[1].slice(-1)&&(c*=2.55),d=R(f[2]),"%"==f[2].slice(-1)&&(d*=2.55),"rgba"==a[1].toLowerCase().slice(0,4)&&(e=R(f[3])),f[3]&&"%"==f[3].slice(-1)&&(e/=100));if(a[5])return f=a[5][Va](qd),b=R(f[0]),"%"==f[0].slice(-1)&&(b*=2.55),c=R(f[1]),"%"==f[1].slice(-1)&&(c*=2.55),d=R(f[2]),"%"==f[2].slice(-1)&&(d*=2.55),("deg"==f[0].slice(-3)||"\u00b0"==f[0].slice(-1))&&(b/=360),"hsba"==a[1].toLowerCase().slice(0,4)&&(e=R(f[3])),f[3]&&"%"==f[3].slice(-1)&&(e/=100),m.hsb2rgb(b,c,d,e);if(a[6])return f=a[6][Va](qd), b=R(f[0]),"%"==f[0].slice(-1)&&(b*=2.55),c=R(f[1]),"%"==f[1].slice(-1)&&(c*=2.55),d=R(f[2]),"%"==f[2].slice(-1)&&(d*=2.55),("deg"==f[0].slice(-3)||"\u00b0"==f[0].slice(-1))&&(b/=360),"hsla"==a[1].toLowerCase().slice(0,4)&&(e=R(f[3])),f[3]&&"%"==f[3].slice(-1)&&(e/=100),m.hsl2rgb(b,c,d,e);a={r:b,g:c,b:d,toString:sc};a.hex="#"+(16777216|d|c<<8|b<<16).toString(16).slice(1);m.is(e,"finite")&&(a.opacity=e);return a}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:sc}},m);m.hsb=Ma(function(a,b,c){return m.hsb2rgb(a, b,c).hex});m.hsl=Ma(function(a,b,c){return m.hsl2rgb(a,b,c).hex});m.rgb=Ma(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)});m.getColor=function(a){a=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75};var b=this.hsb2rgb(a.h,a.s,a.b);a.h+=0.075;1=a.s&&(this.getColor.start={h:0,s:1,b:a.b}));return b.hex};m.getColor.reset=function(){delete this.start};m.parsePathString=function(a){if(!a)return null;var b=xb(a);if(b.arr)return Na(b.arr);var c= {a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},d=[];m.is(a,Da)&&m.is(a[0],Da)&&(d=Na(a));d.length||sa(a).replace(kg,function(a,b,g){var k=[];a=b.toLowerCase();g.replace(ze,function(a,b){b&&k.push(+b)});"m"==a&&2=c[a]&&!(d.push([b][P](k.splice(0,c[a]))),!c[a]););});d.toString=m._path2string;b.arr=Na(d);return d};m.parseTransformString=Ma(function(a){if(!a)return null;var b=[];m.is(a,Da)&& m.is(a[0],Da)&&(b=Na(a));b.length||sa(a).replace(lg,function(a,d,e){var f=[];tc.call(d);e.replace(ze,function(a,b){b&&f.push(+b)});b.push([d][P](f))});b.toString=m._path2string;return b});var xb=function(a){var b=xb.ps=xb.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100};setTimeout(function(){for(var c in b)b[V](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};m.findDotsAtSegment=function(a,b,c,d,e,f,g,k,p){var h=1-p,N=Ea(h,3),n=Ea(h,2),j=p*p,r=j*p,l=N*a+3*n*p*c+3*h*p*p*e+r*g,N=N*b+3*n* p*d+3*h*p*p*f+r*k,n=a+2*p*(c-a)+j*(e-2*c+a),r=b+2*p*(d-b)+j*(f-2*d+b),m=c+2*p*(e-c)+j*(g-2*e+c),j=d+2*p*(f-d)+j*(k-2*f+d);a=h*a+p*c;b=h*b+p*d;e=h*e+p*g;f=h*f+p*k;k=90-180*G.atan2(n-m,r-j)/ta;(n>m||r=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2};m.isBBoxIntersect=function(a,b){var c=m.isPointInsideBBox;return c(b,a.x,a.y)||c(b,a.x2,a.y)||c(b,a.x,a.y2)||c(b,a.x2,a.y2)||c(a,b.x,b.y)||c(a,b.x2,b.y)||c(a,b.x,b.y2)||c(a,b.x2,b.y2)||(a.xb.x||b.xa.x)&&(a.yb.y||b.ya.y)};m.pathIntersection=function(a,b){return jd(a,b)};m.pathIntersectionNumber=function(a,b){return jd(a,b,1)};m.isPointInsidePath=function(a,b,c){var d=m.pathBBox(a);return m.isPointInsideBBox(d, b,c)&&1==jd(a,[["M",b,c],["H",d.x2+10]],1)%2};m._removedFactory=function(a){return function(){eve("raphael.log",null,"Rapha\u00ebl: you are calling to method \u201c"+a+"\u201d of removed object",a)}};var ud=m.pathBBox=function(a){var b=xb(a);if(b.bbox)return b.bbox;if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=Xb(a);for(var c=0,d=0,e=[],f=[],g,k=0,p=a.length;ky&&(y=2*ta+y);0>r&&(r=2*ta+r);g&&y>r&&(y-=2*ta);!g&&r>y&&(r-=2*ta)}if(da(r-y)>j){var l=r,H=k,z=p;r=y+j*(g&&r>y?1:-1);k=f+c*G.cos(r);p=u+d*G.sin(r);l=He(k,p,c,d,e,0,g,H,z,[r, l,f,u])}f=r-y;e=G.cos(y);j=G.sin(y);g=G.cos(r);r=G.sin(r);f=G.tan(f/4);c=4/3*c*f;f*=4/3*d;d=[a,b];a=[a+c*j,b-f*e];b=[k+c*r,p-f*g];k=[k,p];a[0]=2*d[0]-a[0];a[1]=2*d[1]-a[1];if(h)return[a,b,k][P](l);l=[a,b,k][P](l).join()[Va](",");h=[];k=0;for(p=l.length;kn&&(n=xc(a,b,c,d,e,f,g,k,n),r.push(n.x),l.push(n.y));0p&&(n=xc(a,b,c,d,e,f,g,k,p),r.push(n.x),l.push(n.y));p=f-2*d+b-(k-2*f+d);h=2*(d-b)-2*(f-d);j=b-d;n=(-h+G.sqrt(h*h-4*p*j))/2/p;p=(-h-G.sqrt(h*h-4*p*j))/2/p;"1e12"n&&(n=xc(a,b,c,d,e,f,g,k,n),r.push(n.x),l.push(n.y));0p&&(n=xc(a,b, c,d,e,f,g,k,p),r.push(n.x),l.push(n.y));return{min:{x:ba[aa](0,r),y:ba[aa](0,l)},max:{x:X[aa](0,r),y:X[aa](0,l)}}}),Xb=m._path2curve=Ma(function(a,b){var c=!b&&xb(a);if(!b&&c.curve)return Na(c.curve);var d=Fe(a),e=b&&Fe(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},k=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case "M":b.X=a[1];b.Y=a[2];break;case "A":a=["C"][P](He[aa](0,[b.x,b.y][P](a.slice(1)))); break;case "S":c=b.x+(b.x-(b.bx||b.x));d=b.y+(b.y-(b.by||b.y));a=["C",c,d][P](a.slice(1));break;case "T":b.qx=b.x+(b.x-(b.qx||b.x));b.qy=b.y+(b.y-(b.qy||b.y));a=["C"][P](Ge(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case "Q":b.qx=a[1];b.qy=a[2];a=["C"][P](Ge(b.x,b.y,a[1],a[2],a[3],a[4]));break;case "L":a=["C"][P]([b.x,b.y,a[1],a[2],a[1],a[2]]);break;case "H":a=["C"][P]([b.x,b.y,a[1],b.y,a[1],b.y]);break;case "V":a=["C"][P]([b.x,b.y,b.x,a[1],b.x,a[1]]);break;case "Z":a=["C"][P]([b.x,b.y,b.X,b.Y,b.X,b.Y])}return a}, p=function(a,b){if(7a;a++)for(c=0;3>c;c++){for(d=e=0;3>d;d++)e+=k[a][d]*b[d][c];g[a][c]=e}this.a=g[0][0];this.b=g[1][0];this.c=g[0][1];this.d=g[1][1];this.e=g[0][2];this.f=g[1][2]};xa.invert=function(){var a=this.a*this.d-this.b*this.c; return new vb(this.d/a,-this.b/a,-this.c/a,this.a/a,(this.c*this.f-this.d*this.e)/a,(this.b*this.e-this.a*this.f)/a)};xa.clone=function(){return new vb(this.a,this.b,this.c,this.d,this.e,this.f)};xa.translate=function(a,b){this.add(1,0,0,1,a,b)};xa.scale=function(a,b,c,d){null==b&&(b=a);(c||d)&&this.add(1,0,0,1,c,d);this.add(a,0,0,b,0,0);(c||d)&&this.add(1,0,0,1,-c,-d)};xa.rotate=function(a,b,c){a=m.rad(a);b=b||0;c=c||0;var d=+G.cos(a).toFixed(9);a=+G.sin(a).toFixed(9);this.add(d,a,-a,d,b,c);this.add(1, 0,0,1,-b,-c)};xa.x=function(a,b){return a*this.a+b*this.c+this.e};xa.y=function(a,b){return a*this.b+b*this.d+this.f};xa.get=function(a){return+this[sa.fromCharCode(97+a)].toFixed(4)};xa.toString=function(){return m.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()};xa.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+ ", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"};xa.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]};xa.split=function(){var a={};a.dx=this.e;a.dy=this.f;var b=[[this.a,this.c],[this.b,this.d]];a.scalex=G.sqrt(vd(b[0]));Je(b[0]);a.shear=b[0][0]*b[1][0]+b[0][1]*b[1][1];b[1]=[b[1][0]-b[0][0]*a.shear,b[1][1]-b[0][1]*a.shear];a.scaley=G.sqrt(vd(b[1]));Je(b[1]);a.shear/=a.scaley;var c=-b[0][1],b=b[1][1];0>b?(a.rotate=m.deg(G.acos(b)),0>c&&(a.rotate= 360-a.rotate)):a.rotate=m.deg(G.asin(c));a.isSimple=!+a.shear.toFixed(9)&&(a.scalex.toFixed(9)==a.scaley.toFixed(9)||!a.rotate);a.isSuperSimple=!+a.shear.toFixed(9)&&a.scalex.toFixed(9)==a.scaley.toFixed(9)&&!a.rotate;a.noRotation=!+a.shear.toFixed(9)&&!a.rotate;return a};xa.toTransformString=function(a){a=a||this[Va]();return a.isSimple?(a.scalex=+a.scalex.toFixed(4),a.scaley=+a.scaley.toFixed(4),a.rotate=+a.rotate.toFixed(4),(a.dx||a.dy?"t"+[a.dx,a.dy]:"")+(1!=a.scalex||1!=a.scaley?"s"+[a.scalex, a.scaley,0,0]:"")+(a.rotate?"r"+[a.rotate,0,0]:"")):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]};var zc=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);U.safari="Apple Computer, Inc."==navigator.vendor&&(zc&&4>zc[1]||"iP"==navigator.platform.slice(0,2))||"Google Inc."==navigator.vendor&&zc&&8>zc[1]?function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:mg; var tg=function(){this.returnValue=!1},ug=function(){return this.originalEvent.preventDefault()},vg=function(){this.cancelBubble=!0},wg=function(){return this.originalEvent.stopPropagation()},Ke;Ke=D.doc.addEventListener?function(a,b,c,d){var e=nd&&od[b]?od[b]:b,f=function(e){var f=e.clientX+(D.doc.documentElement.scrollLeft||D.doc.body.scrollLeft),p=e.clientY+(D.doc.documentElement.scrollTop||D.doc.body.scrollTop);if(nd&&od[V](b))for(var h=0,j=e.targetTouches&&e.targetTouches.length;hd){if(b&&!j.start){f=yd(f,g,k[1],k[2],k[3],k[4], k[5],k[6],d-n);h+=["C"+f.start.x,f.start.y,f.m.x,f.m.y,f.x,f.y];if(e)return h;j.start=h;h=["M"+f.x,f.y+"C"+f.n.x,f.n.y,f.end.x,f.end.y,k[5],k[6]].join();n+=p;f=+k[5];g=+k[6];continue}if(!a&&!b)return f=yd(f,g,k[1],k[2],k[3],k[4],k[5],k[6],d-n),{x:f.x,y:f.y,alpha:f.alpha}}n+=p;f=+k[5];g=+k[6]}h+=k.shift()+k}j.end=h;f=a?n:b?j:m.findDotsAtSegment(f,g,k[0],k[1],k[2],k[3],k[4],k[5],1);f.alpha&&(f={x:f.x,y:f.y,alpha:f.alpha});return f}},Me=zd(1),Ne=zd(),Ad=zd(0,1);m.getTotalLength=Me;m.getPointAtLength= Ne;m.getSubpath=function(a,b,c){if(1E-6>this.getTotalLength(a)-c)return Ad(a,b).end;a=Ad(a,c,1);return b?Ad(a,b).end:a};O.getTotalLength=function(){if("path"==this.type)return this.node.getTotalLength?this.node.getTotalLength():Me(this.attrs.path)};O.getPointAtLength=function(a){if("path"==this.type)return Ne(this.attrs.path,a)};O.getSubpath=function(a,b){if("path"==this.type)return m.getSubpath(this.attrs.path,a,b)};var Fa=m.easing_formulas={linear:function(a){return a},"<":function(a){return Ea(a, 1.7)},">":function(a){return Ea(a,0.48)},"<>":function(a){var b=0.48-a/1.04,c=G.sqrt(0.1734+b*b);a=c-b;a=Ea(da(a),1/3)*(0>a?-1:1);b=-c-b;b=Ea(da(b),1/3)*(0>b?-1:1);a=a+b+0.5;return 3*(1-a)*a*a+a*a*a},backIn:function(a){return a*a*(2.70158*a-1.70158)},backOut:function(a){a-=1;return a*a*(2.70158*a+1.70158)+1},elastic:function(a){return a==!!a?a:Ea(2,-10*a)*G.sin((a-0.075)*2*ta/0.3)+1},bounce:function(a){a<1/2.75?a*=7.5625*a:a<2/2.75?(a-=1.5/2.75,a=7.5625*a*a+0.75):a<2.5/2.75?(a-=2.25/2.75,a=7.5625* a*a+0.9375):(a-=2.625/2.75,a=7.5625*a*a+0.984375);return a}};Fa.easeIn=Fa["ease-in"]=Fa["<"];Fa.easeOut=Fa["ease-out"]=Fa[">"];Fa.easeInOut=Fa["ease-in-out"]=Fa["<>"];Fa["back-in"]=Fa.backIn;Fa["back-out"]=Fa.backOut;var J=[],te=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},md=function(){for(var a=+new Date,b=0;bd))if(da?0:a};O.animateWith=function(a,b,c,d,e,f){if(this.removed)return f&&f.call(this),this;c=c instanceof $a?c:m.animation(c,d,e,f);Yb(c,this,c.percents[0],null,this.attr());c=0;for(d=J.length;ca?X(this.length+a,0):a;b=X(0,ba(this.length-a,b));var d=[],e=[],f=[],g;for(g=2;gj[2]&&(j[0]=-j[2],j[2]=0);0>j[3]&&(j[1]=-j[3],j[3]=0)}var n=t._parseDots(b);if(!n)return null;d=d.replace(/[\(\)\s,\xb0#]/g,"_");a.gradient&&d!=a.gradient.id&& (k.defs.removeChild(a.gradient),delete a.gradient);if(!a.gradient){h=C(c+"Gradient",{id:d});a.gradient=h;C(h,"radial"==c?{fx:e,fy:f}:{x1:j[0],y1:j[1],x2:j[2],y2:j[3],gradientTransform:a.matrix.invert()});k.defs.appendChild(h);k=0;for(j=n.length;kb*c?-1:1);f&&(e=We(f,d,e),d=e.dx,e=e.dy); 0>b&&(n+="x");0>c&&(n+=" y")&&(l=-1);j.flip=n;a.coordorigin=d*-m+" "+e*-r;if(h||g.fillsize)d=(d=a.getElementsByTagName("fill"))&&d[0],a.removeChild(d),h&&(e=We(f,k.x(h[0],h[1]),k.y(h[0],h[1])),d.position=e.dx*l+" "+e.dy*l),g.fillsize&&(d.size=g.fillsize[0]*Dc(b)+" "+g.fillsize[1]*Dc(c)),a.appendChild(d);j.visibility="visible"}};w.toString=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+this.version};var Xe=function(a,b,c){b=ea(b).toLowerCase().split("-"); c=c?"end":"start";for(var d=b.length,e="classic",f="medium",g="medium";d--;)switch(b[d]){case "block":case "classic":case "oval":case "diamond":case "open":case "none":e=b[d];break;case "wide":case "narrow":g=b[d];break;case "long":case "short":f=b[d]}a=a.node.getElementsByTagName("stroke")[0];a[c+"arrow"]=e;a[c+"arrowlength"]=f;a[c+"arrowwidth"]=g},dc=function(a,b){a.attrs=a.attrs||{};var c=a.node,d=a.attrs,e=c.style,f=Fg[a.type]&&(b.x!=d.x||b.y!=d.y||b.width!=d.width||b.height!=d.height||b.cx!= d.cx||b.cy!=d.cy||b.rx!=d.rx||b.ry!=d.ry||b.r!=d.r),g=Gg[a.type]&&(d.cx!=b.cx||d.cy!=b.cy||d.r!=b.r||d.rx!=b.rx||d.ry!=b.ry),k;for(k in b)b.hasOwnProperty(k)&&(d[k]=b[k]);f&&(d.path=w._getPath[a.type](a),a._.dirty=1);b.href&&(c.href=b.href);b.title&&(c.title=b.title);b.target&&(c.target=b.target);b.cursor&&(e.cursor=b.cursor);"blur"in b&&a.blur(b.blur);if(b.path&&"path"==a.type||f){e=~ea(d.path).toLowerCase().indexOf("r")?w._pathToAbsolute(d.path):d.path;f=/[ahqstv]/ig;k=w._pathToAbsolute;ea(e).match(f)&& (k=w._path2curve);f=/[clmz]/g;if(k==w._pathToAbsolute&&!ea(e).match(f))e=ea(e).replace(Cg,function(a,b,c){var d=[],e="m"==b.toLowerCase(),f=Ve[b];c.replace(Eg,function(a){e&&2==d.length&&(f+=d+Ve["m"==b?"l":"L"],d=[]);d.push(Aa(21600*a))});return f+d});else{for(var f=k(e),h,e=[],j=0,l=f.length;jf&&(e*=f)&&(r.weight=1);r.opacity=e;b["stroke-linejoin"]&&(r.joinstyle=b["stroke-linejoin"]||"miter");r.miterlimit=b["stroke-miterlimit"]||8;b["stroke-linecap"]&&(r.endcap="butt"==b["stroke-linecap"]?"flat":"square"==b["stroke-linecap"]?"square":"round");b["stroke-dasharray"]&&(e={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"},r.dashstyle= e.hasOwnProperty(b["stroke-dasharray"])?e[b["stroke-dasharray"]]:"");g&&c.appendChild(r)}if("text"==a.type){a.paper.canvas.style.display="";c=a.paper.span;r=d.font&&d.font.match(/\d+(?:\.\d*)?(?=px)/);e=c.style;d.font&&(e.font=d.font);d["font-family"]&&(e.fontFamily=d["font-family"]);d["font-weight"]&&(e.fontWeight=d["font-weight"]);d["font-style"]&&(e.fontStyle=d["font-style"]);r=za(d["font-size"]||r&&r[0])||10;e.fontSize=100*r+"px";a.textpath.string&&(c.innerHTML=ea(a.textpath.string).replace(/"));c=c.getBoundingClientRect();a.W=d.w=(c.right-c.left)/100;a.H=d.h=(c.bottom-c.top)/100;a.X=d.x;a.Y=d.y+a.H/2;("x"in b||"y"in b)&&(a.path.v=w.format("m{0},{1}l{2},{1}",Aa(21600*d.x),Aa(21600*d.y),Aa(21600*d.x)+1));c="x y text font font-family font-weight font-style font-size".split(" ");r=0;for(g=c.length;r')}}catch(c){Wa=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}};w._engine.initWin(w._g.win);w._engine.create=function(){var a=w._getContainer.apply(0,arguments),b=a.container,c=a.height,d=a.width,e=a.x,a=a.y;if(!b)throw Error("VML container not found."); var f=new w._Paper,g=f.canvas=w._g.doc.createElement("div"),k=g.style,e=e||0,a=a||0,d=d||512,c=c||342;f.width=d;f.height=c;d==+d&&(d+="px");c==+c&&(c+="px");f.coordsize="21600000 21600000";f.coordorigin="0 0";f.span=w._g.doc.createElement("span");f.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";g.appendChild(f.span);k.cssText=w.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", d,c);1==b?(w._g.doc.body.appendChild(g),k.left=e+"px",k.top=a+"px",k.position="absolute"):b.firstChild?b.insertBefore(g,b.firstChild):b.appendChild(g);f.renderfix=function(){};return f};w.prototype.clear=function(){w.eve("raphael.clear",this);this.canvas.innerHTML="";this.span=w._g.doc.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas.appendChild(this.span);this.bottom=this.top=null};w.prototype.remove= function(){w.eve("raphael.remove",this);this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]="function"==typeof this[a]?w._removedFactory(a):null;return!0};var Ye=w.st,ec;for(ec in ia)ia.hasOwnProperty(ec)&&!Ye.hasOwnProperty(ec)&&(Ye[ec]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(ec))}var ja;ja||(ja={});(function(){function a(a){return 10>a?"0"+a:a}function b(a){e.lastIndex=0;return e.test(a)?'"'+a.replace(e,function(a){var b= k[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function c(a,d){var e,k,j,l,m=f,q,y=d[a];y&&("object"===typeof y&&"function"===typeof y.toJSON)&&(y=y.toJSON(a));"function"===typeof h&&(y=h.call(d,a,y));switch(typeof y){case "string":return b(y);case "number":return isFinite(y)?String(y):"null";case "boolean":case "null":return String(y);case "object":if(!y)return"null";f+=g;q=[];if("[object Array]"===Object.prototype.toString.apply(y)){l=y.length; for(e=0;eb?1:a>=b?0:NaN};j.descending=function(a,b){return ba?1:b>=a?0:NaN};j.mean=function(a,b){var c=a.length,d,e=0,f=-1,g=0;if(1===arguments.length)for(;++ff)e=f}else{for(;++cf)e=f}return e};j.max=function(a,b){var c=-1,d=a.length,e,f;if(1===arguments.length){for(;++ce)e=f}else{for(;++ce)e=f}return e};j.extent=function(a,b){var c=-1,d=a.length,e,f,g;if(1===arguments.length){for(;++cf&&(e=f),gf&&(e=f),garguments.length&&(b=1);1>arguments.length&&(a=0);return function(){var c,d;do c=2*Math.random()-1,d=2*Math.random()-1,d=c*c+d*d;while(!d||1arguments.length&&(d=0);4>arguments.length&&(e=b.length);for(;d>1;a.call(b,b[f],f)arguments.length&&(d=0);4>arguments.length&&(e=b.length);for(;d>1;c=b.call(a,e,f=a[c]))e=f;return e};j.nest=function(){function a(b,e){if(e>=d.length)return g?g.call(c,b):f?b.sort(f):b;for(var h=-1,j=b.length,n=d[e++],l,r,m=new Tb,q,H={};++h< j;)(q=m.get(l=n(r=b[h])))?q.push(r):m.set(l,[r]);m.forEach(function(b){H[b]=a(m.get(b),e)});return H}function b(a,c){if(c>=d.length)return a;var f=[],g=e[c++],h;for(h in a)f.push({key:h,values:b(a[h],c)});g&&f.sort(function(a,b){return g(a.key,b.key)});return f}var c={},d=[],e=[],f,g;c.map=function(b){return a(b,0)};c.entries=function(c){return b(a(c,0),0)};c.key=function(a){d.push(a);return c};c.sortKeys=function(a){e[d.length-1]=a;return c};c.sortValues=function(a){f=a;return c};c.rollup=function(a){g= a;return c};return c};j.keys=function(a){var b=[],c;for(c in a)b.push(c);return b};j.values=function(a){var b=[],c;for(c in a)b.push(a[c]);return b};j.entries=function(a){var b=[],c;for(c in a)b.push({key:c,value:a[c]});return b};j.permute=function(a,b){for(var c=[],d=-1,e=b.length;++darguments.length&&(b=Cf);++farguments.length&&(c=1,2>arguments.length&&(b=a,a=0));if(Infinity===(b-a)/c)throw Error("infinite range");var d=[],e;e=Math.abs(c);for(var f=1;e*f%1;)f*=10;e=f;var f=-1,g;a*=e;b*=e;c*=e;if(0>c)for(;(g=a+c*++f)>b;)d.push(g/e);else for(;(g=a+c*++f)arguments.length?(c=b,b=null):b&&d.overrideMimeType&&d.overrideMimeType(b);d.open("GET",a,!0);b&&d.setRequestHeader("Accept",b);d.onreadystatechange=function(){4===d.readyState&&c(300>d.status?d:null)};d.send(null)};j.text=function(a,b,c){3>arguments.length&&(c=b,b=null);j.xhr(a,b,function(a){c(a&&a.responseText)})};j.json=function(a,b){j.text(a,"application/json",function(a){b(a?ja.parse(a):null)})};j.html=function(a,b){j.text(a,"text/html",function(a){if(null!= a){var d=document.createRange();d.selectNode(document.body);a=d.createContextualFragment(a)}b(a)})};j.xml=function(a,b,c){3>arguments.length&&(c=b,b=null);j.xhr(a,b,function(a){c(a&&a.responseXML)})};var Kd={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",vml:"urn:schemas-microsoft-com:vml"};j.ns={prefix:Kd,qualify:function(a){var b=a.indexOf(":"),c=a;0<=b&&(c= a.substring(0,b),a=a.substring(b+1));return Kd.hasOwnProperty(c)?{space:Kd[c],local:a}:a}};j.dispatch=function(){for(var a=new Td,b=-1,c=arguments.length;++barguments.length?this[a].on(d):this[a].on(d,b)};j.format=function(a){a=Jg.exec(a);var b=a[1]||" ",c=a[3]||"",d=a[5],e=+a[6],f=a[7],g=a[8],k=a[9],h=1,l="",m=!1;g&&(g=+g.substring(1));d&&(b="0",f&&(e-= Math.floor((e-1)/4)));switch(k){case "n":f=!0;k="g";break;case "%":h=100;l="%";k="f";break;case "p":h=100;l="%";k="r";break;case "d":m=!0;g=0;break;case "s":h=-1,k="r"}"r"==k&&!g&&(k="g");k=Kg.get(k)||Ef;return function(a){if(m&&a%1)return"";var q=0>a&&(a=-a)?"\u2212":c;if(0>h){var r=j.formatPrefix(a,g);a*=r.scale;l=r.symbol}else a*=h;a=k(a,g);d?(r=a.length+q.length,r=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,Kg=j.map({g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return j.round(a,b=Ud(a,b)).toFixed(Math.max(0,Math.min(20,b)))}}),Lg=la("y z a f p n \u03bc m k M G T P E Z Y".split(" "),function(a,b){return{scale:Math.pow(10,3*(8-b)),symbol:a}});j.formatPrefix=function(a,b){var c=0;a&&(0>a&&(a*=-1),b&&(a=j.round(a,Ud(a,b))),c=1+Math.floor(1E-12+ Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,3*Math.floor((0>=c?c+1:c-1)/3))));return Lg[8+c/3]};var Mg=Qc(2),Ng=Qc(3),ff=function(){return Pc},Og=j.map({linear:ff,poly:Qc,quad:function(){return Mg},cubic:function(){return Ng},sin:function(){return Ff},exp:function(){return Gf},circle:function(){return Hf},elastic:function(a,b){var c;2>arguments.length&&(b=0.45);1>arguments.length?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin(2*(d-c)*Math.PI/ b)}},back:function(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}},bounce:function(){return If}}),Pg=j.map({"in":Pc,out:Wd,"in-out":Xd,"out-in":function(a){return Xd(Wd(a))}});j.ease=function(a){var b=a.indexOf("-"),c=0<=b?a.substring(0,b):a,b=0<=b?a.substring(b+1):"in",c=Og.get(c)||ff,b=Pg.get(b)||Pc,d=b(c.apply(null,Array.prototype.slice.call(arguments,1)));return function(a){return 0>=a?0:1<=a?1:d(a)}};j.event=null;j.interpolate=function(a,b){for(var c=j.interpolators.length,d;0<= --c&&!(d=j.interpolators[c](a,b)););return d};j.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}};j.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}};j.interpolateString=function(a,b){var c,d,e=0,f=[],g=[],k,h;for(d=Gc.lastIndex=0;c=Gc.exec(b);++d)c.index&&f.push(b.substring(e,c.index)),g.push({i:f.length,x:c[0]}),f.push(null),e=Gc.lastIndex;eb&&(b=30);c&&30>c&&(c=30); d&&30>d&&(d=30);return ib(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))};rb.prototype.darker=function(a){a=Math.pow(0.7,arguments.length?a:1);return ib(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))};rb.prototype.hsl=function(){return Yd(this.r,this.g,this.b)};rb.prototype.toString=function(){return"#"+Hb(this.r)+Hb(this.g)+Hb(this.b)};var jc=j.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff", beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00", darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f", grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de", lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23", orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090", slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});jc.forEach(function(a,b){jc.set(a,Rc(b,ib,kc))});j.hsl=function(a,b,c){return 1===arguments.length?a instanceof sb?Ib(a.h,a.s,a.l):Rc(""+a,Yd,Ib):Ib(+a,+b,+c)};sb.prototype.brighter=function(a){a=Math.pow(0.7,arguments.length?a:1); return Ib(this.h,this.s,this.l/a)};sb.prototype.darker=function(a){a=Math.pow(0.7,arguments.length?a:1);return Ib(this.h,this.s,a*this.l)};sb.prototype.rgb=function(){return kc(this.h,this.s,this.l)};sb.prototype.toString=function(){return this.rgb().toString()};j.csv=function(a,b){j.text(a,"text/csv",function(a){b(a&&j.csv.parse(a))})};j.csv.parse=function(a){var b;return j.csv.parseRows(a,function(a,d){if(d){for(var e={},f=-1,g=b.length;++f=a.length)return e;if(l)return l=!1,d;var b=g.lastIndex;if(34===a.charCodeAt(b)){for(var c=b;c++a))+c[0].slice(d).replace(/(\d{3})/g,",$1"),b=c.join("."));return b};E.makeClass=function(a,b){var c={},d=function(a,b){if(this instanceof d)"function"==typeof this.init&&this.init.apply(this,a===c?b:arguments);else return new d(c,arguments)};2<=arguments.length&&(d.prototype=new b,d.prototype.constructor=d);E.undef(a)||(d.prototype._cls_name=a,d._class=!0);return d};E.undef=function(a){return"undefined"==typeof a};E.constfunc=function(a){return function(){return a}};E.invertedIndex= function(a){var b={};h.each(a,function(a,d){b[a]=d});return b};E.identity=function(a){return a};E.strlenToPixel=function(a,b){return"bold"==b?Math.max(7*a,0):Math.max(6*a,0)};E.cloneobj=function(a){var b=h.clone(a);b.constructor!=a.constructor&&(b.constructor=a.constructor);h.has(a,"_attr")&&(b._attr=h.clone(a._attr));return b};E.postfix=function(a,b){var c={"0":"",3:"k",6:"m",9:"b",12:"t"};return!h.isUndefined(c[b])?a+c[b]:a+"e"+(0b?c=3:6b?c=6:9b?c=9:12b?c=12:(c=b,d=2==arguments.length?0:1);var e=Math.round(a/Math.pow(10,c-d)),e=e/Math.pow(10,d),e=e.toFixed(d);return E.postfix(dh(e),c)};E.roundTo=function(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c};E.array=function(a,b){for(var c= [],d=a,e,f=h.isFunction(b);d--;)e=f?b():b,c[d]=e;return c};E.grid=function(a,b,c){for(var d=0,e=0,f=[],g=h.isFunction(c),d=0;da.length?!1:a.slice(0,c)===b};E.instantiate=function(a){return h.isString(a)?lb[a]():a&&a.prototype&&a.prototype._cls_name?a():a};E.sum=function(){var a,b=0,c;if(h.isArray(this)){c=this.length;for(a=0;a=a.length)return null;var c=a.length,d,e;b=b?b:function(a){return a};var f=b(a[0]),g=Infinity;for(d=1;d=hh?c?[["M",a,b+d],["A",d,d,0,1,1,a,b-d], ["A",d,d,0,1,1,a,b+d],["M",a,b+c],["A",c,c,0,1,0,a,b-c],["A",c,c,0,1,0,a,b+c],["Z"]]:d?[["M",a,b+d],["A",d,d,0,1,1,a,b-d],["A",d,d,0,1,1,a,b+d],["Z"]]:"":c?e==f?[["M",d*j+a,d*l+b],["L",c*m+a,c*n+b]]:[["M",d*j+a,d*l+b],["A",d,d,0,g,1,d*m+a,d*n+b],["L",c*m+a,c*n+b],["A",c,c,0,g,0,c*j+a,c*l+b],["Z"]]:d?e==f?[["M",d*j+a,d*l+b],["L",c*m+a,c*n+b]]:[["M",d*j+a,d*l+b],["A",d,d,0,g,1,d*m+a,d*n+b],["L",a,b],["Z"]]:""};Raphael.fn.gg_polar_rect=function(a){Ra++;var b=a._offsetX,c=a._offsetY,d=a._flip,e=this.path().attr("preProcess", function(a){var e,h,j,l;e=a.x1;h=a.x2;j=a.y1;l=a.y2;delete a.x1;delete a.x2;delete a.y1;delete a.y2;a.path=Pd(d,b,c,e,h,j,l);return a}),e=l.addMouseover(a,e);Qa(e);return e};Raphael.fn.gg_cart_vline=function(a){Ra++;var b=a._offsetX,c=a._offsetY,d=this.path().attr("postProcess",function(d){var f,g,h,j;h=c+a.transY(d.x,d.y1);j=c+a.transY(d.x,d.y2);f=b+a.transX(d.x,d.y1);g=b+a.transX(d.x,d.y2);d.path=[["M",f,h],["L",g,j]];delete d.x;delete d.y1;delete d.y2;return d}),d=l.addMouseover(a,d);Qa(d);return d}; Raphael.fn.gg_polar_vline=function(a){Ra++;var b=a._offsetX,c=a._offsetY,d=a._flip,e=this.path().attr("preProcess",function(a){var e,h,j,l;e=h=a.x;j=a.y1;l=a.y2;delete a.x;delete a.y1;delete a.y2;a.path=Pd(d,b,c,e,h,j,l);return a}),e=l.addMouseover(a,e);Qa(e);return e};Raphael.fn.gg_cart_hline=function(a){Ra++;var b=a._offsetX,c=a._offsetY,d=this.path().attr("postProcess",function(d){var f,g,h,j;h=c+a.transY(d.x1,d.y);j=c+a.transY(d.x2,d.y);f=b+a.transX(d.x1,d.y);g=b+a.transX(d.x2,d.y);d.path=[["M", f,h],["L",g,j]];delete d.x1;delete d.x2;delete d.y;return d}),d=l.addMouseover(a,d);Qa(d);return d};Raphael.fn.gg_polar_hline=function(a){Ra++;var b=a._offsetX,c=a._offsetY,d=a._flip,e=this.path().attr("preProcess",function(a){var e,h,j,l;e=a.x1;h=a.x2;j=l=a.y;delete a.x1;delete a.x2;delete a.y;a.path=Pd(d,b,c,e,h,j,l);return a}),e=l.addMouseover(a,e);Qa(e);return e};l._path_function=function(a,b,c,d,e,f,g){var k=a._offsetX,j=a._offsetY;g=g.getObjects();f&&(g=h.sortBy(g,f));b=h.map(g,b);c=h.map(g, c);d&&d(b,c);e&&(c=e(b,c),b=c.x,c=c.y);d=[];e=!0;f=b.length;for(g=0;gthis._statData.length&&A.error(-1,"Attempting to access facet id "+e+" when there are only "+this._statData.length);var f=-1==e?l.doubleMap:h.map,g=-1==e?this._statData:this._statData[e],k;"aes_group"===b?(a=h.values(this.getAestheticsGroup(a)),a=h.map(a,function(a){return f(g,h.bind(c,null,a))}),a=l.concat(a)):("key"===b?k=a:"aes"===b?k=this.map(a):this.warn(-1,"Should not reach here."),a=f(g,h.bind(c, null,k)));a=l.concat(a);return d(a)};A.layer.base.prototype.min=function(a,b,c){var d=this.type(a,b),d=A.type.fromString(d).min;return this.queryData(a,b,function(a,b){return b.min(a)},d,c)};A.layer.base.prototype.max=function(a,b,c){var d=this.type(a,b),d=A.type.fromString(d).max;return this.queryData(a,b,function(a,b){return b.max(a)},d,c)};A.layer.base.prototype.levels=function(a,b,c){var d=this.type(a,b),e=A.type.fromString(d);return this.queryData(a,b,function(a,b){return b.levels(a)},function(a){return l.mergeArrays(a, e.represent)},c)};A.layer.base.prototype.type=function(a,b,c){return this.queryData(a,b,function(a,b){return b.type(a)},l.unionType,c)};A.layer.base.prototype.checkStatsRequiredMapping=function(){var a=this.stats().requiredMap()||[],a=h.difference(a,h.keys(this.getMap()));0b&&(this.warn(403, "Maximum cannot be set above "+b+". Using "+b+" instead of "+a+"."),a=b),this._attr.max=a,this):this._attr.max};I.scale.base.prototype.rangeSize=function(){return Math.abs(this._attr.range_low-this._attr.range_high)};I.scale.base.prototype.type=function(){return this._type};I.scale.base.prototype._saneNumber=function(a){return h.isNumber(a)&&!isNaN(a)&&Infinity!=a&&-Infinity!=a};I.scale.base.prototype._makeDomain=function(){var a=this._aes,b=this._graph.min(a),c=this._graph.defaultMin(a,b),d=this._graph.max(a), a=this._graph.defaultMax(a,d);this._attr.domain_low=h.chain([b,this._attr.min,c]).filter(h.isNumber).min().value();this._attr.domain_high=h.chain([d,this._attr.max,a]).filter(h.isNumber).max().value();return[this._attr.domain_low,this._attr.domain_high]};I.scale.base.prototype.domain=function(a){return 1===arguments.length?(this._attr.min=a[0],this._attr.max=a[1],this):[this._attr.min,this._attr.max]};I.scale.base.prototype.range=function(a){return 1===arguments.length?(this._attr.range_low=a[0], this._attr.range_high=a[1],this):!h.isUndefined(this._attr.range_low)&&!h.isUndefined(this._attr.range_high)?[this._attr.range_low,this._attr.range_high]:null};I.scale.base.prototype.make=function(){I.error(10,"Not implemented.")};I.scale.base.prototype._apply=function(){I.error(10,"Not implemented.")};I.scale.base.prototype.apply=function(a,b){1==arguments.length&&(b=a,a=void 0);b&&"gg.data"===b._cls_name&&(b=b.getObject(0));var c=h.isUndefined(a)||h.isUndefined(b[a])?b:b[a];return this._apply(c)}; I.scale.base.prototype._tickObject=function(a,b,c){return new kh(a,b,c)};I.scale.base.prototype._suggestNumticks=function(a,b,c){h.isNumber(a)||(a=null);null===a&&(a=this.opts("numticks"),h.isNull(a)&&(a=this.rangeSize(),h.isNumber(c)&&0=b[g].charAt(e);e--)c+=b[g].charAt(e)*Math.pow(10,b[g].length-e-1),d++;c++;b[g]=b[g].substring(0,b[g].length-d)+""+c;d=c=0}e=!0;for(f=0;fthis.len())return h.each(this._internal,a);var c=h.shuffle(this._internal);return h.each(c.slice(0,b),a)};v.data.prototype._cached= function(a,b,c,d){h.isFunction(b)&&(b._data_key||(b._data_key=h.uniqueId("var_"),this.derive(b,b._data_key)),b=b._data_key);if(-1===h.indexOf(this._keys,b))return d;if(h.has(this._cache[a],b))return a=this._cache[a][b],Sd.hit++,a;Sd.miss++;c=c.call(this,b);return this._cache[a][b]=c};v.data.prototype._clearCache=function(){var a=this._cache={};h.each(lh,function(b){a[b]={}})};v.data.prototype.parser=function(a,b){if(1===arguments.length)return this._meta[a].parser;this._meta[a].parser=b;return this}; var rf=function(a){var b=Number(a);return null===a||"undefined"==typeof a||""===a||h.isNaN(b)?null:b};v.data.prototype._guessParsers=function(){var a=this;h.each(this._keys,function(b){var c=a._meta[b];if(!a.parser(b))if("number"==c.type){if(c.format){var d=RegExp(c.format);b=function(a){a=d.exec(a)[1];return rf(a)}}else b=rf;c.parser=b}else if("date"==c.type)c.format?(b=a._meta[b].format,c.parser=v.data.makeDateParser(b)):(b=h.pluck(a._unparsed,b),(b=v.data.guessDateFormat(b))?(c.parser=v.data.makeDateParser(b), c.format=b):(c.type="date",c.parser=function(a){return a},c.format=null));else if("category"==c.type&&null===c.format)c.parser=v.type.category.prototype.represent;else if(c.parser=v.type.category.prototype.represent,b=h.pluck(a._unparsed,b),b=v.data.guessDateFormat(b))c.type="date",c.parser=v.data.makeDateParser(b),c.format=b})};v.data.prototype._applyParsers=function(){var a=this,b=this.keys();this._internal=h.map(this._unparsed,function(c){for(var d={},e=0,e=0;ea.chartWidth-r.getBBox().width&&(n+=Math.max(r.getBBox().height,t.getBBox().height),u=Math.max(u,n),q=0))});"h"==a.orientation&&(u+=Math.max(r.getBBox().height,t.getBBox().height));return{y:u,x:v}};wa.guide.legend.prototype._render_line_tick=function(a,b,c,d,e){return b.line().attr("func",{x1:l.constfunc(d),x2:l.constfunc(d+14),y1:l.constfunc(e), y2:l.constfunc(e),stroke:c.color,"fill-opacity":c.opacity,"stroke-width":c.strokewidth}).attr("data",a)};wa.guide.legend.prototype._render_point_tick=function(a,b,c,d,e){return b.point().attr("func",{cx:l.constfunc(d+7),cy:l.constfunc(e),r:c.radius,symbol:c.symbol,fill:c.color,stroke:c.stroke,"fill-opacity":c.opacity,"stroke-width":c.strokewidth}).attr("data",a)};wa.guide.legend.prototype._render_label=function(a,b,c,d){return b.text().attr("func",{x:l.constfunc(c),y:l.constfunc(d),"font-size":"12px", "text-anchor":"start",text:function(a){return String(a.label)}}).attr("data",a)};var Sa=q;Sa.layer.area=l.makeClass("gg.layer.area",Sa.layer.base);Sa.layer.area.prototype.init=function(){Sa.layer.base.prototype.init.call(this);this.opts("stroke","none").opts("opacity",0.4).opts("color","steelblue").opts("strokewidth",0).opts("padding",0.5)};Sa.layer.area.prototype.calculatePartials=function(){return!0};Sa.layer.area.prototype.layerGroup=function(){return["group","group_color","group_opacity"]};Sa.layer.area.prototype.defaultMin= function(a,b){h.isDate(b)&&(b=b.getTime());return"y"==a?0:Sa.layer.base.prototype.defaultMin.call(this,a,b)};Sa.layer.area.prototype.render=function(a){var b=a.coord,c=a.scales,d=a.rawScales.y.opts("domain_low");c.y(d);var e=function(a){return function(b,c){h.each(a,function(a){b.push(f(a.x));c.push(g(a.y))})}},f,g;f=c.x;g=c.y_2||c.y_override||c.y;var k=this,d=a.computedData,j=this.map("group");j&&(d=h.sortBy(d,function(a){return a._internal[0][j]}));d.reverse();var l=[],m=this.map("x");h.each(d, function(d){k.opts("domain")&&(d=k.fillZero(d,a,["$sum","$partial_1","$partial_2"]));l=h.chain(d._internal).map(function(a){return{x:m?a[m]:1,y:a.$partial_1||0}}).sortBy(function(a){return a.x}).value();l.reverse();b.poly().attr("func",{x:f,y:g,_sort:f,_pointModifier:e(l),_style:c}).attr("data",d)})};Sa.layer.area.prototype.imputeMapping=function(a){return Sa.layer.base.prototype.imputeMapping.call(this,a,{group:["stroke","color"]})};var qa=q;qa.layer.bar=l.makeClass("gg.layer.bar",qa.layer.base); qa.layer.bar.prototype.init=function(){qa.layer.base.prototype.init.call(this);var a=this;h.each(qa.opts.bar,function(b,c){a.opts(c,b)});this.opts("padding",0)};qa.layer.bar.prototype.calculatePartials=function(){return!0};qa.layer.bar.prototype.layerGroup=function(){return["x"]};qa.layer.bar.prototype.defaultMin=function(a,b){h.isDate(b)&&(b=b.getTime());if("y"==a)return 0;if("x"==a){var c=this.opts("align"),d=this.opts("width");if("center"==c)return b-d/2;if("right"==c)return b-d}return qa.layer.base.prototype.defaultMin.call(this, a,b)};qa.layer.bar.prototype.defaultMax=function(a,b){if("x"==a){var c=this.opts("align"),d=this.opts("width");if("center"==c)return b- -d/2;if("left"==c)return b- -d}return qa.layer.base.prototype.defaultMax.call(this,a,b)};qa.layer.bar.prototype.defaultScales=function(){return{x:qa.scale.discrete("x")}};qa.layer.bar.prototype.checkErrors=function(a){return"number"!==a.rawScales.y.type()?(qa.error(311,"y scale must be numeric."),!0):!1};qa.layer.bar.prototype.render=function(a){var b=a.coord,c=a.scales, d=this.opts("width"),e;e=a.rawScales.x.DISCRETE?a.width:a.rawScales.x.apply(d)-a.rawScales.x.apply(0);var d=e/2*(1-2*this.opts("padding")),f=a.rawScales.y.opts("domain_low");h.isNumber(f)||this.warn(-2,"originLocation is numeric.");0>f&&(f=0);var g=null,k=null,j,m,q=this.opts("align");"left"==q||"right"==q?(e=e/2-d,"right"==q?(j=l.sub(c.x,e),m=l.sub(c.x,e+2*d)):(j=l.add(c.x,e),m=l.add(c.x,e+2*d))):"center"==q&&(j=l.sub(c.x,d),m=l.add(c.x,d));c.y_1&&c.y_2?(k=c.y_1,g=c.y_2):(k=c.y_override?c.y_override: c.y,g=d=k(f));var n=this,t=this.opts("onDoubleclick");h.each(a.computedData,function(a){a.each(function(a){b.rect().ggTooltip(c).ggDoubleClick(t,n).attr("func",{x1:j,x2:m,y1:k,y2:g,_style:c}).attr("data",a)})})};var ka=q;ka.layer.box=l.makeClass("gg.layer.box",ka.layer.base);ka.layer.box.prototype.init=function(){ka.layer.base.prototype.init.call(this);var a=this;h.each(ka.opts.box,function(b,c){a.opts(c,b)});this._default_stats=ka.stats.box};ka.layer.area.prototype.calculatePartials=function(){return!0}; ka.layer.box.prototype.layerGroup=function(){return["x"]};ka.layer.box.prototype.defaultMin=function(a,b){h.isDate(b)&&(b=b.getTime());if("y"==a)return 0;if("x"==a){var c=this.opts("align"),d=this.opts("width");if("center"==c)return b-d/2;if("right"==c)return b-d}};ka.layer.box.prototype.defaultMax=function(a,b){if("x"==a){var c=this.opts("align"),d=this.opts("width");if("center"==c)return b- -d/2;if("left"==c)return b- -d}return ka.layer.base.prototype.defaultMax.call(this,a,b)};ka.layer.box.prototype.checkErrors= function(){var a=h.keys(this.getMap());if(h.include(a,"y"))return!1;this.warn(320,"No mapping has been set in layer "+this._cls_name);return!0};ka.layer.box.prototype.render=function(a){var b=a.coord,c=a.scales,d=this.opts("width"),d=a.rawScales.x.DISCRETE?a.width:a.rawScales.x.apply(d)-a.rawScales.x.apply(0),e=d/2*(1-2*this.opts("padding")),f,g,k,j=this.opts("align"),m=this;if("left"==j||"right"==j){var q=d/2-e;"right"==j?(k=l.sub(c.x,e),f=l.sub(c.x,d/2),g=l.sub(c.x,q+2*e)):(k=l.add(c.x,d/2),f=l.add(c.x, q),g=l.add(c.x,q+2*e))}else"center"==j&&(f=l.sub(c.x,e),k=c.x,g=l.add(c.x,e));c.y_q0||(c.y_q0=c.y);c.y_q1||(c.y_q1=c.y);c.y_q2||(c.y_q2=c.y);c.y_q3||(c.y_q3=c.y);c.y_q4||(c.y_q4=c.y);var n=this.opts("onDoubleclick");h.each(a.computedData,function(a){a.each(function(a){!h.isNull(a.$q0)&&!h.isNull(a.$q3)?(b.vline().attr("func",{y1:c.y_q0,y2:c.y_q1,x:k,_style:c}).attr("data",a),b.vline().attr("func",{y1:c.y_q3,y2:c.y_q4,x:k,_style:c}).attr("data",a),b.rect().ggDoubleClick(n,m).attr("func",{x1:f,x2:g, y1:c.y_q1,y2:c.y_q3,_style:c}).attr("data",a),b.hline().attr("func",{x1:f,x2:g,y:c.y_q4,_style:c}).attr("data",a),b.hline().attr("func",{x1:f,x2:g,y:c.y_q2,_style:c}).attr("data",a),b.hline().attr("func",{x1:f,x2:g,y:c.y_q0,_style:c}).attr("data",a)):b.point().ggTooltip(c).attr("func",{cx:k,cy:c.y,r:c.radius,symbol:l.constfunc(ka.symbol.CIRCLE),_style:c}).attr("data",a)})})};ka.layer.box.prototype.imputeMapping=function(a){return ka.layer.base.prototype.imputeMapping.call(this,a,{group:"x"})};ka.layer.box.prototype.checkErrors= function(a){return"number"!==a.rawScales.y.type()?(ka.error(311,"y scale must be numeric."),!0):!1};var ic=q;ic.layer.histo=l.makeClass("gg.layer.histo",ic.layer.bar);ic.layer.histo.prototype.init=function(){ic.layer.bar.prototype.init.call(this);this._default_stats=ic.stats.bin};var Cb=q;Cb.layer.jitter=l.makeClass("gg.layer.jitter",Cb.layer.base);Cb.layer.jitter.prototype.init=function(){Cb.layer.base.prototype.init.call(this);this.opts("radius",3);this.opts("symbol",Cb.symbol.CIRCLE)};Cb.layer.jitter.prototype.render= function(a){var b=a.coord,c=a.scales,d={cx:function(a){return c.x(a)+20*(Math.random()-0.5)},cy:function(a){return c.y(a)+20*(Math.random()-0.5)},r:c.radius,symbol:c.symbol,stroke:c.stroke,"stroke-width":c.strokewidth,"fill-opacity":c.opacity,fill:c.color};a.computedData.each(function(a){b.point().attr("func",d).attr("data",a)})};Cb.layer.jitter.prototype.hasGroup=function(){return!1};var Ta=q;Ta.layer.line=l.makeClass("gg.layer.line",Ta.layer.base);Ta.layer.line.prototype.init=function(){Ta.layer.base.prototype.init.call(this); this.opts("symbol",Ta.symbol.CIRCLE);var a=this;h.each(Ta.opts.line,function(b,c){a.opts(c,b)})};Ta.layer.line.prototype.layerGroup=function(){return["group","group_color","group_strokewidth"]};Ta.layer.line.prototype.render=function(a){var b=a.coord,c=a.scales,d=c.y_override||c.y;this.map("x");this.map("y");var e=this;h.each(a.computedData,function(f){var g;g=e.opts("domain")?e.fillZero(f,a,["$sum","$partial_1","$partial_2"]):f;b.poly().attr("func",{x:c.x,y:d,_sort:c.x,stroke:c.color,fill:"none", "stroke-width":c.strokewidth}).attr("data",g);if(100>f.len()){var h={cx:c.x,cy:d,r:c.strokewidth,stroke:"#FFFFFF",fill:c.color,symbol:c.symbol,"stroke-width":0};f.each(function(a){b.point().ggTooltip(c).attr("func",h).attr("data",a)})}})};Ta.layer.line.prototype.imputeMapping=function(a){return Ta.layer.base.prototype.imputeMapping.call(this,a,{group:["strokewidth","stroke","color"]})};Ta.layer.line.prototype.defaultMin=function(a){if("y"==a)return 0};var mb=q;mb.layer.path=l.makeClass("gg.layer.path", mb.layer.base);mb.layer.path.prototype.init=function(){mb.layer.base.prototype.init.call(this);var a=this;h.each(mb.opts.line,function(b,c){a.opts(c,b)})};mb.layer.path.prototype.render=function(a){var b=a.coord,c=a.scales,d=c.y_override||c.y;h.each(a.computedData,function(a){b.poly().attr("func",{x:c.x,y:d,stroke:c.color,fill:"none","stroke-width":c.strokewidth}).attr("data",a)})};mb.layer.line.prototype.imputeMapping=function(a){return mb.layer.base.prototype.imputeMapping.call(this,a,{group:["stroke", "color"]})};var Ua=q;Ua.layer.point=l.makeClass("gg.layer.point",Ua.layer.base);Ua.layer.point.prototype.init=function(){Ua.layer.base.prototype.init.call(this);var a=this;h.each(Ua.opts.point,function(b,c){a.opts(c,b)});this.opts("symbol",Ua.symbol.CIRCLE)};Ua.layer.point.prototype.render=function(a){var b=a.coord,c=a.scales,d={cx:c.x,cy:c.y_override||c.y,r:c.radius,symbol:c.symbol,_style:c};a.computedData.each(function(a){b.point().ggTooltip(c).attr("func",d).attr("data",a)},this.opts("render-max"))}; Ua.layer.point.prototype.imputeMapping=function(a){return Ua.layer.base.prototype.imputeMapping.call(this,a,{color:"stroke"})};Ua.layer.point.prototype.hasGroup=function(){return!1};Ua.layer.base.prototype.requiredMap=function(){return["x","y"]};var Db=q;Db.layer.text=l.makeClass("gg.layer.text",Db.layer.base);Db.layer.text.prototype.init=function(){Db.layer.base.prototype.init.call(this);var a=this;h.each(Db.opts.text,function(b,c){a.opts(c,b)})};Db.layer.text.prototype.render=function(a){var b= a.coord,c=a.scales,d=c.y_override||c.y;a.computedData.each(function(a){b.text().attr("func",{x:c.x,y:d,text:c.text,fill:c.color,"fill-opacity":c.opacity,"font-size":c.fontsize,"font-family":c.font}).attr("data",a)})};Db.layer.text.prototype.hasGroup=function(){return!1};var Qb=q;Qb.layer.tile=l.makeClass("gg.layer.tile",Qb.layer.base);Qb.layer.tile.prototype.init=function(){Qb.layer.base.prototype.init.call(this);this.opts("stroke","none").opts("padding",0.5)};Qb.layer.tile.prototype.render=function(a){var b= a.scales,c=a.rawScales.x.width(),d=a.rawScales.y.width(),e=c/2,f=d/2,g=a.coord;a.computedData.each(function(a){g.rect().attr("func",{x1:l.sub(b.x,e),y1:l.sub(b.y,f),x2:l.add(b.x,e),y2:l.add(b.y,f),_style:b}).attr("data",a)})};Qb.layer.tile.prototype.hasGroup=function(){return!1};var L=q;L.pivot=l.makeClass("gg.pivot");L.pivot.prototype.init=function(a){this._data=a;this._statData={};this._attr=l.cloneobj(L.opts.pivot);this._mapping={};this._levels={};this._stats=null;this._calculated=!1;this._scales= {}};L.pivot.prototype.data=l.dataGetter();L.pivot.prototype.map=function(a,b){if(1===arguments.length)return this._mapping[a];b?this._mapping[a]=b:delete this._mapping[a];this.resetCalculate();return this};L.pivot.prototype.levels=function(a,b){if(1===arguments.length)return this._levels[a]?this._levels[a]:this.callData("levels",a);b?this._levels[a]=b:delete this._levels[a];return this};L.pivot.prototype.getMap=function(){var a={};this._mapping.column&&(a.group_c=this._mapping.column);this._mapping.row&& (a.group_r=this._mapping.row);this._mapping.value&&(a.y=this._mapping.value);return a};L.pivot.prototype.getScale=function(a){return this._scales[a]};L.pivot.prototype.scale=function(a,b){if(!("column"!=a&&"row"!=a)){(b=l.instantiate(b))||L.error(201,"Attempting to add an undefined or malformed scale: "+b);var c=l.cloneobj(b);c.attach(this,a);this._scales[a]=c;return this}};L.pivot.prototype.opts=l.opts();L.pivot.prototype.stats=function(a){if(1===arguments.length)return(a=l.instantiate(a))||L.error(304, "Attempting to add an undefined or malformed statistic: "+a),this._stats=a,this.resetCalculate(),this;if(this._stats)return this._stats;var b=this._mapping.value,c=b?this._data.type(b):"";return"category"==c||!b?L.stats.count():"date"==c?L.stats.mean():L.stats.sum()};L.pivot.prototype.callData=function(a,b,c){if(!c||"data"==c)return this._data[a](b);if("aes"==c)return this._data[a](this.map(b));L.error(-1,"not supported "+c)};L.pivot.prototype.type=function(a,b){return this.callData("type",a,b)}; L.pivot.prototype.min=function(a,b){return this.callData("min",a,b)};L.pivot.prototype.max=function(a,b){return this.callData("max",a,b)};L.pivot.prototype.calculateStats=function(a,b){return a.calculateStats(this._data,b)[0]};L.pivot.prototype.calculate=function(){if(!this._calculated){var a=this.stats(),b={};this._scales.column&&(b.group_c=this._scales.column);this._scales.row&&(b.group_r=this._scales.row);var c=this.getMap(),b={scales:b,mapping:c,group_aes:[],attr:{y:this.opts("y"),x:this.opts("x")}, no_partials:!0};this._statData={};c.group_c&&c.group_r&&(b.group_aes=["group_c","group_r"],this._statData.cr=this.calculateStats(a,b));if(c.group_c){var d=b.mapping.group_r;delete b.mapping.group_r;b.group_aes=["group_c"];this._statData.c=this.calculateStats(a,b);b.mapping.group_r=d;delete b.mapping.group_c}c.group_r&&(b.group_aes=["group_r"],this._statData.r=this.calculateStats(a,b),delete b.mapping.group_r);this._statData.none=this.calculateStats(a,b);return this}};L.pivot.prototype.resetCalculate= function(){this._calculated=!1;this._default_stats=L.stats.sum;return this};L.pivot.prototype._getPrettifyFunction=function(a,b){var c=-Infinity,d=!0;h.each(a,function(a){h.each(a.get(b),function(a){a>c&&(c=a);d&&0!==a%1&&(d=!1)})});var e=Math.log(Math.abs(c))/Math.LN10;return d||3<=e?function(a){return l.prettify(a,0)}:function(a){return l.prettify(a,-Math.floor(e-2))}};var sf=function(a){return a.toString()};L.pivot.prototype._getColumnFormatter=function(){return!this.opts("colFormatter")?sf:this.opts("colFormatter")}; L.pivot.prototype._getRowFormatter=function(){return!this.opts("rowFormatter")?sf:this.opts("rowFormatter")};L.pivot.prototype._makeTableArray=function(){var a=this.map("column"),b=this.map("row"),c=this.stats().imputeMapping({}),d=c.y||c.y_override,e=a?this.levels(a):[],f=b?this.levels(b):[],g=this._getRowFormatter(),k=this._getColumnFormatter(),e=h.map(e,k),f=h.map(f,g),j=e.length,l=f.length,m=this._getPrettifyFunction(this._statData,d),n=Array(l+2),c=this.opts("title-all");n[0]=[""].concat(e).concat([c]); var q,r;for(r=1;r");a.css("color","black");a.css("width",h);a.css("margin-top",f);a.css("margin-bottom",g);a.css("margin-right",e);a.css("margin-left", d);b=b("");a.append(b);c.append(a);return b};L.pivot.prototype.render=function(a){this.calculate();var b=this._makeTableArray();a=a||this.opts("dom");a=this.makeTableDom(a);var c,d,e,f;e=b[0]?b[0].length+2:2;d=b[0]?b[0].length:1;var g=b[0]?b.length:1,k=this.opts("title");c=$("");e=$("").attr("colspan",e);e.text(h.isUndefined(k)?" ":k);e.css("textAlign","center");e.css("paddingBottom","5px");c.append(e);a.append(c);k=this.opts("title-column")||this.map("column");c= $("");c.append($(""));c.append($(""));e=$("").attr("colspan",d);e.text(k);e.css("textAlign","center");e.css("paddingBottom","5px");e.css("font-weight","normal");k&&e.css("border","1px solid black");c.append(e);a.append(c);for(var j,k=0;k");0===k?c.append($("")):1==k&&(f=this.opts("title-row")||this.map("row"),e=$("").attr("rowspan",g),j=$("
"),j.text(f),j.css("-webkit-transform","rotate(270deg)"),j.css("-moz-transform", "rotate(270deg)"),j.css("-ms-transform","rotate(270deg)"),j.css("-o-transform","rotate(270deg)"),e.css("paddingBottom","5px"),e.css("font-weight","normal"),f&&e.css("border","1px solid black"),e.css("textAlign","center"),e.css("verticalAlign","middle"),e.append(j),c.append(e));for(j=0;j":""),e.text(h.isUndefined(f)?" \u00a0":f),c.append(e),e.css("minWidth","50px"),e.css("width",100/d.length+"%"),e.css("minHeight","22px"),e.css("height",100/b.length+ "%"),e.css("padding","2px"),0==k&&0==j||(0==k||0==j?e.css("border","1px solid black"):(e.css("border","1px solid gray"),e.css("textAlign","right")));a.append(c)}return this};var ca=q;ca.scale.continuous=l.makeClass("gg.scale.continuous",ca.scale.base);ca.scale.continuous.prototype.init=function(a,b,c){ca.scale.base.prototype.init.call(this);this._type="number";this._d3scale=null;this._attr.min=h.isNumber(b)?b:null;this._attr.max=h.isNumber(c)?c:null;this._useDefault=!1;this._defaultMax=this._defaultMin= null;this.opts("transform",a||"linear");this.opts("expand",0);"log"===this.opts("transform")&&this.opts("absolute_min",0.1)};ca.scale.continuous.prototype.domain=function(a){return 1===arguments.length?(this.min(a[0]),this.max(a[1]),this):[this._attr.domain_low,this._attr.domain_high]};ca.scale.continuous.prototype.width=function(){this._attr.width||(this._attr.width=this._makeWidth());return this._attr.width};ca.scale.continuous.prototype.maxLabelWidth=function(){var a=this._graph.max(this._aes), b=this._graph.min(this._aes),b=Math.floor(Math.log((a-b)/10)/Math.LN10);return a?l.strlenToPixel(l.prettify(a,-b).length):15};ca.scale.continuous.prototype.distance=function(a,b){return Math.abs(this._d3scale(a)-this._d3scale(b))};ca.scale.continuous.prototype._makeDefaultMinMax=function(){if(this._graph){var a=this._aes,b=this._graph.min(a),c=this._graph.max(a);this._defaultMin=this._graph.defaultMin(a,b);this._defaultMax=this._graph.defaultMax(a,c);h.isNumber(this._defaultMin)&&this._defaultMin< this._attr.absolute_min&&(this._defaultMin=this._attr.absolute_min);h.isNumber(this._defaultMax)&&this._defaultMax>this._attr.absolute_max&&(this._defaultMax=this._attr.absolute_max)}};ca.scale.continuous.prototype._makeWidth=function(){var a=this._graph.levels(this._aes,null,this._facetIndex);if(1>=a.length)a=this.rangeSize();else var b=h.bind(this._apply,this),a=l.minimumDelta(h.map(a,b));return Math.max(a,1)};ca.scale.continuous.prototype._makeDomain=function(){this._makeDefaultMinMax();var a= this._aes,b=this._attr.min,c=this._attr.max,d;d=0;var e=2;h.isNumber(b)&&h.isNumber(c)?(d=b,e=c):0this._defaultMin&&(d=this._defaultMin), h.isNumber(this._defaultMax)&&ae&&ca.error(408,"min is set to be bigger than max in a continuous scale."); this.opts("domain_low",d);this.opts("domain_high",e);return[d,e]};ca.scale.continuous.prototype.make=function(a){this.range()||ca.error(407,"Continuous scale's range is not set.");var b=this.opts("transform");this._d3scale="log"==b?j.scale.log():"sqrt"==b?j.scale.sqrt():j.scale.linear();this._facetIndex=h.isNumber(a)?a:-1;a=this._makeDomain();this._d3scale.domain(a).range(this.range());return this};ca.scale.continuous.prototype._apply=function(a){this._d3scale||this.make();if(null===a)return null; 0===a&&"log"==this.opts("transform")&&(a=this._attr.domain_low);return this._d3scale(a)};ca.scale.continuous.prototype.ticks=function(a,b){var c=0,d=this._attr.domain_low,e=this._attr.domain_high,f="log"==this.opts("transform"),g=this._suggestNumticks(a,b);f&&(d=Math.max(Math.log(d)/Math.LN10,0),e=Math.log(e)/Math.LN10,c=ca.opts.epsilon);var h=e-d,j=Math.pow(10,Math.floor(Math.log(h/g)/Math.LN10)),g=g/h*j;0.15>=g?j*=10:0.35>=g?j*=5:0.75>=g&&(j*=2);g=[];d=Math.ceil(d/j)*j;f&&(d-=1);for(h=-Math.floor(Math.log(j)/ Math.LN10);d<=e+c;){var m=d,q=m;if(f){if(0!==m%1&&0.1>=m%1){d+=j;continue}if(m%1>c&&(m=Math.floor(m)+Math.log(10*(m%1))/Math.LN10,0==m%1)){d+=j;continue}m=Math.exp(m*Math.LN10);if(m>this._attr.domain_high+c)break;if(m=a)this._d3scale=j.scale.category10();else if(20>=a)this._d3scale=j.scale.category20();else{this._colorTable={};var b;for(b=0;b= a||864E5>=a?l.strlenToPixel(15):1296E6>=a||10368E6>=a?l.strlenToPixel(9):l.strlenToPixel(4)};var nb=q;nb.scale.time_gradient=l.makeClass("gg.scale.time_gradient",nb.scale.time);nb.scale.time_gradient.prototype.init=function(a,b){nb.scale.time.prototype.init.call(this);this._attr.range_low=a||nb.opts.gradient.low;this._attr.range_high=b||nb.opts.gradient.high;this._d3scale=null};nb.scale.time.prototype.make=function(){this._d3scale=j.time.scale();var a=this._makeDomain();this._d3scale.domain(a).range(this.range())}; nb.scale.time_gradient.prototype._apply=function(a){this._d3scale||this.make();return this._d3scale(a)};var Kc=q;Kc.stats.bin=l.makeClass("gg.stats.bin",Kc.stats.sum);Kc.stats.bin.prototype.compute=function(a,b){var c=a.getObject(0),d=a.len(),e=b.mapping.y;if(e)for(var f=1;fj+1.5*q;)e--;f=f[e];d.$q0=t;d.$q1=g;d.$q2=j;d.$q3=m;d.$q4=f;l.assertNumber(t); l.assertNumber(g);l.assertNumber(j);l.assertNumber(m);l.assertNumber(f);d=[d];for(g=0;gf||c[g]t?(n.$partial_1=j,j+=t,n.$partial_2=j):(n.$partial_1=g,g+=t,n.$partial_2=g);e.push(n)}else for(q=0;q=b&&Gb.error(900,"Cannot create a grouping function where min is "+a+" and max is "+b);0>=c&&Gb.error(901,"Cannot create a grouping function where number of bins is less than 1."); var d=b-a;b=function(b){b=Math.floor((b-a)/d*c);b==c&&(b=c-1);return a+b*d/c};b.width=d/c;return b};Gb.stats.tilestat.prototype.imputeMapping=function(a){a=Gb.stats.base.prototype.imputeMapping.call(this,a,{group_stats_1:"x",group_stats_2:"y"});return h.extend(a,{y:"$count"})};var qb=q;qb.stats.unique=l.makeClass("gg.stats.unique",qb.stats.aggregate);qb.stats.unique.prototype.compute=function(a,b){var c=b.mapping,d=a.getObject(0),c=c.y;d.$unique=c?a.levels(c).length:0;c=this.makeMeta(a);return qb.data([d], c)};qb.stats.unique.prototype.imputeMapping=function(a){a=qb.stats.aggregate.prototype.imputeMapping.call(this,a,{group_stats:"x"});return h.extend(a,{y_override:"$unique"})};qb.stats.unique.prototype.keys=function(){return qb.stats.aggregate.prototype.keys.call(this).concat(["$unique"])};var La=q;La.symbol=La.symbol||{};var qh=Math.sqrt(2),uf=Math.sqrt(3)/2,vf=Math.sqrt(3)/2,wf=-Math.sqrt(3)/2,xf=-Math.sqrt(3)/2,rh=(Math.sqrt(5)-1)/4,eb=function(a){return Math.cos(36*(Math.PI/180)*a)},fb=function(a){return Math.sin(36* (Math.PI/180)*a)},sh=eb(1),th=eb(2),uh=eb(3),vh=eb(4),wh=eb(5),xh=eb(6),yh=eb(7),zh=eb(8),Ah=eb(9),Bh=fb(1),Ch=fb(2),Dh=fb(3),Eh=fb(4),Fh=fb(5),Gh=fb(6),Hh=fb(7),Ih=fb(8),Jh=fb(9);La.symbol.CIRCLE=1;La.symbol.BOX=2;La.symbol.DIAMOND=3;La.symbol.HEX=4;La.symbol.TRIANGLE=5;La.symbol.TRIANGLE_REVERSE=6;La.symbol.STAR=7;La.symbol.CROSS=8;La.symbol.X=9;La.symbol.makePath=function(a,b,c,d){if(1==a)return[["M",b,c+d],["A",d,d,0,1,1,b,c-d],["A",d,d,0,1,1,b,c+d],["Z"]];if(2==a)return[["M",b+d,c+d],["L",b- d,c+d],["L",b-d,c-d],["L",b+d,c-d],["Z"]];if(3==a)return[["M",b+d,c],["L",b,c+d],["L",b-d,c],["L",b,c-d],["Z"]];if(4==a)return[["M",b+0*d,c+1*d],["L",b+d*uf,c+0.5*d],["L",b+d*vf,c+-0.5*d],["L",b+0*d,c+-1*d],["L",b+d*wf,c+-0.5*d],["L",b+d*xf,c+0.5*d],["Z"]];if(6==a)return[["M",b+0*d,c+1*d],["L",b+d*vf,c+-0.5*d],["L",b+d*wf,c+-0.5*d],["Z"]];if(5==a)return[["M",b+d*uf,c+0.5*d],["L",b+0*d,c+-1*d],["L",b+d*xf,c+0.5*d],["Z"]];if(7==a)return a=d*rh,[["M",b+0*a,c+1*a],["L",b+d*Bh,c+d*sh],["L",b+a*Ch,c+a* th],["L",b+d*Dh,c+d*uh],["L",b+a*Eh,c+a*vh],["L",b+d*Fh,c+d*wh],["L",b+a*Gh,c+a*xh],["L",b+d*Hh,c+d*yh],["L",b+a*Ih,c+a*zh],["L",b+d*Jh,c+d*Ah],["Z"]];if(8==a)return[["M",b+d,c],["L",b,c],["L",b,c+d],["L",b,c],["L",b-d,c],["L",b,c],["L",b,c-d],["L",b,c],["Z"]];if(9==a)return a=d*qh/2,[["M",b+a,c+a],["L",b,c],["L",b+a,c-a],["L",b,c],["L",b-a,c+a],["L",b,c],["L",b-a,c-a],["L",b,c],["Z"]]};var W=q;W.type.category=l.makeClass("gg.type.category",W.type.base);W.type.category.prototype.min=function(){W.error(802, "Invalid operation min() on categorical variable.")};W.type.category.prototype.max=function(){W.error(802,"Invalid operation max() on categorical variable.")};W.type.category.prototype.coerce=function(a){return W.type.category.prototype.represent(a)};W.type.category.prototype.represent=function(a){return h.isString(a)?a:null==a?"":h.isNumber(a)?a.toString():""+a};W.type.category.prototype.sort=function(a,b){if(a===b)return 0;h.isString(a)||(a=""+a);h.isString(b)||(b=""+b);var c=a.toLowerCase(),d= b.toLowerCase();return c===d?ab?1:0:cd?1:0};W.type.category.prototype.validate=function(){return!0};W.type.category.prototype.defaultScale=function(a){l.assertAes(a);var b=null,b=(b={color:W.scale.palette,opacity:W.scale.discrete,radius:W.scale.discrete,stroke:W.scale.palette,strokewidth:W.scale.discrete,symbol:W.scale.symbol,x:W.scale.discrete,y:W.scale.discrete}[a])?b():W.scale.id();this._postProcess(a,b);return b};var oa=q;oa.type.date=l.makeClass("gg.type.date",oa.type.base);var yf= function(a){return h.isNumber(a)?a:a.getTime()};oa.type.date.prototype.min=function(a){return this.coerce(h.min(h.reject(a,h.isNull),yf))};oa.type.date.prototype.max=function(a){return this.coerce(h.max(h.reject(a,h.isNull),yf))};oa.type.date.prototype.coerce=function(a){return h.isDate(a)?a.getTime():h.isNumber(a)?a:Number(a)};oa.type.date.prototype.represent=function(a){return h.isNumber(a)?a:h.isDate(a)?a.getTime():null};oa.type.date.prototype.validate=function(a){return h.isNumber(a)||h.isDate(a)}; oa.type.date.prototype.defaultScale=function(a){l.assertAes(a);var b=null,b=(b={color:oa.scale.time_gradient,opacity:oa.scale.time,radius:oa.scale.time,stroke:oa.scale.time_gradient,strokewidth:oa.scale.time,symbol:oa.scale.symbol,x:oa.scale.time,y:oa.scale.time}[a])?b():oa.scale.id();this._postProcess(a,b);return b};var Z=q;Z.type.number=l.makeClass("gg.type.number",Z.type.base);Z.type.number.prototype.min=Z.type.date.prototype.min;Z.type.number.prototype.max=Z.type.date.prototype.max;Z.type.number.prototype.coerce= function(a){return h.isDate(a)?a.getTime():h.isNumber(a)?a:Number(a)};Z.type.number.prototype.represent=Z.type.date.prototype.represent;Z.type.number.prototype.validate=function(a){return h.isNumber(a)};Z.type.number.prototype.sort=function(a,b){return a===b?0:null==a?-1:null==b?1:ab?1:0};Z.type.number.prototype.defaultScale=function(a){l.assertAes(a);var b=null,b=(b={color:Z.scale.gradient,opacity:Z.scale.continuous,radius:Z.scale.continuous,stroke:Z.scale.gradient,strokewidth:Z.scale.continuous, symbol:Z.scale.symbol,x:Z.scale.continuous,y:Z.scale.continuous}[a])?b():Z.scale.id();this._postProcess(a,b);return b};var gb=q;gb.type.unknown=l.makeClass("gg.type.unknown",gb.type.base);gb.type.unknown.prototype.min=function(){return null};gb.type.unknown.prototype.max=function(){return null};gb.type.unknown.prototype.coerce=function(a){return a};gb.type.unknown.prototype.represent=function(a){return a};gb.type.unknown.prototype.validate=function(){return!0};gb.type.unknown.prototype.defaultScale= function(){gb.error(801,"Attempted to call defaultScale() on unknown type.")};var hb=q,Mc=q,Mc=Mc||{},Sb=function(a,b){a||hb.error(1,"Attempting to package an object that does not exist.");for(var c=b.length,d=0;d