Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Aisch <contact@vis4.net>2013-03-03 15:22:06 +0400
committerGregor Aisch <contact@vis4.net>2013-03-03 15:22:06 +0400
commit78e1353b2ea620aced41cda37d53b7b093772ac4 (patch)
tree5f003e509c4caa8b8b6dccc752e77ef5c7ec0f4a /plugins
parent51dcb8e51932ba7938883915db11792bed726f98 (diff)
upgraded to latest version of chroma.js
Diffstat (limited to 'plugins')
-rw-r--r--plugins/UserCountryMap/js/realtime-map.js2
-rw-r--r--plugins/UserCountryMap/js/vendor/chroma.min.js60
-rw-r--r--plugins/UserCountryMap/js/visitor-map.js32
3 files changed, 40 insertions, 54 deletions
diff --git a/plugins/UserCountryMap/js/realtime-map.js b/plugins/UserCountryMap/js/realtime-map.js
index ef0f20c4d6..93462dc68f 100644
--- a/plugins/UserCountryMap/js/realtime-map.js
+++ b/plugins/UserCountryMap/js/realtime-map.js
@@ -193,7 +193,7 @@
42 * age(r), // hue
Math.sqrt(age(r)), // saturation
(engaged ? 0.65 : 0.5) - (1-age(r))* 0.45 // lightness
- );
+ ).hex();
return col;
}
diff --git a/plugins/UserCountryMap/js/vendor/chroma.min.js b/plugins/UserCountryMap/js/vendor/chroma.min.js
index f7d277fd4e..6e8ed35d5b 100644
--- a/plugins/UserCountryMap/js/vendor/chroma.min.js
+++ b/plugins/UserCountryMap/js/vendor/chroma.min.js
@@ -1,43 +1,33 @@
/**
- chroma.js - a neat JS lib for color conversions
- Copyright (C) 2011 Gregor Aisch
+ chroma.js - color manipulation in javascript
- The JavaScript code in this page is free software: you can
- redistribute it and/or modify it under the terms of the GNU
- General Public License (GNU GPL) as published by the Free Software
- Foundation, either version 3 of the License, or (at your option)
- any later version. The code is distributed WITHOUT ANY WARRANTY;
- without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+ Copyright (c) 2011-2013, Gregor Aisch
+ All rights reserved.
- As additional permission under GNU GPL version 3 section 7, you
- may distribute non-source (e.g., minimized or compacted) forms of
- that code without the copy of the GNU GPL normally required by
- section 4, provided you include this license notice and a URL
- through which recipients can access the Corresponding Source.
-
- @source: https://github.com/gka/chroma.js
-
-**/
-// Generated by CoffeeScript 1.3.2
-/**
- chroma.js - a neat JS lib for color conversions
- Copyright (C) 2011 Gregor Aisch
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
- The JavaScript code in this page is free software: you can
- redistribute it and/or modify it under the terms of the GNU
- General Public License (GNU GPL) as published by the Free Software
- Foundation, either version 3 of the License, or (at your option)
- any later version. The code is distributed WITHOUT ANY WARRANTY;
- without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
+ * The name Gregor Aisch may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
- As additional permission under GNU GPL version 3 section 7, you
- may distribute non-source (e.g., minimized or compacted) forms of
- that code without the copy of the GNU GPL normally required by
- section 4, provided you include this license notice and a URL
- through which recipients can access the Corresponding Source.
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@source: https://github.com/gka/chroma.js
*/
-(function(){var a,b,c,d,e,f,g,h,i,j,k,l,m={}.hasOwnProperty,n=function(a,b){function d(){this.constructor=a}for(var c in b)m.call(b,c)&&(a[c]=b[c]);d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype;return a};h=typeof exports!="undefined"&&exports!==null?exports:this,g=(j=h.chroma)!=null?j:h.chroma={},typeof module!="undefined"&&module!==null&&(module.exports=g),g.version="0.3.1",c=function(){function a(b,c,d,e){var f,g;f=this,b==null&&c==null&&d==null&&e==null&&(b=[255,0,255]),i(b)==="array"&&b.length===3&&(e==null&&(e=c),g=b,b=g[0],c=g[1],d=g[2]),i(b)==="string"?e="hex":e==null&&(e="rgb"),e==="rgb"?f.rgb=[b,c,d]:e==="hsl"?f.rgb=a.hsl2rgb(b,c,d):e==="hsv"?f.rgb=a.hsv2rgb(b,c,d):e==="hex"?f.rgb=a.hex2rgb(b):e==="lab"?f.rgb=a.lab2rgb(b,c,d):e==="hcl"?f.rgb=a.hcl2rgb(b,c,d):e==="hsi"&&(f.rgb=a.hsi2rgb(b,c,d))}a.prototype.hex=function(){return a.rgb2hex(this.rgb)},a.prototype.toString=function(){return this.hex()},a.prototype.hsl=function(){return a.rgb2hsl(this.rgb)},a.prototype.hsv=function(){return a.rgb2hsv(this.rgb)},a.prototype.lab=function(){return a.rgb2lab(this.rgb)},a.prototype.hcl=function(){return a.rgb2hcl(this.rgb)},a.prototype.hsi=function(){return a.rgb2hsi(this.rgb)},a.prototype.interpolate=function(b,c,d){var e,f,g,h,j,k,l,m,n,o,p,q,r;m=this,d==null&&(d="rgb"),i(c)==="string"&&(c=new a(c));if(d==="hsl"||d==="hsv"||d==="hcl"||d==="hsi"){d==="hsl"?(q=m.hsl(),r=c.hsl()):d==="hsv"?(q=m.hsv(),r=c.hsv()):d==="hcl"?(q=m.hcl(),r=c.hcl()):d==="hsi"&&(q=m.hsi(),r=c.hsi()),g=q[0],o=q[1],k=q[2],h=r[0],p=r[1],l=r[2];if(!isNaN(g)&&!isNaN(h))h>g&&h-g>180?e=h-(g+360):h<g&&g-h>180?e=h+360-g:e=h-g,f=g+b*e;else if(!isNaN(g)){f=g;if(l===1||l===0)n=o}else if(!isNaN(h)){f=h;if(k===1||k===0)n=p}else f=void 0;n==null&&(n=o+b*(p-o)),j=k+b*(l-k);return new a(f,n,j,d)}if(d==="rgb"){q=m.rgb,r=c.rgb;return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}if(d==="lab"){q=m.lab(),r=c.lab();return new a(q[0]+b*(r[0]-q[0]),q[1]+b*(r[1]-q[1]),q[2]+b*(r[2]-q[2]),d)}throw"color mode "+d+" is not supported"};return a}(),c.hex2rgb=function(a){var b,c,d,e;if(!a.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))if(g.colors!=null&&g.colors[a])a=g.colors[a];else throw"unknown color format: "+a;if(a.length===4||a.length===7)a=a.substr(1);a.length===3&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),e=parseInt(a,16),d=e>>16,c=e>>8&255,b=e&255;return[d,c,b]},c.rgb2hex=function(a,b,c){var d,e,f;a!==void 0&&a.length===3&&(f=a,a=f[0],b=f[1],c=f[2]),e=a<<16|b<<8|c,d="000000"+e.toString(16).toUpperCase();return"#"+d.substr(d.length-6)},c.hsv2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t;i(a)==="array"&&a.length===3&&(n=a,a=n[0],b=n[1],h=n[2]),c*=255;if(b===0&&isNaN(a))l=f=d=c;else{a===360&&(a=0),a>360&&(a-=360),a<0&&(a+=360),a/=60,g=Math.floor(a),e=a-g,j=c*(1-b),k=c*(1-b*e),m=c*(1-b*(1-e));switch(g){case 0:o=[c,m,j],l=o[0],f=o[1],d=o[2];break;case 1:p=[k,c,j],l=p[0],f=p[1],d=p[2];break;case 2:q=[j,c,m],l=q[0],f=q[1],d=q[2];break;case 3:r=[j,k,c],l=r[0],f=r[1],d=r[2];break;case 4:s=[m,j,c],l=s[0],f=s[1],d=s[2];break;case 5:t=[c,j,k],l=t[0],f=t[1],d=t[2]}}l=Math.round(l),f=Math.round(f),d=Math.round(d);return[l,f,d]},c.rgb2hsv=function(a,b,c){var d,e,f,g,h,i,j;a!==void 0&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),g=Math.min(a,b,c),f=Math.max(a,b,c),d=f-g,i=f/255,h=d/f,h===0?(e=void 0,h=0):(a===f&&(e=(b-c)/d),b===f&&(e=2+(c-a)/d),c===f&&(e=4+(a-b)/d),e*=60,e<0&&(e+=360));return[e,h,i]},c.hsl2rgb=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;a!==void 0&&a.length===3&&(m=a,a=m[0],b=m[1],c=m[2]);if(b===0)h=f=d=c*255;else{k=[0,0,0],e=[0,0,0],j=c<.5?c*(1+b):c+b-c*b,i=2*c-j,a/=360,k[0]=a+1/3,k[1]=a,k[2]=a-1/3;for(g=l=0;l<=2;g=++l)k[g]<0&&(k[g]+=1),k[g]>1&&(k[g]-=1),6*k[g]<1?e[g]=i+(j-i)*6*k[g]:2*k[g]<1?e[g]=j:3*k[g]<2?e[g]=i+(j-i)*(2/3-k[g])*6:e[g]=i;n=[Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)],h=n[0],f=n[1],d=n[2]}return[h,f,d]},c.rgb2hsl=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=Math.max(a,b,c),e=(f+g)/2,f===g?(h=0,d=void 0):h=e<.5?(f-g)/(f+g):(f-g)/(2-f-g),a===f?d=(b-c)/(f-g):b===f?d=2+(c-a)/(f-g):c===f&&(d=4+(a-b)/(f-g)),d*=60,d<0&&(d+=360);return[d,h,e]},c.lab2xyz=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=function(a){return a>6/29?a*a*a:3*(6/29)*(6/29)*(a-4/29)},f=(a+.16)/1.16,e=[.96421,1,.82519],h=e[1]*d(f),g=e[0]*d(f+b/5),j=e[2]*d(f-c/2);return[g,h,j]},c.xyz2rgb=function(a,b,c){var d,e,f,g,h,j,k,l,m,n;i(a)==="array"&&a.length===3&&(m=a,a=m[0],b=m[1],c=m[2]),l=3.2406*a-1.5372*b-.4986*c,j=-0.9689*a+1.8758*b+.0415*c,e=.0557*a-.204*b+1.057*c,f=Math.min(l,j,e)<-0.001||Math.max(l,j,e)>1.001,f&&(l=l<0?0:l>1?1:l,j=j<0?0:j>1?1:j,e=e<0?0:e>1?1:e),f&&(n=[void 0,void 0,void 0],l=n[0],j=n[1],e=n[2]),g=function(a){var b;b=.055;return a<=.0031308?12.92*a:(1+b)*Math.pow(a,1/2.4)-b},k=Math.round(255*g(l)),h=Math.round(255*g(j)),d=Math.round(255*g(e));return[k,h,d]},c.lab2rgb=function(a,b,d){var e,f,g,h,i,j;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],d=i[2]),j=c.lab2xyz(a,b,d),e=j[0],f=j[1],g=j[2];return c.xyz2rgb(e,f,g)},c.hcl2lab=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),a/=360,e=6.283185307179586,d=c*.61+.09,g=e/6-a*e,j=(c*.311+.125)*b,f=Math.sin(g)*j,h=Math.cos(g)*j;return[d,f,h]},c.hcl2rgb=function(a,b,d){var e,f,g,h;h=c.hcl2lab(a,b,d),e=h[0],f=h[1],g=h[2];return c.lab2rgb(e,f,g)},c.rgb2xyz=function(a,b,c){var d,e,f,g,h,i,j,k;a!==void 0&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=function(a){var b;b=.055;return a<=.04045?a/12.92:Math.pow((a+b)/(1+b),2.4)},g=e(a/255),f=e(b/255),d=e(c/255),h=.4124*g+.3576*f+.1805*d,i=.2126*g+.7152*f+.0722*d,j=.0193*g+.1192*f+.9505*d;return[h,i,j]},c.xyz2lab=function(a,b,c){var d,e,f,g,h,i;a!==void 0&&a.length===3&&(i=a,a=i[0],b=i[1],c=i[2]),g=[.96421,1,.82519],f=function(a){return a>Math.pow(6/29,3)?Math.pow(a,1/3):7.787037037037035*a+4/29},h=1.16*f(b/g[1])-.16,d=5*(f(a/g[0])-f(b/g[1])),e=2*(f(b/g[1])-f(c/g[2]));return[h,d,e]},c.rgb2lab=function(a,b,d){var e,f,g,h,i;a!==void 0&&a.length===3&&(h=a,a=h[0],b=h[1],d=h[2]),i=c.rgb2xyz(a,b,d),e=i[0],f=i[1],g=i[2];return c.xyz2lab(e,f,g)},c.lab2hcl=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),d=a,a=(a-.09)/.61,h=Math.sqrt(b*b+c*c),j=h/(a*.311+.125),e=6.283185307179586,f=Math.atan2(b,c),g=(e/6-f)/e,g*=360,g<0&&(g+=360);return[g,j,a]},c.rgb2hcl=function(a,b,d){var e,f,g,h;i(a)==="array"&&a.length===3&&(g=a,a=g[0],b=g[1],d=g[2]),h=c.rgb2lab(a,b,d),f=h[0],e=h[1],d=h[2];return c.lab2hcl(f,e,d)},c.rgb2hsi=function(a,b,c){var d,e,f,g,h,j;i(a)==="array"&&a.length===3&&(j=a,a=j[0],b=j[1],c=j[2]),d=Math.PI*2,a/=255,b/=255,c/=255,g=Math.min(a,b,c),f=(a+b+c)/3,h=1-g/f,h===0?e=0:(e=(a-b+(a-c))/2,e/=Math.sqrt((a-b)*(a-b)+(a-c)*(b-c)),e=Math.acos(e),c>b&&(e=d-e),e/=d);return[e*360,h,f]},c.hsi2rgb=function(a,b,c){var d,e,f,g,h,j,k;i(a)==="array"&&a.length===3&&(k=a,a=k[0],b=k[1],c=k[2]),e=Math.PI*2,d=Math.PI/3,g=Math.cos,a<0&&(a+=360),a>360&&(a-=360),a/=360,a<1/3?(f=(1-b)/3,j=(1+b*g(e*a)/g(d-e*a))/3,h=1-(f+j)):a<2/3?(a-=1/3,j=(1-b)/3,h=(1+b*g(e*a)/g(d-e*a))/3,f=1-(j+h)):(a-=2/3,h=(1-b)/3,f=(1+b*g(e*a)/g(d-e*a))/3,j=1-(h+f)),j=c*j*3,h=c*h*3,f=c*f*3;return[j*255,h*255,f*255]},g.Color=c,g.hsl=function(a,b,d){return new c(a,b,d,"hsl")},g.hsv=function(a,b,d){return new c(a,b,d,"hsv")},g.rgb=function(a,b,d){return new c(a,b,d,"rgb")},g.hex=function(a){return new c(a)},g.lab=function(a,b,d){return new c(a,b,d,"lab")},g.hcl=function(a,b,d){return new c(a,b,d,"hcl")},g.hsi=function(a,b,d){return new c(a,b,d,"hsi")},g.interpolate=function(a,b,d,e){if(a==null||b==null)return"#000";i(a)==="string"&&(a=new c(a)),i(b)==="string"&&(b=new c(b));return a.interpolate(d,b,e)},d=function(){function a(a){var b,d,e,f,g,h,j,k,l,m,n,o;f=this,f.colors=e=(j=a.colors)!=null?j:["#ddd","#222"];for(b=g=0,k=e.length-1;0<=k?g<=k:g>=k;b=0<=k?++g:--g)d=e[b],i(d)==="string"&&(e[b]=new c(d));if(a.positions!=null)f.pos=a.positions;else{f.pos=[];for(b=h=0,l=e.length-1;0<=l?h<=l:h>=l;b=0<=l?++h:--h)f.pos.push(b/(e.length-1))}f.mode=(m=a.mode)!=null?m:"hsv",f.nacol=(n=a.nacol)!=null?n:"#ccc",f.setClasses((o=a.limits)!=null?o:[0,1]),f}a.prototype.getColor=function(a){var b,c,d,e;e=this;if(isNaN(a))return e.nacol;e.classLimits.length>2?(b=e.getClass(a),c=b/(e.numClasses-1)):(c=d=(a-e.min)/(e.max-e.min),c=Math.min(1,Math.max(0,c)));return e.fColor(c)},a.prototype.fColor=function(a){var b,c,d,e,f,h,i;e=this,c=e.colors;for(d=h=0,i=e.pos.length-1;0<=i?h<=i:h>=i;d=0<=i?++h:--h){f=e.pos[d];if(a<=f){b=c[d];break}if(a>=f&&d===e.pos.length-1){b=c[d];break}if(a>f&&a<e.pos[d+1]){a=(a-f)/(e.pos[d+1]-f),b=g.interpolate(c[d],c[d+1],a,e.mode);break}}return b},a.prototype.classifyValue=function(a){var b,c,d,e,f,g;g=this,c=g.classLimits,c.length>2&&(f=c.length-1,b=g.getClass(a),a=c[b]+(c[b+1]-c[b])*.5,e=c[0],d=c[f-1],a=g.min+(a-e)/(d-e)*(g.max-g.min));return a},a.prototype.setClasses=function(a){var b;a==null&&(a=[]),b=this,b.classLimits=b.limits=a,b.min=a[0],b.max=a[a.length-1];return a.length===2?b.numClasses=0:b.numClasses=a.length-1},a.prototype.getClass=function(a){var b,c,d,e;e=this,c=e.classLimits;if(c!=null){d=c.length-1,b=0;while(b<d&&a>=c[b])b++;return b-1}return void 0},a.prototype.validValue=function(a){return!isNaN(a)};return a}(),g.ColorScale=d,f=function(a){function b(a,c,d){a==null&&(a="#fe0000"),c==null&&(c="#feeeee"),d==null&&(d="hsl"),b.__super__.constructor.call(this,[a,c],[0,1],d)}n(b,a);return b}(d),g.Ramp=f,e=function(a){function b(a,c,d,e,f){var g;a==null&&(a="#d73027"),c==null&&(c="#ffffbf"),d==null&&(d="#1E6189"),e==null&&(e="mean"),f==null&&(f="hsl"),g=this,g.mode=f,g.center=e,b.__super__.constructor.call(this,[a,c,d],[0,.5,1],f)}n(b,a),b.prototype.parseData=function(a,c){var d,e;b.__super__.parseData.call(this,a,c),e=this,d=e.center,d==="median"?d=e.median:d==="mean"&&(d=e.mean);return e.pos[1]=(d-e.min)/(e.max-e.min)};return b}(d),g.Diverging=e,b=function(a){function b(a){var b;b=this,b.colors=a}n(b,a),b.prototype.parseData=function(a,b){},b.prototype.getColor=function(a){var b;b=this;return b.colors.hasOwnProperty(a)?b.colors[a]:"#cccccc"},b.prototype.validValue=function(a){return this.colors.hasOwnProperty(a)};return b}(d),g.Categories=b,a=function(a){function b(a){var b;b=this,b.name=a,b.setClasses(7),b}n(b,a),b.prototype.getColor=function(a){var b,c;c=this,b=c.getClass(a);return c.name+" l"+c.numClasses+" c"+b};return b}(d),g.CSSColors=a,(k=g.scales)==null&&(g.scales={}),g.scales.cool=function(){return new f(g.hsl(180,1,.9),g.hsl(250,.7,.4))},g.scales.hot=function(){return new d({colors:["#000000","#ff0000","#ffff00","#ffffff"],positions:[0,.25,.75,1],mode:"rgb"})},g.scales.BlWhOr=function(){return new e(g.hsl(30,1,.55),"#ffffff",new c(220,1,.55))},g.scales.GrWhPu=function(){return new e(g.hsl(120,.8,.4),"#ffffff",new c(280,.8,.4))},g.limits=function(a,b,c,d,e){var f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm;b==null&&(b="equal"),c==null&&(c=7),d==null&&(d=null),e==null&&(e=null),s=Number.MAX_VALUE,r=Number.MAX_VALUE*-1,C=0,G=[],e==null&&(e=function(){return!0});if(i(a)==="array")if(i(a[0])!=="object"&&i(a[0])!=="array")for(H=0,L=a.length;H<L;H++)E=a[H],isNaN(E&&e(E))||G.push(Number(E));else for(I=0,M=a.length;I<M;I++)B=a[I],e(B)&&G.push(Number(B[d]));else if(i(a)==="object")for(o in a)E=a[o],i(E)==="object"&&i(d)==="string"?isNaN(E[d]&&e(E))||G.push(Number(E[d])):i(E)==="array"&&i(d)==="number"?isNaN(E[d]&&e(E))||G.push(Number(E[d])):i(E)==="number"&&(isNaN(E&&e(E))||G.push(Number(E)));for(J=0,N=G.length;J<N;J++){E=G[J];if(!isNaN(E))E<s&&(s=E),E>r&&(r=E),C+=E;else continue}G=G.sort(function(a,b){return a-b}),q=[],b.substr(0,1)==="c"&&(q.push(s),q.push(r));if(b.substr(0,1)==="e"){q.push(s);for(m=K=1,$=c-1;1<=$?K<=$:K>=$;m=1<=$?++K:--K)q.push(s+m/c*(r-s));q.push(r)}else if(b.substr(0,1)==="q"){q.push(s);for(m=O=1,_=c-1;1<=_?O<=_:O>=_;m=1<=_?++O:--O)x=G.length*m/c,y=Math.floor(x),y===x?q.push(G[y]):(z=x-y,q.push(G[y]*z+G[y+1]*(1-z)));q.push(r)}else if(b.substr(0,1)==="k"){u=G.length,f=Array(u),k=Array(c),A=!0,v=0,h=null,h=[],h.push(s);for(m=P=1,ba=c-1;1<=ba?P<=ba:P>=ba;m=1<=ba?++P:--P)h.push(s+m/c*(r-s));h.push(r);while(A){for(n=Q=0,bb=c-1;0<=bb?Q<=bb:Q>=bb;n=0<=bb?++Q:--Q)k[n]=0;for(m=R=0,bc=u-1;0<=bc?R<=bc:R>=bc;m=0<=bc?++R:--R){F=G[m],t=Number.MAX_VALUE;for(n=S=0,bd=c-1;0<=bd?S<=bd:S>=bd;n=0<=bd?++S:--S)l=Math.abs(h[n]-F),l<t&&(t=l,g=n);k[g]++,f[m]=g}w=Array(c);for(n=T=0,be=c-1;0<=be?T<=be:T>=be;n=0<=be?++T:--T)w[n]=null;for(m=bg=0,bf=u-1;0<=bf?bg<=bf:bg>=bf;m=0<=bf?++bg:--bg)j=f[m],w[j]===null?w[j]=G[m]:w[j]+=G[m];for(n=bh=0,U=c-1;0<=U?bh<=U:bh>=U;n=0<=U?++bh:--bh)w[n]*=1/k[n];A=!1;for(n=bi=0,V=c-1;0<=V?bi<=V:bi>=V;n=0<=V?++bi:--bi)if(w[n]!==h[m]){A=!0;break}h=w,v++,v>200&&(A=!1)}p={};for(n=bj=0,W=c-1;0<=W?bj<=W:bj>=W;n=0<=W?++bj:--bj)p[n]=[];for(m=bk=0,X=u-1;0<=X?bk<=X:bk>=X;m=0<=X?++bk:--bk)j=f[m],p[j].push(G[m]);D=[];for(n=bl=0,Y=c-1;0<=Y?bl<=Y:bl>=Y;n=0<=Y?++bl:--bl)D.push(p[n][0]),D.push(p[n][p[n].length-1]);D=D.sort(function(a,b){return a-b}),q.push(D[0]);for(m=bm=1,Z=D.length-1;bm<=Z;m=bm+=2)isNaN(D[m])||q.push(D[m])}return q},h=typeof exports!="undefined"&&exports!==null?exports:this,i=function(){var a,b,c,d,e;a={},e="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(c=0,d=e.length;c<d;c++)b=e[c],a["[object "+b+"]"]=b.toLowerCase();return function(b){var c;c=Object.prototype.toString.call(b);return a[c]||"object"}}(),(l=h.type)==null&&(h.type=i),Array.max=function(a){return Math.max.apply(Math,a)},Array.min=function(a){return Math.min.apply(Math,a)}}).call(this);
+(function(){var Color,ColorScale,K,PITHIRD,TWOPI,X,Y,Z,brewer,chroma,colors,cos,hex2rgb,hsi2rgb,hsl2rgb,hsv2rgb,lab2lch,lab2rgb,lab_xyz,lch2lab,lch2rgb,limit,rgb2hex,rgb2hsi,rgb2hsl,rgb2hsv,rgb2lab,rgb2lch,rgb_xyz,root,type,unpack,xyz_lab,xyz_rgb,_ref,_ref1,_ref2,_ref3,_ref4,_ref5;root=typeof exports!=="undefined"&&exports!==null?exports:this;chroma=(_ref=root.chroma)!=null?_ref:root.chroma={};if(typeof module!=="undefined"&&module!==null){module.exports=chroma}Color=function(){function Color(x,y,z,m){var me,_ref1;me=this;if(!(x!=null)&&!(y!=null)&&!(z!=null)&&!(m!=null)){x=[255,0,255]}if(type(x)==="array"&&x.length===3){if(m==null){m=y}_ref1=x,x=_ref1[0],y=_ref1[1],z=_ref1[2]}if(type(x)==="string"){m="hex"}else{if(m==null){m="rgb"}}if(m==="rgb"){me._rgb=[x,y,z]}else if(m==="hsl"){me._rgb=hsl2rgb(x,y,z)}else if(m==="hsv"){me._rgb=hsv2rgb(x,y,z)}else if(m==="hex"){me._rgb=hex2rgb(x)}else if(m==="lab"){me._rgb=lab2rgb(x,y,z)}else if(m==="lch"){me._rgb=lch2rgb(x,y,z)}else if(m==="hsi"){me._rgb=hsi2rgb(x,y,z)}}Color.prototype.rgb=function(){return this._rgb};Color.prototype.hex=function(){return rgb2hex(this._rgb)};Color.prototype.toString=function(){return this.hex()};Color.prototype.hsl=function(){return rgb2hsl(this._rgb)};Color.prototype.hsv=function(){return rgb2hsv(this._rgb)};Color.prototype.lab=function(){return rgb2lab(this._rgb)};Color.prototype.lch=function(){return rgb2lch(this._rgb)};Color.prototype.hsi=function(){return rgb2hsi(this._rgb)};Color.prototype.interpolate=function(f,col,m){var dh,hue,hue0,hue1,lbv,lbv0,lbv1,me,sat,sat0,sat1,xyz0,xyz1;me=this;if(m==null){m="rgb"}if(type(col)==="string"){col=new Color(col)}if(m==="hsl"||m==="hsv"||m==="lch"||m==="hsi"){if(m==="hsl"){xyz0=me.hsl();xyz1=col.hsl()}else if(m==="hsv"){xyz0=me.hsv();xyz1=col.hsv()}else if(m==="hsi"){xyz0=me.hsi();xyz1=col.hsi()}else if(m==="lch"){xyz0=me.lch();xyz1=col.lch()}if(m.substr(0,1)==="h"){hue0=xyz0[0],sat0=xyz0[1],lbv0=xyz0[2];hue1=xyz1[0],sat1=xyz1[1],lbv1=xyz1[2]}else{lbv0=xyz0[0],sat0=xyz0[1],hue0=xyz0[2];lbv1=xyz1[0],sat1=xyz1[1],hue1=xyz1[2]}if(!isNaN(hue0)&&!isNaN(hue1)){if(hue1>hue0&&hue1-hue0>180){dh=hue1-(hue0+360)}else if(hue1<hue0&&hue0-hue1>180){dh=hue1+360-hue0}else{dh=hue1-hue0}hue=hue0+f*dh}else if(!isNaN(hue0)){hue=hue0;if(lbv1===1||lbv1===0){sat=sat0}}else if(!isNaN(hue1)){hue=hue1;if(lbv0===1||lbv0===0){sat=sat1}}else{hue=void 0}if(sat==null){sat=sat0+f*(sat1-sat0)}lbv=lbv0+f*(lbv1-lbv0);if(m.substr(0,1)==="h"){return new Color(hue,sat,lbv,m)}else{return new Color(lbv,sat,hue,m)}}else if(m==="rgb"){xyz0=me._rgb;xyz1=col._rgb;return new Color(xyz0[0]+f*(xyz1[0]-xyz0[0]),xyz0[1]+f*(xyz1[1]-xyz0[1]),xyz0[2]+f*(xyz1[2]-xyz0[2]),m)}else if(m==="lab"){xyz0=me.lab();xyz1=col.lab();return new Color(xyz0[0]+f*(xyz1[0]-xyz0[0]),xyz0[1]+f*(xyz1[1]-xyz0[1]),xyz0[2]+f*(xyz1[2]-xyz0[2]),m)}else{throw"color mode "+m+" is not supported"}};Color.prototype.darken=function(amount){var lch,me;if(amount==null){amount=.2}me=this;lch=me.lch();lch[2]-=amount;return chroma.lch(lch)};return Color}();hex2rgb=function(hex){var b,g,r,u;if(!hex.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)){if(chroma.colors!=null&&chroma.colors[hex]){hex=chroma.colors[hex]}else{throw"unknown color format: "+hex}}if(hex.length===4||hex.length===7){hex=hex.substr(1)}if(hex.length===3){hex=hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]}u=parseInt(hex,16);r=u>>16;g=u>>8&255;b=u&255;return[r,g,b]};rgb2hex=function(){var b,g,r,str,u,_ref1;_ref1=unpack(arguments),r=_ref1[0],g=_ref1[1],b=_ref1[2];u=r<<16|g<<8|b;str="000000"+u.toString(16).toUpperCase();return"#"+str.substr(str.length-6)};hsv2rgb=function(){var b,f,g,h,i,p,q,r,s,t,v,_ref1,_ref2,_ref3,_ref4,_ref5,_ref6,_ref7;_ref1=unpack(arguments),h=_ref1[0],s=_ref1[1],v=_ref1[2];v*=255;if(s===0){r=g=b=v}else{if(h===360){h=0}if(h>360){h-=360}if(h<0){h+=360}h/=60;i=Math.floor(h);f=h-i;p=v*(1-s);q=v*(1-s*f);t=v*(1-s*(1-f));switch(i){case 0:_ref2=[v,t,p],r=_ref2[0],g=_ref2[1],b=_ref2[2];break;case 1:_ref3=[q,v,p],r=_ref3[0],g=_ref3[1],b=_ref3[2];break;case 2:_ref4=[p,v,t],r=_ref4[0],g=_ref4[1],b=_ref4[2];break;case 3:_ref5=[p,q,v],r=_ref5[0],g=_ref5[1],b=_ref5[2];break;case 4:_ref6=[t,p,v],r=_ref6[0],g=_ref6[1],b=_ref6[2];break;case 5:_ref7=[v,p,q],r=_ref7[0],g=_ref7[1],b=_ref7[2]}}r=Math.round(r);g=Math.round(g);b=Math.round(b);return[r,g,b]};rgb2hsv=function(){var b,delta,g,h,max,min,r,s,v,_ref1;_ref1=unpack(arguments),r=_ref1[0],g=_ref1[1],b=_ref1[2];min=Math.min(r,g,b);max=Math.max(r,g,b);delta=max-min;v=max/255;if(max===0){h=void 0;s=0}else{s=delta/max;if(r===max){h=(g-b)/delta}if(g===max){h=2+(b-r)/delta}if(b===max){h=4+(r-g)/delta}h*=60;if(h<0){h+=360}}return[h,s,v]};hsl2rgb=function(){var b,c,g,h,i,l,r,s,t1,t2,t3,_i,_ref1,_ref2;_ref1=unpack(arguments),h=_ref1[0],s=_ref1[1],l=_ref1[2];if(s===0){r=g=b=l*255}else{t3=[0,0,0];c=[0,0,0];t2=l<.5?l*(1+s):l+s-l*s;t1=2*l-t2;h/=360;t3[0]=h+1/3;t3[1]=h;t3[2]=h-1/3;for(i=_i=0;_i<=2;i=++_i){if(t3[i]<0){t3[i]+=1}if(t3[i]>1){t3[i]-=1}if(6*t3[i]<1){c[i]=t1+(t2-t1)*6*t3[i]}else if(2*t3[i]<1){c[i]=t2}else if(3*t3[i]<2){c[i]=t1+(t2-t1)*(2/3-t3[i])*6}else{c[i]=t1}}_ref2=[Math.round(c[0]*255),Math.round(c[1]*255),Math.round(c[2]*255)],r=_ref2[0],g=_ref2[1],b=_ref2[2]}return[r,g,b]};rgb2hsl=function(r,g,b){var h,l,max,min,s,_ref1;if(r!==void 0&&r.length===3){_ref1=r,r=_ref1[0],g=_ref1[1],b=_ref1[2]}r/=255;g/=255;b/=255;min=Math.min(r,g,b);max=Math.max(r,g,b);l=(max+min)/2;if(max===min){s=0;h=void 0}else{s=l<.5?(max-min)/(max+min):(max-min)/(2-max-min)}if(r===max){h=(g-b)/(max-min)}else if(g===max){h=2+(b-r)/(max-min)}else if(b===max){h=4+(r-g)/(max-min)}h*=60;if(h<0){h+=360}return[h,s,l]};K=18;X=.95047;Y=1;Z=1.08883;lab2rgb=function(l,a,b){var g,r,x,y,z,_ref1,_ref2;if(l!==void 0&&l.length===3){_ref1=l,l=_ref1[0],a=_ref1[1],b=_ref1[2]}if(l!==void 0&&l.length===3){_ref2=l,l=_ref2[0],a=_ref2[1],b=_ref2[2]}y=(l+16)/116;x=y+a/500;z=y-b/200;x=lab_xyz(x)*X;y=lab_xyz(y)*Y;z=lab_xyz(z)*Z;r=xyz_rgb(3.2404542*x-1.5371385*y-.4985314*z);g=xyz_rgb(-.969266*x+1.8760108*y+.041556*z);b=xyz_rgb(.0556434*x-.2040259*y+1.0572252*z);return[limit(r,0,255),limit(g,0,255),limit(b,0,255)]};rgb2lab=function(){var b,g,r,x,y,z,_ref1;_ref1=unpack(arguments),r=_ref1[0],g=_ref1[1],b=_ref1[2];r=rgb_xyz(r);g=rgb_xyz(g);b=rgb_xyz(b);x=xyz_lab((.4124564*r+.3575761*g+.1804375*b)/X);y=xyz_lab((.2126729*r+.7151522*g+.072175*b)/Y);z=xyz_lab((.0193339*r+.119192*g+.9503041*b)/Z);return[116*y-16,500*(x-y),200*(y-z)]};lch2lab=function(){var c,h,l,_ref1;_ref1=unpack(arguments),l=_ref1[0],c=_ref1[1],h=_ref1[2];h=h*Math.PI/180;return[l,Math.cos(h)*c,Math.sin(h)*c]};lch2rgb=function(l,c,h){var L,a,b,g,r,_ref1,_ref2;_ref1=lch2lab(l,c,h),L=_ref1[0],a=_ref1[1],b=_ref1[2];_ref2=lab2rgb(L,a,b),r=_ref2[0],g=_ref2[1],b=_ref2[2];return[limit(r,0,255),limit(g,0,255),limit(b,0,255)]};lab_xyz=function(x){if(x>.206893034){return x*x*x}else{return(x-4/29)/7.787037}};xyz_lab=function(x){if(x>.008856){return Math.pow(x,1/3)}else{return 7.787037*x+4/29}};xyz_rgb=function(r){return Math.round(255*(r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055))};rgb_xyz=function(r){if((r/=255)<=.04045){return r/12.92}else{return Math.pow((r+.055)/1.055,2.4)}};lab2lch=function(){var a,b,c,h,l,_ref1;_ref1=unpack(arguments),l=_ref1[0],a=_ref1[1],b=_ref1[2];c=Math.sqrt(a*a+b*b);h=Math.atan2(b,a)/Math.PI*180;return[l,c,h]};rgb2lch=function(){var a,b,g,l,r,_ref1,_ref2;_ref1=unpack(arguments),r=_ref1[0],g=_ref1[1],b=_ref1[2];_ref2=rgb2lab(r,g,b),l=_ref2[0],a=_ref2[1],b=_ref2[2];return lab2lch(l,a,b)};rgb2hsi=function(){var TWOPI,b,g,h,i,min,r,s,_ref1;_ref1=unpack(arguments),r=_ref1[0],g=_ref1[1],b=_ref1[2];TWOPI=Math.PI*2;r/=255;g/=255;b/=255;min=Math.min(r,g,b);i=(r+g+b)/3;s=1-min/i;if(s===0){h=0}else{h=(r-g+(r-b))/2;h/=Math.sqrt((r-g)*(r-g)+(r-b)*(g-b));h=Math.acos(h);if(b>g){h=TWOPI-h}h/=TWOPI}return[h*360,s,i]};hsi2rgb=function(h,s,i){var b,g,r,_ref1;_ref1=unpack(arguments),h=_ref1[0],s=_ref1[1],i=_ref1[2];h/=360;if(h<1/3){b=(1-s)/3;r=(1+s*cos(TWOPI*h)/cos(PITHIRD-TWOPI*h))/3;g=1-(b+r)}else if(h<2/3){h-=1/3;r=(1-s)/3;g=(1+s*cos(TWOPI*h)/cos(PITHIRD-TWOPI*h))/3;b=1-(r+g)}else{h-=2/3;g=(1-s)/3;b=(1+s*cos(TWOPI*h)/cos(PITHIRD-TWOPI*h))/3;r=1-(g+b)}r=limit(i*r*3);g=limit(i*g*3);b=limit(i*b*3);return[r*255,g*255,b*255]};chroma.Color=Color;chroma.color=function(x,y,z,m){return new Color(x,y,z,m)};chroma.hsl=function(h,s,l){return new Color(h,s,l,"hsl")};chroma.hsv=function(h,s,v){return new Color(h,s,v,"hsv")};chroma.rgb=function(r,g,b){return new Color(r,g,b,"rgb")};chroma.hex=function(x){return new Color(x)};chroma.lab=function(l,a,b){return new Color(l,a,b,"lab")};chroma.lch=function(l,c,h){return new Color(l,c,h,"lch")};chroma.hsi=function(h,s,i){return new Color(h,s,i,"hsi")};chroma.interpolate=function(a,b,f,m){if(!(a!=null)||!(b!=null)){return"#000"}if(type(a)==="string"){a=new Color(a)}if(type(b)==="string"){b=new Color(b)}return a.interpolate(f,b,m)};root=typeof exports!=="undefined"&&exports!==null?exports:this;chroma=(_ref1=root.chroma)!=null?_ref1:root.chroma={};Color=chroma.Color;ColorScale=function(){function ColorScale(opts){var me,_ref2,_ref3;if(opts==null){opts={}}me=this;me.range(opts.colors,opts.positions);me._mode=(_ref2=opts.mode)!=null?_ref2:"rgb";me._nacol=chroma.hex((_ref3=opts.nacol)!=null?_ref3:chroma.hex("#ccc"));me.domain([0,1]);me}ColorScale.prototype.range=function(colors,positions){var c,col,me,_i,_j,_ref2,_ref3,_ref4;me=this;if(!(colors!=null)){colors=["#ddd","#222"]}if(colors!=null&&type(colors)==="string"&&((_ref2=chroma.brewer)!=null?_ref2[colors]:void 0)!=null){colors=chroma.brewer[colors].slice(0)}for(c=_i=0,_ref3=colors.length-1;0<=_ref3?_i<=_ref3:_i>=_ref3;c=0<=_ref3?++_i:--_i){col=colors[c];if(type(col)==="string"){colors[c]=new Color(col)}}me._colors=colors;if(positions!=null){me._pos=positions}else{me._pos=[];for(c=_j=0,_ref4=colors.length-1;0<=_ref4?_j<=_ref4:_j>=_ref4;c=0<=_ref4?++_j:--_j){me._pos.push(c/(colors.length-1))}}return me};ColorScale.prototype.domain=function(domain){var me;if(domain==null){domain=[]}me=this;me._domain=domain;me._min=domain[0];me._max=domain[domain.length-1];if(domain.length===2){me._numClasses=0}else{me._numClasses=domain.length-1}return me};ColorScale.prototype.get=function(value){var c,f,f0,me;me=this;if(isNaN(value)){return me._nacol}if(me._domain.length>2){c=me.getClass(value);f=c/(me._numClasses-1)}else{f=f0=(value-me._min)/(me._max-me._min);f=Math.min(1,Math.max(0,f))}return me.fColor(f)};ColorScale.prototype.fColor=function(f){var col,cols,i,me,p,_i,_ref2;me=this;cols=me._colors;for(i=_i=0,_ref2=me._pos.length-1;0<=_ref2?_i<=_ref2:_i>=_ref2;i=0<=_ref2?++_i:--_i){p=me._pos[i];if(f<=p){col=cols[i];break}if(f>=p&&i===me._pos.length-1){col=cols[i];break}if(f>p&&f<me._pos[i+1]){f=(f-p)/(me._pos[i+1]-p);col=chroma.interpolate(cols[i],cols[i+1],f,me._mode);break}}return col};ColorScale.prototype.classifyValue=function(value){var domain,i,maxc,me,minc,n,val;me=this;domain=me._domain;val=value;if(domain.length>2){n=domain.length-1;i=me.getClass(value);val=domain[i]+(domain[i+1]-domain[i])*.5;minc=domain[0];maxc=domain[n-1];val=me._min+(val-minc)/(maxc-minc)*(me._max-me._min)}return val};ColorScale.prototype.getClass=function(value){var domain,i,n,self;self=this;domain=self._domain;if(domain!=null){n=domain.length-1;i=0;while(i<n&&value>=domain[i]){i++}return i-1}return 0};ColorScale.prototype.validValue=function(value){return!isNaN(value)};return ColorScale}();chroma.ColorScale=ColorScale;chroma.scale=function(colors,positions){var colscale,f,out;colscale=new chroma.ColorScale;colscale.range(colors,positions);out=false;f=function(v){var c;c=colscale.get(v);if(out&&c[out]){return c[out]()}else{return c}};f.domain=function(domain,classes,mode){var d;if(mode==null){mode="e"}if(classes!=null){d=chroma.analyze(domain);if(classes===0){domain=[d.min,d.max]}else{domain=chroma.limits(d,mode,classes)}}colscale.domain(domain);return f};f.mode=function(_m){colscale._mode=_m;return f};f.range=function(_colors,_pos){colscale.range(_colors,_pos);return f};f.out=function(_o){out=_o;return f};return f};if((_ref2=chroma.scales)==null){chroma.scales={}}chroma.scales.cool=function(){return chroma.scale([chroma.hsl(180,1,.9),chroma.hsl(250,.7,.4)])};chroma.scales.hot=function(){return chroma.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")};chroma.analyze=function(data,key,filter){var add,k,r,val,visit,_i,_len;r={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};if(!(filter!=null)){filter=function(){return true}}add=function(val){if(val!=null&&!isNaN(val)){r.values.push(val);r.sum+=val;if(val<r.min){r.min=val}if(val>r.max){r.max=val}r.count+=1}};visit=function(val,k){if(filter(val,k)){if(key!=null&&type(key)==="function"){return add(key(val))}else if(key!=null&&type(key)==="str"||type(key)==="number"){return add(val[key])}else{return add(val)}}};if(type(data)==="array"){for(_i=0,_len=data.length;_i<_len;_i++){val=data[_i];visit(val)}}else{for(k in data){val=data[k];visit(val,k)}}r.domain=[r.min,r.max];r.limits=function(mode,num){return chroma.limits(r,mode,num)};return r};chroma.limits=function(data,mode,num){var assignments,best,centroids,cluster,clusterSizes,dist,i,j,kClusters,limits,max,min,mindist,n,nb_iters,newCentroids,p,pb,pr,repeat,sum,tmpKMeansBreaks,value,values,_i,_j,_k,_l,_m,_n,_o,_p,_q,_r,_ref10,_ref11,_ref12,_ref13,_ref14,_ref15,_ref16,_ref3,_ref4,_ref5,_ref6,_ref7,_ref8,_ref9,_s,_t,_u,_v;if(mode==null){mode="equal"}if(num==null){num=7}if(!(data.values!=null)){data=chroma.analyze(data)}min=data.min;max=data.max;sum=data.sum;values=data.values.sort(function(a,b){return a-b});limits=[];if(mode.substr(0,1)==="c"){limits.push(min);limits.push(max)}if(mode.substr(0,1)==="e"){limits.push(min);for(i=_i=1,_ref3=num-1;1<=_ref3?_i<=_ref3:_i>=_ref3;i=1<=_ref3?++_i:--_i){limits.push(min+i/num*(max-min))}limits.push(max)}else if(mode.substr(0,1)==="q"){limits.push(min);for(i=_j=1,_ref4=num-1;1<=_ref4?_j<=_ref4:_j>=_ref4;i=1<=_ref4?++_j:--_j){p=values.length*i/num;pb=Math.floor(p);if(pb===p){limits.push(values[pb])}else{pr=p-pb;limits.push(values[pb]*pr+values[pb+1]*(1-pr))}}limits.push(max)}else if(mode.substr(0,1)==="k"){n=values.length;assignments=new Array(n);clusterSizes=new Array(num);repeat=true;nb_iters=0;centroids=null;centroids=[];centroids.push(min);for(i=_k=1,_ref5=num-1;1<=_ref5?_k<=_ref5:_k>=_ref5;i=1<=_ref5?++_k:--_k){centroids.push(min+i/num*(max-min))}centroids.push(max);while(repeat){for(j=_l=0,_ref6=num-1;0<=_ref6?_l<=_ref6:_l>=_ref6;j=0<=_ref6?++_l:--_l){clusterSizes[j]=0}for(i=_m=0,_ref7=n-1;0<=_ref7?_m<=_ref7:_m>=_ref7;i=0<=_ref7?++_m:--_m){value=values[i];mindist=Number.MAX_VALUE;for(j=_n=0,_ref8=num-1;0<=_ref8?_n<=_ref8:_n>=_ref8;j=0<=_ref8?++_n:--_n){dist=Math.abs(centroids[j]-value);if(dist<mindist){mindist=dist;best=j}}clusterSizes[best]++;assignments[i]=best}newCentroids=new Array(num);for(j=_o=0,_ref9=num-1;0<=_ref9?_o<=_ref9:_o>=_ref9;j=0<=_ref9?++_o:--_o){newCentroids[j]=null}for(i=_p=0,_ref10=n-1;0<=_ref10?_p<=_ref10:_p>=_ref10;i=0<=_ref10?++_p:--_p){cluster=assignments[i];if(newCentroids[cluster]===null){newCentroids[cluster]=values[i]}else{newCentroids[cluster]+=values[i]}}for(j=_q=0,_ref11=num-1;0<=_ref11?_q<=_ref11:_q>=_ref11;j=0<=_ref11?++_q:--_q){newCentroids[j]*=1/clusterSizes[j]}repeat=false;for(j=_r=0,_ref12=num-1;0<=_ref12?_r<=_ref12:_r>=_ref12;j=0<=_ref12?++_r:--_r){if(newCentroids[j]!==centroids[i]){repeat=true;break}}centroids=newCentroids;nb_iters++;if(nb_iters>200){repeat=false}}kClusters={};for(j=_s=0,_ref13=num-1;0<=_ref13?_s<=_ref13:_s>=_ref13;j=0<=_ref13?++_s:--_s){kClusters[j]=[]}for(i=_t=0,_ref14=n-1;0<=_ref14?_t<=_ref14:_t>=_ref14;i=0<=_ref14?++_t:--_t){cluster=assignments[i];kClusters[cluster].push(values[i])}tmpKMeansBreaks=[];for(j=_u=0,_ref15=num-1;0<=_ref15?_u<=_ref15:_u>=_ref15;j=0<=_ref15?++_u:--_u){tmpKMeansBreaks.push(kClusters[j][0]);tmpKMeansBreaks.push(kClusters[j][kClusters[j].length-1])}tmpKMeansBreaks=tmpKMeansBreaks.sort(function(a,b){return a-b});limits.push(tmpKMeansBreaks[0]);for(i=_v=1,_ref16=tmpKMeansBreaks.length-1;_v<=_ref16;i=_v+=2){if(!isNaN(tmpKMeansBreaks[i])){limits.push(tmpKMeansBreaks[i])}}}return limits};root=typeof exports!=="undefined"&&exports!==null?exports:this;type=function(){var classToType,name,_i,_len,_ref3;classToType={};_ref3="Boolean Number String Function Array Date RegExp Undefined Null".split(" ");for(_i=0,_len=_ref3.length;_i<_len;_i++){name=_ref3[_i];classToType["[object "+name+"]"]=name.toLowerCase()}return function(obj){var strType;strType=Object.prototype.toString.call(obj);return classToType[strType]||"object"}}();if((_ref3=root.type)==null){root.type=type}Array.max=function(array){return Math.max.apply(Math,array)};Array.min=function(array){return Math.min.apply(Math,array)};limit=function(x,min,max){if(min==null){min=0}if(max==null){max=1}if(x<min){x=min}if(x>max){x=max}return x};unpack=function(args){if(args.length===3){return args}else{return args[0]}};TWOPI=Math.PI*2;PITHIRD=Math.PI/3;cos=Math.cos;root=typeof exports!=="undefined"&&exports!==null?exports:this;chroma=(_ref4=root.chroma)!=null?_ref4:root.chroma={};chroma.brewer=brewer={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]};root=typeof exports!=="undefined"&&exports!==null?exports:this;chroma=(_ref5=root.chroma)!=null?_ref5:root.chroma={};chroma.colors=colors={indigo:"#4b0082",gold:"#ffd700",hotpink:"#ff69b4",firebrick:"#b22222",indianred:"#cd5c5c",yellow:"#ffff00",mistyrose:"#ffe4e1",darkolivegreen:"#556b2f",olive:"#808000",darkseagreen:"#8fbc8f",pink:"#ffc0cb",tomato:"#ff6347",lightcoral:"#f08080",orangered:"#ff4500",navajowhite:"#ffdead",lime:"#00ff00",palegreen:"#98fb98",darkslategrey:"#2f4f4f",greenyellow:"#adff2f",burlywood:"#deb887",seashell:"#fff5ee",mediumspringgreen:"#00fa9a",fuchsia:"#ff00ff",papayawhip:"#ffefd5",blanchedalmond:"#ffebcd",chartreuse:"#7fff00",dimgray:"#696969",black:"#000000",peachpuff:"#ffdab9",springgreen:"#00ff7f",aquamarine:"#7fffd4",white:"#ffffff",orange:"#ffa500",lightsalmon:"#ffa07a",darkslategray:"#2f4f4f",brown:"#a52a2a",ivory:"#fffff0",dodgerblue:"#1e90ff",peru:"#cd853f",lawngreen:"#7cfc00",chocolate:"#d2691e",crimson:"#dc143c",forestgreen:"#228b22",darkgrey:"#a9a9a9",lightseagreen:"#20b2aa",cyan:"#00ffff",mintcream:"#f5fffa",silver:"#c0c0c0",antiquewhite:"#faebd7",mediumorchid:"#ba55d3",skyblue:"#87ceeb",gray:"#808080",darkturquoise:"#00ced1",goldenrod:"#daa520",darkgreen:"#006400",floralwhite:"#fffaf0",darkviolet:"#9400d3",darkgray:"#a9a9a9",moccasin:"#ffe4b5",saddlebrown:"#8b4513",grey:"#808080",darkslateblue:"#483d8b",lightskyblue:"#87cefa",lightpink:"#ffb6c1",mediumvioletred:"#c71585",slategrey:"#708090",red:"#ff0000",deeppink:"#ff1493",limegreen:"#32cd32",darkmagenta:"#8b008b",palegoldenrod:"#eee8aa",plum:"#dda0dd",turquoise:"#40e0d0",lightgrey:"#d3d3d3",lightgoldenrodyellow:"#fafad2",darkgoldenrod:"#b8860b",lavender:"#e6e6fa",maroon:"#800000",yellowgreen:"#9acd32",sandybrown:"#f4a460",thistle:"#d8bfd8",violet:"#ee82ee",navy:"#000080",magenta:"#ff00ff",dimgrey:"#696969",tan:"#d2b48c",rosybrown:"#bc8f8f",olivedrab:"#6b8e23",blue:"#0000ff",lightblue:"#add8e6",ghostwhite:"#f8f8ff",honeydew:"#f0fff0",cornflowerblue:"#6495ed",slateblue:"#6a5acd",linen:"#faf0e6",darkblue:"#00008b",powderblue:"#b0e0e6",seagreen:"#2e8b57",darkkhaki:"#bdb76b",snow:"#fffafa",sienna:"#a0522d",mediumblue:"#0000cd",royalblue:"#4169e1",lightcyan:"#e0ffff",green:"#008000",mediumpurple:"#9370db",midnightblue:"#191970",cornsilk:"#fff8dc",paleturquoise:"#afeeee",bisque:"#ffe4c4",slategray:"#708090",darkcyan:"#008b8b",khaki:"#f0e68c",wheat:"#f5deb3",teal:"#008080",darkorchid:"#9932cc",deepskyblue:"#00bfff",salmon:"#fa8072",darkred:"#8b0000",steelblue:"#4682b4",palevioletred:"#db7093",lightslategray:"#778899",aliceblue:"#f0f8ff",lightslategrey:"#778899",lightgreen:"#90ee90",orchid:"#da70d6",gainsboro:"#dcdcdc",mediumseagreen:"#3cb371",lightgray:"#d3d3d3",mediumturquoise:"#48d1cc",lemonchiffon:"#fffacd",cadetblue:"#5f9ea0",lightyellow:"#ffffe0",lavenderblush:"#fff0f5",coral:"#ff7f50",purple:"#800080",aqua:"#00ffff",whitesmoke:"#f5f5f5",mediumslateblue:"#7b68ee",darkorange:"#ff8c00",mediumaquamarine:"#66cdaa",darksalmon:"#e9967a",beige:"#f5f5dc",blueviolet:"#8a2be2",azure:"#f0ffff",lightsteelblue:"#b0c4de",oldlace:"#fdf5e6"}}).call(this); \ No newline at end of file
diff --git a/plugins/UserCountryMap/js/visitor-map.js b/plugins/UserCountryMap/js/visitor-map.js
index 34b1656706..fad5221672 100644
--- a/plugins/UserCountryMap/js/visitor-map.js
+++ b/plugins/UserCountryMap/js/visitor-map.js
@@ -149,7 +149,7 @@
var d = $('<div>'), r = $('<div>'), l = $('<div>'),
metric = $$('.userCountryMapSelectMetrics').val(),
v = formatNumber(Math.round(val)) + (metric == 'avg_time_on_site' ? first ? ' sec' : 's' : '');
- d.css({ width: 17, height: 17, float: 'left', background: colscale.getColor(val) });
+ d.css({ width: 17, height: 17, float: 'left', background: colscale(val) });
l.css({ 'margin-left':20, 'line-height': '20px', 'text-align': 'right' }).html(v);
r.css({ clear: 'both', height: 19 });
r.append(d).append(l);
@@ -168,7 +168,7 @@
stats = minmax(values);
if (stats.min == stats.max) {
- colscale = { getColor: function() { return '#CDDAEF'; } };
+ colscale = function() { return '#CDDAEF'; };
if (choropleth) {
$('.UserCountryMap-legend .content').html('').show();
addLegendItem(stats.min, true);
@@ -176,21 +176,17 @@
return colscale;
}
- colscale = new chroma.ColorScale({
- colors: [choropleth ? '#CDDAEF' : '#385993', '#385993'],
- limits: chroma.limits(values, 'c', 4),
- mode: 'hcl'
- });
+ colscale = chroma.scale()
+ .range([choropleth ? '#CDDAEF' : '#385993', '#385993'])
+ .domain(values, 4, 'c')
+ .mode('lch');
if (metric == 'avg_time_on_site' || metric == 'nb_actions_per_visit' || metric == 'bounce_rate') {
if (id.length == 3) {
c = (stats.p90 - stats.min) / (stats.max - stats.min);
- colscale = new chroma.ColorScale({
- colors: ['#385993', '#385993','#E87500', '#E87500'],
- limits: chroma.limits(rows, 'c', 5, 'curMetric', filter),
- positions: [0, c, c+0.001, 1],
- mode: 'hsl'
- });
+ colscale = chroma.scale(['#385993', '#385993','#E87500', '#E87500'], [0, c, c+0.001, 1])
+ .domain(chroma.limits(rows, 'c', 5, 'curMetric', filter))
+ .mode('hsl');
}
}
@@ -439,7 +435,7 @@
if (d === null) {
return self.config.noDataColor;
} else {
- return colscale.getColor(d[metric]);
+ return colscale(d[metric]);
}
}
@@ -698,7 +694,7 @@
function regionFill(data) {
var code = regionCode(data);
- return regionDict[code] === undefined ? '#fff' : colscale.getColor(regionDict[code].curMetric);
+ return regionDict[code] === undefined ? '#fff' : colscale(regionDict[code].curMetric);
}
// apply colors to map
@@ -858,7 +854,7 @@
},
attrs: function(city) {
return {
- fill: colscale.getColor(city.curMetric).hex(),
+ fill: colscale(city.curMetric).hex(),
'fill-opacity': 0.7,
stroke: '#fff',
cursor: 'pointer'
@@ -884,7 +880,7 @@
'stroke': '#ffffff'
});
if ($.inArray(city.label, _rowEvolution.labels) == -1) {
- symbol.path.attr({ fill: colscale.getColor(city.curMetric) });
+ symbol.path.attr({ fill: colscale(city.curMetric) });
if (symbol.label) symbol.label.attr({ fill: '#fff' });
}
},
@@ -897,7 +893,7 @@
showRowEvolution('getCity', city.label);
citySymbols.update({
attrs: function(city) {
- return { fill: colscale.getColor(city.curMetric) };
+ return { fill: colscale(city.curMetric) };
}
});
}