Socket
Socket
Sign inDemoInstall

d3plus-legend

Package Overview
Dependencies
25
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.0 to 0.9.1

4

build/d3plus-legend.min.js
/*
d3plus-legend v0.9.0
d3plus-legend v0.9.1
An easy to use javascript chart legend.

@@ -7,2 +7,2 @@ Copyright (c) 2020 D3plus - https://d3plus.org

*/
(function(t){typeof define==="function"&&define.amd?define(t):t()})(function(){"use strict";var t=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}var i=function(t){return t&&t.Math==Math&&t};var c=i(typeof globalThis=="object"&&globalThis)||i(typeof window=="object"&&window)||i(typeof self=="object"&&self)||i(typeof t=="object"&&t)||Function("return this")();var o=function(t){try{return!!t()}catch(t){return true}};var d=!o(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7});var n={}.propertyIsEnumerable;var r=Object.getOwnPropertyDescriptor;var a=r&&!n.call({1:2},1);var s=a?function t(e){var i=r(this,e);return!!i&&i.enumerable}:n;var g={f:s};var l=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}};var u={}.toString;var h=function(t){return u.call(t).slice(8,-1)};var f="".split;var b=o(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return h(t)=="String"?f.call(t,""):Object(t)}:Object;var v=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var _=function(t){return b(v(t))};var p=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var y=function(t,e){if(!p(t))return t;var i,n;if(e&&typeof(i=t.toString)=="function"&&!p(n=i.call(t)))return n;if(typeof(i=t.valueOf)=="function"&&!p(n=i.call(t)))return n;if(!e&&typeof(i=t.toString)=="function"&&!p(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var m={}.hasOwnProperty;var w=function(t,e){return m.call(t,e)};var x=c.document;var C=p(x)&&p(x.createElement);var k=function(t){return C?x.createElement(t):{}};var S=!d&&!o(function(){return Object.defineProperty(k("div"),"a",{get:function(){return 7}}).a!=7});var M=Object.getOwnPropertyDescriptor;var O=d?M:function t(e,i){e=_(e);i=y(i,true);if(S)try{return M(e,i)}catch(t){}if(w(e,i))return l(!g.f.call(e,i),e[i])};var j={f:O};var A=function(t){if(!p(t)){throw TypeError(String(t)+" is not an object")}return t};var E=Object.defineProperty;var B=d?E:function t(e,i,n){A(e);i=y(i,true);A(n);if(S)try{return E(e,i,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)e[i]=n.value;return e};var T={f:B};var W=d?function(t,e,i){return T.f(t,e,l(1,i))}:function(t,e,i){t[e]=i;return t};var P=function(e,i){try{W(c,e,i)}catch(t){c[e]=i}return i};var z="__core-js_shared__";var D=c[z]||P(z,{});var H=D;var L=Function.toString;if(typeof H.inspectSource!="function"){H.inspectSource=function(t){return L.call(t)}}var R=H.inspectSource;var F=c.WeakMap;var q=typeof F==="function"&&/native code/.test(R(F));var G=e(function(t){(t.exports=function(t,e){return H[t]||(H[t]=e!==undefined?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})});var N=0;var I=Math.random();var V=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++N+I).toString(36)};var K=G("keys");var X=function(t){return K[t]||(K[t]=V(t))};var Y={};var J=c.WeakMap;var Q,U,Z;var $=function(t){return Z(t)?U(t):Q(t,{})};var tt=function(i){return function(t){var e;if(!p(t)||(e=U(t)).type!==i){throw TypeError("Incompatible receiver, "+i+" required")}return e}};if(q){var et=new J;var it=et.get;var nt=et.has;var rt=et.set;Q=function(t,e){rt.call(et,t,e);return e};U=function(t){return it.call(et,t)||{}};Z=function(t){return nt.call(et,t)}}else{var at=X("state");Y[at]=true;Q=function(t,e){W(t,at,e);return e};U=function(t){return w(t,at)?t[at]:{}};Z=function(t){return w(t,at)}}var ot={set:Q,get:U,has:Z,enforce:$,getterFor:tt};var st=e(function(t){var e=ot.get;var s=ot.enforce;var l=String(String).split("String");(t.exports=function(t,e,i,n){var r=n?!!n.unsafe:false;var a=n?!!n.enumerable:false;var o=n?!!n.noTargetGet:false;if(typeof i=="function"){if(typeof e=="string"&&!w(i,"name"))W(i,"name",e);s(i).source=l.join(typeof e=="string"?e:"")}if(t===c){if(a)t[e]=i;else P(e,i);return}else if(!r){delete t[e]}else if(!o&&t[e]){a=true}if(a)t[e]=i;else W(t,e,i)})(Function.prototype,"toString",function t(){return typeof this=="function"&&e(this).source||R(this)})});var lt=c;var ut=function(t){return typeof t=="function"?t:undefined};var ht=function(t,e){return arguments.length<2?ut(lt[t])||ut(c[t]):lt[t]&&lt[t][e]||c[t]&&c[t][e]};var ct=Math.ceil;var ft=Math.floor;var dt=function(t){return isNaN(t=+t)?0:(t>0?ft:ct)(t)};var gt=Math.min;var vt=function(t){return t>0?gt(dt(t),9007199254740991):0};var _t=Math.max;var pt=Math.min;var yt=function(t,e){var i=dt(t);return i<0?_t(i+e,0):pt(i,e)};var mt=function(s){return function(t,e,i){var n=_(t);var r=vt(n.length);var a=yt(i,r);var o;if(s&&e!=e)while(r>a){o=n[a++];if(o!=o)return true}else for(;r>a;a++){if((s||a in n)&&n[a]===e)return s||a||0}return!s&&-1}};var bt={includes:mt(true),indexOf:mt(false)};var wt=bt.indexOf;var xt=function(t,e){var i=_(t);var n=0;var r=[];var a;for(a in i)!w(Y,a)&&w(i,a)&&r.push(a);while(e.length>n)if(w(i,a=e[n++])){~wt(r,a)||r.push(a)}return r};var Ct=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var kt=Ct.concat("length","prototype");var St=Object.getOwnPropertyNames||function t(e){return xt(e,kt)};var Mt={f:St};var Ot=Object.getOwnPropertySymbols;var jt={f:Ot};var At=ht("Reflect","ownKeys")||function t(e){var i=Mt.f(A(e));var n=jt.f;return n?i.concat(n(e)):i};var Et=function(t,e){var i=At(e);var n=T.f;var r=j.f;for(var a=0;a<i.length;a++){var o=i[a];if(!w(t,o))n(t,o,r(e,o))}};var Bt=/#|\.prototype\./;var Tt=function(t,e){var i=Pt[Wt(t)];return i==Dt?true:i==zt?false:typeof e=="function"?o(e):!!e};var Wt=Tt.normalize=function(t){return String(t).replace(Bt,".").toLowerCase()};var Pt=Tt.data={};var zt=Tt.NATIVE="N";var Dt=Tt.POLYFILL="P";var Ht=Tt;var Lt=j.f;var Rt=function(t,e){var i=t.target;var n=t.global;var r=t.stat;var a,o,s,l,u,h;if(n){o=c}else if(r){o=c[i]||P(i,{})}else{o=(c[i]||{}).prototype}if(o)for(s in e){u=e[s];if(t.noTargetGet){h=Lt(o,s);l=h&&h.value}else l=o[s];a=Ht(n?s:i+(r?".":"#")+s,t.forced);if(!a&&l!==undefined){if(typeof u===typeof l)continue;Et(u,l)}if(t.sham||l&&l.sham){W(u,"sham",true)}st(o,s,u,t)}};var Ft=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var qt=function(n,r,t){Ft(n);if(r===undefined)return n;switch(t){case 0:return function(){return n.call(r)};case 1:return function(t){return n.call(r,t)};case 2:return function(t,e){return n.call(r,t,e)};case 3:return function(t,e,i){return n.call(r,t,e,i)}}return function(){return n.apply(r,arguments)}};var Gt=function(t){return Object(v(t))};var Nt=Array.isArray||function t(e){return h(e)=="Array"};var It=!!Object.getOwnPropertySymbols&&!o(function(){return!String(Symbol())});var Vt=It&&!Symbol.sham&&typeof Symbol.iterator=="symbol";var Kt=G("wks");var Xt=c.Symbol;var Yt=Vt?Xt:Xt&&Xt.withoutSetter||V;var Jt=function(t){if(!w(Kt,t)){if(It&&w(Xt,t))Kt[t]=Xt[t];else Kt[t]=Yt("Symbol."+t)}return Kt[t]};var Qt=Jt("species");var Ut=function(t,e){var i;if(Nt(t)){i=t.constructor;if(typeof i=="function"&&(i===Array||Nt(i.prototype)))i=undefined;else if(p(i)){i=i[Qt];if(i===null)i=undefined}}return new(i===undefined?Array:i)(e===0?0:e)};var Zt=[].push;var $t=function(d){var g=d==1;var v=d==2;var _=d==3;var p=d==4;var y=d==6;var m=d==5||y;return function(t,e,i,n){var r=Gt(t);var a=b(r);var o=qt(e,i,3);var s=vt(a.length);var l=0;var u=n||Ut;var h=g?u(t,s):v?u(t,0):undefined;var c,f;for(;s>l;l++)if(m||l in a){c=a[l];f=o(c,l,r);if(d){if(g)h[l]=f;else if(f)switch(d){case 3:return true;case 5:return c;case 6:return l;case 2:Zt.call(h,c)}else if(p)return false}}return y?-1:_||p?p:h}};var te={forEach:$t(0),map:$t(1),filter:$t(2),some:$t(3),every:$t(4),find:$t(5),findIndex:$t(6)};var ee=Object.keys||function t(e){return xt(e,Ct)};var ie=d?Object.defineProperties:function t(e,i){A(e);var n=ee(i);var r=n.length;var a=0;var o;while(r>a)T.f(e,o=n[a++],i[o]);return e};var ne=ht("document","documentElement");var re=">";var ae="<";var oe="prototype";var se="script";var le=X("IE_PROTO");var ue=function(){};var he=function(t){return ae+se+re+t+ae+"/"+se+re};var ce=function(t){t.write(he(""));t.close();var e=t.parentWindow.Object;t=null;return e};var fe=function(){var t=k("iframe");var e="java"+se+":";var i;t.style.display="none";ne.appendChild(t);t.src=String(e);i=t.contentWindow.document;i.open();i.write(he("document.F=Object"));i.close();return i.F};var de;var ge=function(){try{de=document.domain&&new ActiveXObject("htmlfile")}catch(t){}ge=de?ce(de):fe();var t=Ct.length;while(t--)delete ge[oe][Ct[t]];return ge()};Y[le]=true;var ve=Object.create||function t(e,i){var n;if(e!==null){ue[oe]=A(e);n=new ue;ue[oe]=null;n[le]=e}else n=ge();return i===undefined?n:ie(n,i)};var _e=Jt("unscopables");var pe=Array.prototype;if(pe[_e]==undefined){T.f(pe,_e,{configurable:true,value:ve(null)})}var ye=function(t){pe[_e][t]=true};var me=Object.defineProperty;var be={};var we=function(t){throw t};var xe=function(t,e){if(w(be,t))return be[t];if(!e)e={};var i=[][t];var n=w(e,"ACCESSORS")?e.ACCESSORS:false;var r=w(e,0)?e[0]:we;var a=w(e,1)?e[1]:undefined;return be[t]=!!i&&!o(function(){if(n&&!d)return true;var t={length:-1};if(n)me(t,1,{enumerable:true,get:we});else t[1]=1;i.call(t,r,a)})};var Ce=te.find;var ke="find";var Se=true;var Me=xe(ke);if(ke in[])Array(1)[ke](function(){Se=false});Rt({target:"Array",proto:true,forced:Se||!Me},{find:function t(e){return Ce(this,e,arguments.length>1?arguments[1]:undefined)}});ye(ke);var Oe=bt.includes;var je=xe("indexOf",{ACCESSORS:true,1:0});Rt({target:"Array",proto:true,forced:!je},{includes:function t(e){return Oe(this,e,arguments.length>1?arguments[1]:undefined)}});ye("includes");var Ae=Object.assign;var Ee=Object.defineProperty;var Be=!Ae||o(function(){if(d&&Ae({b:1},Ae(Ee({},"a",{enumerable:true,get:function(){Ee(this,"b",{value:3,enumerable:false})}}),{b:2})).b!==1)return true;var t={};var e={};var i=Symbol();var n="abcdefghijklmnopqrst";t[i]=7;n.split("").forEach(function(t){e[t]=t});return Ae({},t)[i]!=7||ee(Ae({},e)).join("")!=n})?function t(e,i){var n=Gt(e);var r=arguments.length;var a=1;var o=jt.f;var s=g.f;while(r>a){var l=b(arguments[a++]);var u=o?ee(l).concat(o(l)):ee(l);var h=u.length;var c=0;var f;while(h>c){f=u[c++];if(!d||s.call(l,f))n[f]=l[f]}}return n}:Ae;Rt({target:"Object",stat:true,forced:Object.assign!==Be},{assign:Be});var Te=Jt("match");var We=function(t){var e;return p(t)&&((e=t[Te])!==undefined?!!e:h(t)=="RegExp")};var Pe=function(t){if(We(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var ze=Jt("match");var De=function(e){var i=/./;try{"/./"[e](i)}catch(t){try{i[ze]=false;return"/./"[e](i)}catch(t){}}return false};Rt({target:"String",proto:true,forced:!De("includes")},{includes:function t(e){return!!~String(v(this)).indexOf(Pe(e),arguments.length>1?arguments[1]:undefined)}});var He=j.f;var Le="".startsWith;var Re=Math.min;var Fe=De("startsWith");var qe=!Fe&&!!function(){var t=He(String.prototype,"startsWith");return t&&!t.writable}();Rt({target:"String",proto:true,forced:!qe&&!Fe},{startsWith:function t(e){var i=String(v(this));Pe(e);var n=vt(Re(arguments.length>1?arguments[1]:undefined,i.length));var r=String(e);return Le?Le.call(i,r,n):i.slice(n,n+r.length)===r}});if(typeof window!=="undefined"){(function(){try{if(typeof SVGElement==="undefined"||Boolean(SVGElement.prototype.innerHTML)){return}}catch(t){return}function i(t){switch(t.nodeType){case 1:return r(t);case 3:return e(t);case 8:return n(t)}}function e(t){return t.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n(t){return"\x3c!--"+t.nodeValue+"--\x3e"}function r(t){var e="";e+="<"+t.tagName;if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){e+=" "+t.name+'="'+t.value+'"'})}e+=">";if(t.hasChildNodes()){[].forEach.call(t.childNodes,function(t){e+=i(t)})}e+="</"+t.tagName+">";return e}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var e="";[].forEach.call(this.childNodes,function(t){e+=i(t)});return e},set:function(t){while(this.firstChild){this.removeChild(this.firstChild)}try{var e=new DOMParser;e.async=false;var i="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>";var n=e.parseFromString(i,"text/xml").documentElement;[].forEach.call(n.childNodes,function(t){this.appendChild(this.ownerDocument.importNode(t,true))}.bind(this))}catch(t){throw new Error("Error parsing markup string")}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})})()}});(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("d3-array"),require("d3-selection"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-text"),require("d3-scale"),require("d3-transition"),require("d3plus-axis"),require("d3plus-color"),require("d3plus-format")):typeof define==="function"&&define.amd?define("d3plus-legend",["exports","d3-array","d3-selection","d3plus-common","d3plus-shape","d3plus-text","d3-scale","d3-transition","d3plus-axis","d3plus-color","d3plus-format"],e):(t=t||self,e(t.d3plus={},t.d3Array,t.d3Selection,t.d3plusCommon,t.shapes,t.d3plusText,t.d3Scale,t.d3Transition,t.d3plusAxis,t.d3plusColor,t.d3plusFormat))})(this,function(t,Et,Bt,Tt,w,Wt,Pt,zt,n,Dt,Ht){"use strict";function h(t){return t.slice().sort(function(t,e){return t-e})}function c(t){var e,i=0;for(var n=0;n<t.length;n++){if(n===0||t[n]!==e){e=t[n];i++}}return i}function f(t,e){var i=[];for(var n=0;n<t;n++){var r=[];for(var a=0;a<e;a++){r.push(0)}i.push(r)}return i}function v(t,e,i,n){var r;if(t>0){var a=(i[e]-i[t-1])/(e-t+1);r=n[e]-n[t-1]-(e-t+1)*a*a}else r=n[e]-i[e]*i[e]/(e+1);if(r<0)return 0;return r}function _(t,e,i,n,r,a,o){if(t>e)return;var s=Math.floor((t+e)/2);n[i][s]=n[i-1][s-1];r[i][s]=s;var l=i;if(t>i)l=Math.max(l,r[i][t-1]||0);l=Math.max(l,r[i-1][s]||0);var u=s-1;if(e<n.length-1)u=Math.min(u,r[i][e+1]||0);for(var h=u;h>=l;--h){var c=v(h,s,a,o);if(c+n[i-1][l-1]>=n[i][s])break;var f=v(l,s,a,o);var d=f+n[i-1][l-1];if(d<n[i][s]){n[i][s]=d;r[i][s]=l}l++;var g=c+n[i-1][h-1];if(g<n[i][s]){n[i][s]=g;r[i][s]=h}}_(t,s-1,i,n,r,a,o);_(s+1,e,i,n,r,a,o)}function d(t,e,i){var n=e[0]?e[0].length:0;var r=t[Math.floor(n/2)];var a=[];var o=[];for(var s=0,l=void 0;s<n;++s){l=t[s]-r;if(s===0){a.push(l);o.push(l*l)}else{a.push(a[s-1]+l);o.push(o[s-1]+l*l)}e[0][s]=v(0,s,a,o);i[0][s]=0}for(var u=1;u<e.length;++u){var h=n-1;if(u<e.length-1)h=u;_(h,n-1,u,e,i,a,o)}}function Lt(t,e){if(e>t.length){throw new Error("Cannot generate more classes than there are data values")}var i=h(t);var n=c(i);if(n===1){return[i]}var r=f(e,i.length),a=f(e,i.length);d(i,a,r);var o=r[0]?r[0].length-1:0;var s=[];for(var l=r.length-1;l>=0;l--){var u=r[l][o];s[l]=i.slice(u,o+1);if(l>0)o=u-1}return s}function r(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(t,n.key,n)}}function o(t,e,i){if(e)a(t.prototype,e);if(i)a(t,i);return t}function Rt(t,e,i){if(e in t){Object.defineProperty(t,e,{value:i,enumerable:true,configurable:true,writable:true})}else{t[e]=i}return t}function s(t,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:true,configurable:true}});if(e)i(t,e)}function l(t){l=Object.setPrototypeOf?Object.getPrototypeOf:function t(e){return e.__proto__||Object.getPrototypeOf(e)};return l(t)}function i(t,e){i=Object.setPrototypeOf||function t(e,i){e.__proto__=i;return e};return i(t,e)}function e(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(t){return false}}function u(t){if(t===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function g(t,e){if(e&&(typeof e==="object"||typeof e==="function")){return e}return u(t)}function p(r){var a=e();return function t(){var e=l(r),i;if(a){var n=l(this).constructor;i=Reflect.construct(e,arguments,n)}else{i=e.apply(this,arguments)}return g(this,i)}}var y=function(t){s(i,t);var e=p(i);function i(){var s;r(this,i);s=e.call(this);s._align="center";s._data=[];s._direction="row";s._duration=600;s._height=200;s._id=Tt.accessor("id");s._label=Tt.accessor("id");s._lineData=[];s._outerBounds={width:0,height:0,x:0,y:0};s._padding=5;s._shape=Tt.constant("Rect");s._shapes=[];s._shapeConfig={fill:Tt.accessor("color"),height:Tt.constant(10),hitArea:function t(e,i){var n=s._lineData[i],r=Et.max([n.height,n.shapeHeight]);return{width:n.width+n.shapeWidth,height:r,x:-n.shapeWidth/2,y:-r/2}},labelBounds:function t(e,i){var n=s._lineData[i];var r=n.shapeWidth;if(n.shape==="Circle")r-=n.shapeR;var a=Et.max([n.shapeHeight,n.height]);return{width:n.width,height:a,x:r,y:-a/2}},labelConfig:{fontColor:Tt.constant("#444"),fontFamily:(new Wt.TextBox).fontFamily(),fontResize:false,fontSize:Tt.constant(10),verticalAlign:"middle"},opacity:1,r:Tt.constant(5),width:Tt.constant(10),x:function t(e,i){var n=s._lineData[i];var r=n.y;var a=s._align==="left"||s._align==="right"&&s._direction==="column"?0:s._align==="center"?(s._outerBounds.width-s._rowWidth(s._lineData.filter(function(t){return r===t.y})))/2:s._outerBounds.width-s._rowWidth(s._lineData.filter(function(t){return r===t.y}));var o=s._lineData.slice(0,i).filter(function(t){return r===t.y});return s._rowWidth(o)+s._padding*(o.length?n.sentence?2:1:0)+s._outerBounds.x+n.shapeWidth/2+a},y:function t(e,i){var n=s._lineData[i];return n.y+s._titleHeight+s._outerBounds.y+Et.max(s._lineData.filter(function(t){return n.y===t.y}).map(function(t){return t.height}).concat(s._data.map(function(t,e){return s._fetchConfig("height",t,e)})))/2}};s._titleClass=new Wt.TextBox;s._titleConfig={};s._verticalAlign="middle";s._width=400;return s}o(i,[{key:"_fetchConfig",value:function t(e,i,n){var r=this._shapeConfig[e]!==undefined?this._shapeConfig[e]:this._shapeConfig.labelConfig[e];if(!r&&e==="lineHeight")return this._fetchConfig("fontSize",i,n)*1.4;return typeof r==="function"?r(i,n):r}},{key:"_rowHeight",value:function t(e){return Et.max(e.map(function(t){return t.height}).concat(e.map(function(t){return t.shapeHeight})))+this._padding}},{key:"_rowWidth",value:function t(n){var r=this;return Et.sum(n.map(function(t,e){var i=r._padding*(e===n.length-1?0:t.width?2:1);return t.shapeWidth+t.width+i}))}},{key:"render",value:function t(e){var c=this;if(this._select===void 0)this.select(Bt.select("body").append("svg").attr("width","".concat(this._width,"px")).attr("height","".concat(this._height,"px")).node());this._group=Tt.elem("g.d3plus-Legend",{parent:this._select});this._titleGroup=Tt.elem("g.d3plus-Legend-title",{parent:this._group});this._shapeGroup=Tt.elem("g.d3plus-Legend-shape",{parent:this._group});var f=this._height;this._titleHeight=0;this._titleWidth=0;if(this._title){var i=this._titleConfig.fontFamily||this._titleClass.fontFamily()(),n=this._titleConfig.fontSize||this._titleClass.fontSize()();var r=r=this._titleConfig.lineHeight||this._titleClass.lineHeight();r=r?r():n*1.4;var a=Wt.textWrap().fontFamily(i).fontSize(n).lineHeight(r).width(this._width).height(this._height)(this._title);this._titleHeight=r+a.lines.length+this._padding;this._titleWidth=Et.max(a.widths);f-=this._titleHeight}this._lineData=this._data.map(function(t,e){var i=c._label(t,e);var n=c._shape(t,e);var r=c._fetchConfig("r",t,e);var a={data:t,i:e,id:c._id(t,e),shape:n,shapeR:r,shapeWidth:n==="Circle"?r*2:c._fetchConfig("width",t,e),shapeHeight:n==="Circle"?r*2:c._fetchConfig("height",t,e),y:0};if(!i){a.sentence=false;a.words=[];a.height=0;a.width=0;return a}var o=c._fetchConfig("fontFamily",t,e),s=c._fetchConfig("lineHeight",t,e),l=c._fetchConfig("fontSize",t,e);var u=f-(c._data.length+1)*c._padding,h=c._width;a=Object.assign(a,Wt.textWrap().fontFamily(o).fontSize(l).lineHeight(s).width(h).height(u)(i));a.width=Math.ceil(Et.max(a.lines.map(function(t){return Wt.textWidth(t,{"font-family":o,"font-size":l})})))+l*.75;a.height=Math.ceil(a.lines.length*(s+1));a.og={height:a.height,width:a.width};a.f=o;a.s=l;a.lh=s;return a});var o;var l=this._width-this._padding*2;o=this._rowWidth(this._lineData);if(this._direction==="column"||o>l){var u=1,h=[];var d=Et.max(this._lineData.map(function(t){return t.words.length}));this._wrapLines=function(){var e=this;u++;if(u>d)return;var o=u===1?this._lineData.slice():this._lineData.filter(function(t){return t.width+t.shapeWidth+e._padding*(t.width?2:1)>l&&t.words.length>=u}).sort(function(t,e){return e.sentence.length-t.sentence.length});if(o.length&&f>o[0].height*u){var s=false;var t=function t(e){var i=o[e];var n=i.og.height*u,r=i.og.width*(1.5*(1/u));var a=Wt.textWrap().fontFamily(i.f).fontSize(i.s).lineHeight(i.lh).width(r).height(n)(i.sentence);if(!a.truncated){i.width=Math.ceil(Et.max(a.lines.map(function(t){return Wt.textWidth(t,{"font-family":i.f,"font-size":i.s})})))+i.s;i.height=a.lines.length*(i.lh+1)}else{s=true;return"break"}};for(var i=0;i<o.length;i++){var n=t(i);if(n==="break")break}if(!s)this._wrapRows()}else{h=[];return}};this._wrapRows=function(){h=[];var t=1,e=0;for(var i=0;i<this._lineData.length;i++){var n=this._lineData[i],r=n.width+this._padding*(n.width?2:1)+n.shapeWidth;if(Et.sum(h.map(function(t){return Et.max(t,function(t){return Et.max([t.height,t.shapeHeight])})}))>f){h=[];break}if(r>l){h=[];this._wrapLines();break}else if(e+r<l){e+=r}else if(this._direction!=="column"){e=r;t++}if(!h[t-1])h[t-1]=[];h[t-1].push(n);if(this._direction==="column"){e=0;t++}}};this._wrapRows();if(!h.length||Et.sum(h,this._rowHeight.bind(this))+this._padding>f){o=Et.sum(this._lineData.map(function(t){return t.shapeWidth+c._padding}))-this._padding;for(var s=0;s<this._lineData.length;s++){this._lineData[s].width=0;this._lineData[s].height=0}this._wrapRows()}if(h.length&&Et.sum(h,this._rowHeight.bind(this))+this._padding<f){h.forEach(function(t,e){t.forEach(function(t){if(e){t.y=Et.sum(h.slice(0,e),c._rowHeight.bind(c))}})});o=Et.max(h,this._rowWidth.bind(this))}}var g=Et.max(this._lineData,function(t,e){return Et.max([t.height,c._fetchConfig("height",t.data,e)])+t.y})+this._titleHeight,v=Et.max([o,this._titleWidth]);this._outerBounds.width=v;this._outerBounds.height=g;var _=this._padding,p=this._padding;if(this._align==="center")_=(this._width-v)/2;else if(this._align==="right")_=this._width-this._padding-v;if(this._verticalAlign==="middle")p=(this._height-g)/2;else if(this._verticalAlign==="bottom")p=this._height-this._padding-g;this._outerBounds.x=_;this._outerBounds.y=p;this._titleClass.data(this._title?[{text:this._title}]:[]).duration(this._duration).select(this._titleGroup.node()).textAnchor({left:"start",center:"middle",right:"end"}[this._align]).width(this._width-this._padding*2).x(this._padding).y(this._outerBounds.y).config(this._titleConfig).render();this._shapes=[];var y=Tt.configPrep.bind(this)(this._shapeConfig,"legend"),m={id:function t(e){return e.id},label:function t(e){return e.label},lineHeight:function t(e){return e.lH}};var b=this._data.map(function(t,e){var i={__d3plus__:true,data:t,i:e,id:c._id(t,e),label:c._lineData[e].width?c._label(t,e):false,lH:c._fetchConfig("lineHeight",t,e),shape:c._shape(t,e)};return i});this._shapes=[];["Circle","Rect"].forEach(function(e){c._shapes.push((new w[e]).parent(c).data(b.filter(function(t){return t.shape===e})).duration(c._duration).labelConfig({padding:0}).select(c._shapeGroup.node()).verticalAlign("top").config(Tt.assign({},y,m)).render())});if(e)setTimeout(e,this._duration+100);return this}},{key:"active",value:function t(e){this._shapes.forEach(function(t){return t.active(e)});return this}},{key:"align",value:function t(e){return arguments.length?(this._align=e,this):this._align}},{key:"data",value:function t(e){return arguments.length?(this._data=e,this):this._data}},{key:"direction",value:function t(e){return arguments.length?(this._direction=e,this):this._direction}},{key:"duration",value:function t(e){return arguments.length?(this._duration=e,this):this._duration}},{key:"height",value:function t(e){return arguments.length?(this._height=e,this):this._height}},{key:"hover",value:function t(e){this._shapes.forEach(function(t){return t.hover(e)});return this}},{key:"id",value:function t(e){return arguments.length?(this._id=e,this):this._id}},{key:"label",value:function t(e){return arguments.length?(this._label=typeof e==="function"?e:Tt.constant(e),this):this._label}},{key:"outerBounds",value:function t(){return this._outerBounds}},{key:"padding",value:function t(e){return arguments.length?(this._padding=e,this):this._padding}},{key:"select",value:function t(e){return arguments.length?(this._select=Bt.select(e),this):this._select}},{key:"shape",value:function t(e){return arguments.length?(this._shape=typeof e==="function"?e:Tt.constant(e),this):this._shape}},{key:"shapeConfig",value:function t(e){return arguments.length?(this._shapeConfig=Tt.assign(this._shapeConfig,e),this):this._shapeConfig}},{key:"title",value:function t(e){return arguments.length?(this._title=e,this):this._title}},{key:"titleConfig",value:function t(e){return arguments.length?(this._titleConfig=Tt.assign(this._titleConfig,e),this):this._titleConfig}},{key:"verticalAlign",value:function t(e){return arguments.length?(this._verticalAlign=e,this):this._verticalAlign}},{key:"width",value:function t(e){return arguments.length?(this._width=e,this):this._width}}]);return i}(Tt.BaseClass);var m=function(t){s(i,t);var e=p(i);function i(){var t;r(this,i);t=e.call(this);t._axisClass=new n.Axis;t._axisConfig={gridSize:0,shapeConfig:{labelConfig:{fontColor:"#222"}},titleConfig:{fontSize:12}};t._axisTest=new n.Axis;t._align="middle";t._buckets=5;t._bucketAxis=false;t._centered=true;t._colorMax="#0C8040";t._colorMid="#f7f7f7";t._colorMin="#b22200";t._data=[];t._duration=600;t._height=200;t._labelClass=new Wt.TextBox;t._legendClass=new y;t._legendConfig={shapeConfig:{labelConfig:{fontColor:"#222"},stroke:"#444",strokeWidth:1}};t._midpoint=0;t._orient="bottom";t._outerBounds={width:0,height:0,x:0,y:0};t._padding=5;t._rectClass=(new w.Rect).parent(u(t));t._rectConfig={stroke:"#444",strokeWidth:1};t._scale="linear";t._size=10;t._value=Tt.accessor("value");t._width=400;return t}o(i,[{key:"render",value:function t(e){var i=this;if(this._select===void 0)this.select(Bt.select("body").append("svg").attr("width","".concat(this._width,"px")).attr("height","".concat(this._height,"px")).node());var n=["bottom","top"].includes(this._orient);var r=n?"height":"width",a=n?"width":"height",o=n?"x":"y",s=n?"y":"x";this._group=Tt.elem("g.d3plus-ColorScale",{parent:this._select});var l=this._data.map(this._value).sort(function(t,e){return t-e});var u=Et.extent(l);var h=u[0]<this._midpoint;var c=u[1]>this._midpoint;var f=h&&c;var d=this._color,g,v;if(d&&!(d instanceof Array)){d=Et.range(0,this._buckets,1).map(function(t){return Dt.colorLighter(d,(t+1)/i._buckets)}).reverse()}if(this._scale==="jenks"){var _=this._data.map(this._value).filter(function(t){return t!==null&&typeof t==="number"});var p=Et.min([d?d.length:this._buckets,_.length]);var y=[];if(f&&this._centered){var m=Math.floor(p/2);var b=p%2;var w=_.filter(function(t){return t<i._midpoint});var x=Et.deviation(w);var C=_.concat(this._midpoint).filter(function(t){return t>=i._midpoint});var k=Et.deviation(C);var S=x>k?1:0;var M=k>x?1:0;var O=Lt(w,m+b*S);var j=Lt(C,m+b*M);y=O.concat(j)}else{y=Lt(_,p)}v=Et.merge(y.map(function(t,e){return e===y.length-1?[t[0],t[t.length-1]]:[t[0]]}));var A=new Set(v);if(v.length!==A.size){g=Array.from(A)}if(!d){if(f){d=[this._colorMin,this._colorMid,this._colorMax];var E=v.slice(0,p).filter(function(t,e){return t<i._midpoint&&v[e+1]<=i._midpoint});var B=v.slice(0,p).filter(function(t,e){return t<=i._midpoint&&v[e+1]>i._midpoint});var T=v.slice(0,p).filter(function(t,e){return t>i._midpoint&&v[e+1]>i._midpoint});var W=E.map(function(t,e){return!e?d[0]:Dt.colorLighter(d[0],e/E.length)});var P=B.map(function(){return d[1]});var z=T.map(function(t,e){return e===T.length-1?d[2]:Dt.colorLighter(d[2],1-(e+1)/T.length)});d=W.concat(P).concat(z)}else{d=Et.range(0,this._buckets,1).map(function(t){return Dt.colorLighter(i._colorMax,t/i._buckets)}).reverse()}}if(_.length<=p){d=d.slice(p-_.length)}this._colorScale=Pt.scaleThreshold().domain(v).range(["black"].concat(d).concat(d[d.length-1]))}else{var D;if(f&&!d){var H=Math.floor(this._buckets/2);var L=Et.range(0,H,1).map(function(t){return!t?i._colorMin:Dt.colorLighter(i._colorMin,t/H)});var R=(this._buckets%2?[0]:[]).map(function(){return i._colorMid});var F=Et.range(0,H,1).map(function(t){return!t?i._colorMax:Dt.colorLighter(i._colorMax,t/H)}).reverse();d=L.concat(R).concat(F);var q=(d.length-1)/2;D=[u[0],this._midpoint,u[1]];D=Et.range(u[0],this._midpoint,-(u[0]-this._midpoint)/q).concat(Et.range(this._midpoint,u[1],(u[1]-this._midpoint)/q)).concat([u[1]])}else{if(!d){if(this._scale==="buckets"||this._scale==="quantile"){d=Et.range(0,this._buckets,1).map(function(t){return Dt.colorLighter(h?i._colorMin:i._colorMax,t/i._buckets)});if(c)d=d.reverse()}else{d=h?[this._colorMin,Dt.colorLighter(this._colorMin,.8)]:[Dt.colorLighter(this._colorMax,.8),this._colorMax]}}if(this._scale==="quantile"){var G=1/(d.length-1);D=Et.range(0,1+G/2,G).map(function(t){return Et.quantile(l,t)})}else if(f&&this._color&&this._centered){var N=(this._midpoint-u[0])/Math.floor(d.length/2);var I=(u[1]-this._midpoint)/Math.floor(d.length/2);var V=Et.range(u[0],this._midpoint,N);var K=Et.range(this._midpoint,u[1]+I/2,I);D=V.concat(K)}else{var X=(u[1]-u[0])/(d.length-1);D=Et.range(u[0],u[1]+X/2,X)}}if(this._scale==="buckets"||this._scale==="quantile"){v=D.concat([D[D.length-1]])}else if(this._scale==="log"){var Y=D.filter(function(t){return t<0});if(Y.length){var J=Y[0];var Q=Y.map(function(t){return-Math.pow(Math.abs(J),t/J)});Y.forEach(function(t,e){D[D.indexOf(t)]=Q[e]})}var U=D.filter(function(t){return t>0});if(U.length){var Z=U[U.length-1];var $=U.map(function(t){return Math.pow(Z,t/Z)});U.forEach(function(t,e){D[D.indexOf(t)]=$[e]})}if(D.includes(0))D[D.indexOf(0)]=1}this._colorScale=Pt.scaleLinear().domain(D).range(d)}var tt=this._bucketAxis||!["buckets","jenks","quantile"].includes(this._scale);var et=zt.transition().duration(this._duration);var it={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:et,update:{opacity:1}};var nt=Tt.elem("g.d3plus-ColorScale-labels",Object.assign({condition:tt},it));var rt=Tt.elem("g.d3plus-ColorScale-Rect",Object.assign({condition:tt},it));var at=Tt.elem("g.d3plus-ColorScale-legend",Object.assign({condition:!tt},it));if(tt){var ot;var st={x:0,y:0};var lt=Tt.assign({domain:n?u:u.reverse(),duration:this._duration,height:this._height,labels:g||v,orient:this._orient,padding:this._padding,scale:this._scale==="log"?"log":"linear",ticks:v,width:this._width},this._axisConfig);var ut=Tt.assign({height:this["_".concat(r)]/2,width:this["_".concat(a)]/2},this._labelConfig||this._axisConfig.titleConfig);this._labelClass.config(ut);var ht=[];if(n&&this._labelMin){var ct={"font-family":this._labelClass.fontFamily()(this._labelMin),"font-size":this._labelClass.fontSize()(this._labelMin),"font-weight":this._labelClass.fontWeight()(this._labelMin)};if(ct["font-family"]instanceof Array)ct["font-family"]=ct["font-family"][0];var ft=Wt.textWidth(this._labelMin,ct);if(ft&&ft<this["_".concat(a)]/2){ht.push(this._labelMin);ft+=this._padding;if(n)st.x+=ft;lt[a]-=ft}}if(n&&this._labelMax){var dt={"font-family":this._labelClass.fontFamily()(this._labelMax),"font-size":this._labelClass.fontSize()(this._labelMax),"font-weight":this._labelClass.fontWeight()(this._labelMax)};if(dt["font-family"]instanceof Array)dt["font-family"]=dt["font-family"][0];var gt=Wt.textWidth(this._labelMax,dt);if(gt&&gt<this["_".concat(a)]/2){ht.push(this._labelMax);gt+=this._padding;if(!n)st.y+=gt;lt[a]-=gt}}this._axisTest.select(Tt.elem("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:this._group}).node()).config(lt).duration(0).render();var vt=this._axisTest.outerBounds();this._outerBounds[a]=this["_".concat(a)]-this._padding*2;this._outerBounds[r]=vt[r]+this._size;this._outerBounds[o]=this._padding;this._outerBounds[s]=this._padding;if(this._align==="middle")this._outerBounds[s]=(this["_".concat(r)]-this._outerBounds[r])/2;else if(this._align==="end")this._outerBounds[s]=this["_".concat(r)]-this._padding-this._outerBounds[r];var _t=this._outerBounds[s]+(["bottom","right"].includes(this._orient)?this._size:0)-(lt.padding||this._axisClass.padding());var pt="translate(".concat(st.x+(n?0:_t),", ").concat(st.y+(n?_t:0),")");this._axisClass.select(Tt.elem("g.d3plus-ColorScale-axis",Tt.assign(it,{condition:true,enter:{transform:pt},update:{transform:pt}})).node()).config(lt).align("start").render();var yt=this._axisTest._getPosition.bind(this._axisTest);var mt=this._axisTest._getRange();var bt=this._group.selectAll("defs").data([0]);var wt=bt.enter().append("defs");wt.append("linearGradient").attr("id","gradient-".concat(this._uuid));bt=wt.merge(bt);bt.select("linearGradient").attr("".concat(o,"1"),n?"0%":"100%").attr("".concat(o,"2"),n?"100%":"0%").attr("".concat(s,"1"),"0%").attr("".concat(s,"2"),"0%");var xt=bt.select("linearGradient").selectAll("stop").data(n?d:d);var Ct=this._colorScale.domain();var kt=Pt.scaleLinear().domain(mt).range(n?[0,100]:[100,0]);xt.enter().append("stop").merge(xt).attr("offset",function(t,e){return"".concat(kt(yt(Ct[e])),"%")}).attr("stop-color",String);var St=function t(e,i){var n=Math.abs(yt(v[i+1])-yt(e));return n||2};var Mt=Tt.assign((ot={duration:this._duration,fill:v?function(t){return i._colorScale(t)}:"url(#gradient-".concat(this._uuid,")")},Rt(ot,o,v?function(t,e){return yt(t)+St(t,e)/2-(["left","right"].includes(i._orient)?St(t,e):0)}:mt[0]+(mt[1]-mt[0])/2+st[o]),Rt(ot,s,this._outerBounds[s]+(["top","left"].includes(this._orient)?vt[r]:0)+this._size/2+st[s]),Rt(ot,a,v?St:mt[1]-mt[0]),Rt(ot,r,this._size),ot),this._rectConfig);this._rectClass.data(v?v.slice(0,v.length-1):[0]).id(function(t,e){return e}).select(rt.node()).config(Mt).render();ut.height=this._outerBounds[r];ut.width=this._outerBounds[a];this._labelClass.config(ut).data(ht).select(nt.node()).x(function(t){return t===i._labelMax?Mt.x+Mt.width/2+i._padding:i._outerBounds.x}).y(function(t){return Mt.y-i._labelClass.fontSize()(t)/2}).text(function(t){return t}).rotate(n?0:this._orient==="right"?90:-90).render()}else{Tt.elem("g.d3plus-ColorScale-axis",Object.assign({condition:tt},it));var Ot=this._axisConfig.tickFormat?this._axisConfig.tickFormat:Ht.formatAbbreviate;var jt=v.reduce(function(t,e,i){if(i!==v.length-1){var n=v[i+1];t.push({color:d[i],id:e===n?"".concat(Ot(e),"+"):"".concat(Ot(e)," - ").concat(Ot(n))})}return t},[]);var At=Tt.assign({align:n?"center":{start:"left",middle:"center",end:"right"}[this._align],direction:n?"row":"column",duration:this._duration,height:this._height,padding:this._padding,shapeConfig:Tt.assign({duration:this._duration},this._axisConfig.shapeConfig||{}),title:this._axisConfig.title,titleConfig:this._axisConfig.titleConfig||{},width:this._width,verticalAlign:n?{start:"top",middle:"middle",end:"bottom"}[this._align]:"middle"},this._legendConfig);this._legendClass.data(jt).select(at.node()).config(At).render();this._outerBounds=this._legendClass.outerBounds()}if(e)setTimeout(e,this._duration+100);return this}},{key:"axisConfig",value:function t(e){return arguments.length?(this._axisConfig=Tt.assign(this._axisConfig,e),this):this._axisConfig}},{key:"align",value:function t(e){return arguments.length?(this._align=e,this):this._align}},{key:"buckets",value:function t(e){return arguments.length?(this._buckets=e,this):this._buckets}},{key:"bucketAxis",value:function t(e){return arguments.length?(this._bucketAxis=e,this):this._bucketAxis}},{key:"centered",value:function t(e){return arguments.length?(this._centered=e,this):this._centered}},{key:"color",value:function t(e){return arguments.length?(this._color=e,this):this._color}},{key:"colorMax",value:function t(e){return arguments.length?(this._colorMax=e,this):this._colorMax}},{key:"colorMid",value:function t(e){return arguments.length?(this._colorMid=e,this):this._colorMid}},{key:"colorMin",value:function t(e){return arguments.length?(this._colorMin=e,this):this._colorMin}},{key:"data",value:function t(e){return arguments.length?(this._data=e,this):this._data}},{key:"duration",value:function t(e){return arguments.length?(this._duration=e,this):this._duration}},{key:"height",value:function t(e){return arguments.length?(this._height=e,this):this._height}},{key:"labelConfig",value:function t(e){return arguments.length?(this._labelConfig=e,this):this._labelConfig}},{key:"labelMin",value:function t(e){return arguments.length?(this._labelMin=e,this):this._labelMin}},{key:"labelMax",value:function t(e){return arguments.length?(this._labelMax=e,this):this._labelMax}},{key:"legendConfig",value:function t(e){return arguments.length?(this._legendConfig=Tt.assign(this._legendConfig,e),this):this._legendConfig}},{key:"midpoint",value:function t(e){return arguments.length?(this._midpoint=e,this):this._midpoint}},{key:"orient",value:function t(e){return arguments.length?(this._orient=e,this):this._orient}},{key:"outerBounds",value:function t(){return this._outerBounds}},{key:"padding",value:function t(e){return arguments.length?(this._padding=e,this):this._padding}},{key:"rectConfig",value:function t(e){return arguments.length?(this._rectConfig=Tt.assign(this._rectConfig,e),this):this._rectConfig}},{key:"scale",value:function t(e){return arguments.length?(this._scale=e,this):this._scale}},{key:"select",value:function t(e){return arguments.length?(this._select=Bt.select(e),this):this._select}},{key:"size",value:function t(e){return arguments.length?(this._size=e,this):this._size}},{key:"value",value:function t(e){return arguments.length?(this._value=typeof e==="function"?e:Tt.constant(e),this):this._value}},{key:"width",value:function t(e){return arguments.length?(this._width=e,this):this._width}}]);return i}(Tt.BaseClass);t.ColorScale=m;t.Legend=y;t.ckmeans=Lt;Object.defineProperty(t,"__esModule",{value:true})});
(function(t){typeof define==="function"&&define.amd?define(t):t()})(function(){"use strict";var t=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}var i=function(t){return t&&t.Math==Math&&t};var c=i(typeof globalThis=="object"&&globalThis)||i(typeof window=="object"&&window)||i(typeof self=="object"&&self)||i(typeof t=="object"&&t)||Function("return this")();var o=function(t){try{return!!t()}catch(t){return true}};var d=!o(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7});var n={}.propertyIsEnumerable;var r=Object.getOwnPropertyDescriptor;var a=r&&!n.call({1:2},1);var s=a?function t(e){var i=r(this,e);return!!i&&i.enumerable}:n;var g={f:s};var l=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}};var u={}.toString;var h=function(t){return u.call(t).slice(8,-1)};var f="".split;var b=o(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return h(t)=="String"?f.call(t,""):Object(t)}:Object;var v=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var _=function(t){return b(v(t))};var p=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var y=function(t,e){if(!p(t))return t;var i,n;if(e&&typeof(i=t.toString)=="function"&&!p(n=i.call(t)))return n;if(typeof(i=t.valueOf)=="function"&&!p(n=i.call(t)))return n;if(!e&&typeof(i=t.toString)=="function"&&!p(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var m={}.hasOwnProperty;var w=function(t,e){return m.call(t,e)};var x=c.document;var C=p(x)&&p(x.createElement);var k=function(t){return C?x.createElement(t):{}};var S=!d&&!o(function(){return Object.defineProperty(k("div"),"a",{get:function(){return 7}}).a!=7});var M=Object.getOwnPropertyDescriptor;var O=d?M:function t(e,i){e=_(e);i=y(i,true);if(S)try{return M(e,i)}catch(t){}if(w(e,i))return l(!g.f.call(e,i),e[i])};var j={f:O};var A=function(t){if(!p(t)){throw TypeError(String(t)+" is not an object")}return t};var E=Object.defineProperty;var T=d?E:function t(e,i,n){A(e);i=y(i,true);A(n);if(S)try{return E(e,i,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)e[i]=n.value;return e};var B={f:T};var W=d?function(t,e,i){return B.f(t,e,l(1,i))}:function(t,e,i){t[e]=i;return t};var P=function(e,i){try{W(c,e,i)}catch(t){c[e]=i}return i};var z="__core-js_shared__";var D=c[z]||P(z,{});var H=D;var F=Function.toString;if(typeof H.inspectSource!="function"){H.inspectSource=function(t){return F.call(t)}}var L=H.inspectSource;var R=c.WeakMap;var q=typeof R==="function"&&/native code/.test(L(R));var G=e(function(t){(t.exports=function(t,e){return H[t]||(H[t]=e!==undefined?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})});var N=0;var I=Math.random();var V=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++N+I).toString(36)};var $=G("keys");var K=function(t){return $[t]||($[t]=V(t))};var X={};var Y=c.WeakMap;var J,Q,U;var Z=function(t){return U(t)?Q(t):J(t,{})};var tt=function(i){return function(t){var e;if(!p(t)||(e=Q(t)).type!==i){throw TypeError("Incompatible receiver, "+i+" required")}return e}};if(q){var et=new Y;var it=et.get;var nt=et.has;var rt=et.set;J=function(t,e){rt.call(et,t,e);return e};Q=function(t){return it.call(et,t)||{}};U=function(t){return nt.call(et,t)}}else{var at=K("state");X[at]=true;J=function(t,e){W(t,at,e);return e};Q=function(t){return w(t,at)?t[at]:{}};U=function(t){return w(t,at)}}var ot={set:J,get:Q,has:U,enforce:Z,getterFor:tt};var st=e(function(t){var e=ot.get;var s=ot.enforce;var l=String(String).split("String");(t.exports=function(t,e,i,n){var r=n?!!n.unsafe:false;var a=n?!!n.enumerable:false;var o=n?!!n.noTargetGet:false;if(typeof i=="function"){if(typeof e=="string"&&!w(i,"name"))W(i,"name",e);s(i).source=l.join(typeof e=="string"?e:"")}if(t===c){if(a)t[e]=i;else P(e,i);return}else if(!r){delete t[e]}else if(!o&&t[e]){a=true}if(a)t[e]=i;else W(t,e,i)})(Function.prototype,"toString",function t(){return typeof this=="function"&&e(this).source||L(this)})});var lt=c;var ut=function(t){return typeof t=="function"?t:undefined};var ht=function(t,e){return arguments.length<2?ut(lt[t])||ut(c[t]):lt[t]&&lt[t][e]||c[t]&&c[t][e]};var ct=Math.ceil;var ft=Math.floor;var dt=function(t){return isNaN(t=+t)?0:(t>0?ft:ct)(t)};var gt=Math.min;var vt=function(t){return t>0?gt(dt(t),9007199254740991):0};var _t=Math.max;var pt=Math.min;var yt=function(t,e){var i=dt(t);return i<0?_t(i+e,0):pt(i,e)};var mt=function(s){return function(t,e,i){var n=_(t);var r=vt(n.length);var a=yt(i,r);var o;if(s&&e!=e)while(r>a){o=n[a++];if(o!=o)return true}else for(;r>a;a++){if((s||a in n)&&n[a]===e)return s||a||0}return!s&&-1}};var bt={includes:mt(true),indexOf:mt(false)};var wt=bt.indexOf;var xt=function(t,e){var i=_(t);var n=0;var r=[];var a;for(a in i)!w(X,a)&&w(i,a)&&r.push(a);while(e.length>n)if(w(i,a=e[n++])){~wt(r,a)||r.push(a)}return r};var Ct=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var kt=Ct.concat("length","prototype");var St=Object.getOwnPropertyNames||function t(e){return xt(e,kt)};var Mt={f:St};var Ot=Object.getOwnPropertySymbols;var jt={f:Ot};var At=ht("Reflect","ownKeys")||function t(e){var i=Mt.f(A(e));var n=jt.f;return n?i.concat(n(e)):i};var Et=function(t,e){var i=At(e);var n=B.f;var r=j.f;for(var a=0;a<i.length;a++){var o=i[a];if(!w(t,o))n(t,o,r(e,o))}};var Tt=/#|\.prototype\./;var Bt=function(t,e){var i=Pt[Wt(t)];return i==Dt?true:i==zt?false:typeof e=="function"?o(e):!!e};var Wt=Bt.normalize=function(t){return String(t).replace(Tt,".").toLowerCase()};var Pt=Bt.data={};var zt=Bt.NATIVE="N";var Dt=Bt.POLYFILL="P";var Ht=Bt;var Ft=j.f;var Lt=function(t,e){var i=t.target;var n=t.global;var r=t.stat;var a,o,s,l,u,h;if(n){o=c}else if(r){o=c[i]||P(i,{})}else{o=(c[i]||{}).prototype}if(o)for(s in e){u=e[s];if(t.noTargetGet){h=Ft(o,s);l=h&&h.value}else l=o[s];a=Ht(n?s:i+(r?".":"#")+s,t.forced);if(!a&&l!==undefined){if(typeof u===typeof l)continue;Et(u,l)}if(t.sham||l&&l.sham){W(u,"sham",true)}st(o,s,u,t)}};var Rt=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var qt=function(n,r,t){Rt(n);if(r===undefined)return n;switch(t){case 0:return function(){return n.call(r)};case 1:return function(t){return n.call(r,t)};case 2:return function(t,e){return n.call(r,t,e)};case 3:return function(t,e,i){return n.call(r,t,e,i)}}return function(){return n.apply(r,arguments)}};var Gt=function(t){return Object(v(t))};var Nt=Array.isArray||function t(e){return h(e)=="Array"};var It=!!Object.getOwnPropertySymbols&&!o(function(){return!String(Symbol())});var Vt=It&&!Symbol.sham&&typeof Symbol.iterator=="symbol";var $t=G("wks");var Kt=c.Symbol;var Xt=Vt?Kt:Kt&&Kt.withoutSetter||V;var Yt=function(t){if(!w($t,t)){if(It&&w(Kt,t))$t[t]=Kt[t];else $t[t]=Xt("Symbol."+t)}return $t[t]};var Jt=Yt("species");var Qt=function(t,e){var i;if(Nt(t)){i=t.constructor;if(typeof i=="function"&&(i===Array||Nt(i.prototype)))i=undefined;else if(p(i)){i=i[Jt];if(i===null)i=undefined}}return new(i===undefined?Array:i)(e===0?0:e)};var Ut=[].push;var Zt=function(d){var g=d==1;var v=d==2;var _=d==3;var p=d==4;var y=d==6;var m=d==5||y;return function(t,e,i,n){var r=Gt(t);var a=b(r);var o=qt(e,i,3);var s=vt(a.length);var l=0;var u=n||Qt;var h=g?u(t,s):v?u(t,0):undefined;var c,f;for(;s>l;l++)if(m||l in a){c=a[l];f=o(c,l,r);if(d){if(g)h[l]=f;else if(f)switch(d){case 3:return true;case 5:return c;case 6:return l;case 2:Ut.call(h,c)}else if(p)return false}}return y?-1:_||p?p:h}};var te={forEach:Zt(0),map:Zt(1),filter:Zt(2),some:Zt(3),every:Zt(4),find:Zt(5),findIndex:Zt(6)};var ee=Object.keys||function t(e){return xt(e,Ct)};var ie=d?Object.defineProperties:function t(e,i){A(e);var n=ee(i);var r=n.length;var a=0;var o;while(r>a)B.f(e,o=n[a++],i[o]);return e};var ne=ht("document","documentElement");var re=">";var ae="<";var oe="prototype";var se="script";var le=K("IE_PROTO");var ue=function(){};var he=function(t){return ae+se+re+t+ae+"/"+se+re};var ce=function(t){t.write(he(""));t.close();var e=t.parentWindow.Object;t=null;return e};var fe=function(){var t=k("iframe");var e="java"+se+":";var i;t.style.display="none";ne.appendChild(t);t.src=String(e);i=t.contentWindow.document;i.open();i.write(he("document.F=Object"));i.close();return i.F};var de;var ge=function(){try{de=document.domain&&new ActiveXObject("htmlfile")}catch(t){}ge=de?ce(de):fe();var t=Ct.length;while(t--)delete ge[oe][Ct[t]];return ge()};X[le]=true;var ve=Object.create||function t(e,i){var n;if(e!==null){ue[oe]=A(e);n=new ue;ue[oe]=null;n[le]=e}else n=ge();return i===undefined?n:ie(n,i)};var _e=Yt("unscopables");var pe=Array.prototype;if(pe[_e]==undefined){B.f(pe,_e,{configurable:true,value:ve(null)})}var ye=function(t){pe[_e][t]=true};var me=Object.defineProperty;var be={};var we=function(t){throw t};var xe=function(t,e){if(w(be,t))return be[t];if(!e)e={};var i=[][t];var n=w(e,"ACCESSORS")?e.ACCESSORS:false;var r=w(e,0)?e[0]:we;var a=w(e,1)?e[1]:undefined;return be[t]=!!i&&!o(function(){if(n&&!d)return true;var t={length:-1};if(n)me(t,1,{enumerable:true,get:we});else t[1]=1;i.call(t,r,a)})};var Ce=te.find;var ke="find";var Se=true;var Me=xe(ke);if(ke in[])Array(1)[ke](function(){Se=false});Lt({target:"Array",proto:true,forced:Se||!Me},{find:function t(e){return Ce(this,e,arguments.length>1?arguments[1]:undefined)}});ye(ke);var Oe=bt.includes;var je=xe("indexOf",{ACCESSORS:true,1:0});Lt({target:"Array",proto:true,forced:!je},{includes:function t(e){return Oe(this,e,arguments.length>1?arguments[1]:undefined)}});ye("includes");var Ae=Object.assign;var Ee=Object.defineProperty;var Te=!Ae||o(function(){if(d&&Ae({b:1},Ae(Ee({},"a",{enumerable:true,get:function(){Ee(this,"b",{value:3,enumerable:false})}}),{b:2})).b!==1)return true;var t={};var e={};var i=Symbol();var n="abcdefghijklmnopqrst";t[i]=7;n.split("").forEach(function(t){e[t]=t});return Ae({},t)[i]!=7||ee(Ae({},e)).join("")!=n})?function t(e,i){var n=Gt(e);var r=arguments.length;var a=1;var o=jt.f;var s=g.f;while(r>a){var l=b(arguments[a++]);var u=o?ee(l).concat(o(l)):ee(l);var h=u.length;var c=0;var f;while(h>c){f=u[c++];if(!d||s.call(l,f))n[f]=l[f]}}return n}:Ae;Lt({target:"Object",stat:true,forced:Object.assign!==Te},{assign:Te});var Be=Yt("match");var We=function(t){var e;return p(t)&&((e=t[Be])!==undefined?!!e:h(t)=="RegExp")};var Pe=function(t){if(We(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var ze=Yt("match");var De=function(e){var i=/./;try{"/./"[e](i)}catch(t){try{i[ze]=false;return"/./"[e](i)}catch(t){}}return false};Lt({target:"String",proto:true,forced:!De("includes")},{includes:function t(e){return!!~String(v(this)).indexOf(Pe(e),arguments.length>1?arguments[1]:undefined)}});var He=j.f;var Fe="".startsWith;var Le=Math.min;var Re=De("startsWith");var qe=!Re&&!!function(){var t=He(String.prototype,"startsWith");return t&&!t.writable}();Lt({target:"String",proto:true,forced:!qe&&!Re},{startsWith:function t(e){var i=String(v(this));Pe(e);var n=vt(Le(arguments.length>1?arguments[1]:undefined,i.length));var r=String(e);return Fe?Fe.call(i,r,n):i.slice(n,n+r.length)===r}});if(typeof window!=="undefined"){(function(){try{if(typeof SVGElement==="undefined"||Boolean(SVGElement.prototype.innerHTML)){return}}catch(t){return}function i(t){switch(t.nodeType){case 1:return r(t);case 3:return e(t);case 8:return n(t)}}function e(t){return t.textContent.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n(t){return"\x3c!--"+t.nodeValue+"--\x3e"}function r(t){var e="";e+="<"+t.tagName;if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){e+=" "+t.name+'="'+t.value+'"'})}e+=">";if(t.hasChildNodes()){[].forEach.call(t.childNodes,function(t){e+=i(t)})}e+="</"+t.tagName+">";return e}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var e="";[].forEach.call(this.childNodes,function(t){e+=i(t)});return e},set:function(t){while(this.firstChild){this.removeChild(this.firstChild)}try{var e=new DOMParser;e.async=false;var i="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>";var n=e.parseFromString(i,"text/xml").documentElement;[].forEach.call(n.childNodes,function(t){this.appendChild(this.ownerDocument.importNode(t,true))}.bind(this))}catch(t){throw new Error("Error parsing markup string")}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})})()}});(function(t,e){typeof exports==="object"&&typeof module!=="undefined"?e(exports,require("d3-array"),require("d3-selection"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-text"),require("d3-scale"),require("d3-transition"),require("d3plus-axis"),require("d3plus-color"),require("d3plus-format")):typeof define==="function"&&define.amd?define("d3plus-legend",["exports","d3-array","d3-selection","d3plus-common","d3plus-shape","d3plus-text","d3-scale","d3-transition","d3plus-axis","d3plus-color","d3plus-format"],e):(t=t||self,e(t.d3plus={},t.d3Array,t.d3Selection,t.d3plusCommon,t.shapes,t.d3plusText,t.d3Scale,t.d3Transition,t.d3plusAxis,t.d3plusColor,t.d3plusFormat))})(this,function(t,Dt,Ht,Ft,w,Lt,Rt,qt,n,Gt,d){"use strict";function h(t){return t.slice().sort(function(t,e){return t-e})}function c(t){var e,i=0;for(var n=0;n<t.length;n++){if(n===0||t[n]!==e){e=t[n];i++}}return i}function f(t,e){var i=[];for(var n=0;n<t;n++){var r=[];for(var a=0;a<e;a++){r.push(0)}i.push(r)}return i}function v(t,e,i,n){var r;if(t>0){var a=(i[e]-i[t-1])/(e-t+1);r=n[e]-n[t-1]-(e-t+1)*a*a}else r=n[e]-i[e]*i[e]/(e+1);if(r<0)return 0;return r}function _(t,e,i,n,r,a,o){if(t>e)return;var s=Math.floor((t+e)/2);n[i][s]=n[i-1][s-1];r[i][s]=s;var l=i;if(t>i)l=Math.max(l,r[i][t-1]||0);l=Math.max(l,r[i-1][s]||0);var u=s-1;if(e<n.length-1)u=Math.min(u,r[i][e+1]||0);for(var h=u;h>=l;--h){var c=v(h,s,a,o);if(c+n[i-1][l-1]>=n[i][s])break;var f=v(l,s,a,o);var d=f+n[i-1][l-1];if(d<n[i][s]){n[i][s]=d;r[i][s]=l}l++;var g=c+n[i-1][h-1];if(g<n[i][s]){n[i][s]=g;r[i][s]=h}}_(t,s-1,i,n,r,a,o);_(s+1,e,i,n,r,a,o)}function g(t,e,i){var n=e[0]?e[0].length:0;var r=t[Math.floor(n/2)];var a=[];var o=[];for(var s=0,l=void 0;s<n;++s){l=t[s]-r;if(s===0){a.push(l);o.push(l*l)}else{a.push(a[s-1]+l);o.push(o[s-1]+l*l)}e[0][s]=v(0,s,a,o);i[0][s]=0}for(var u=1;u<e.length;++u){var h=n-1;if(u<e.length-1)h=u;_(h,n-1,u,e,i,a,o)}}function Nt(t,e){if(e>t.length){throw new Error("Cannot generate more classes than there are data values")}var i=h(t);var n=c(i);if(n===1){return[i]}var r=f(e,i.length),a=f(e,i.length);g(i,a,r);var o=r[0]?r[0].length-1:0;var s=[];for(var l=r.length-1;l>=0;l--){var u=r[l][o];s[l]=i.slice(u,o+1);if(l>0)o=u-1}return s}function r(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function a(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(t,n.key,n)}}function o(t,e,i){if(e)a(t.prototype,e);if(i)a(t,i);return t}function It(t,e,i){if(e in t){Object.defineProperty(t,e,{value:i,enumerable:true,configurable:true,writable:true})}else{t[e]=i}return t}function s(t,e){if(typeof e!=="function"&&e!==null){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:true,configurable:true}});if(e)i(t,e)}function l(t){l=Object.setPrototypeOf?Object.getPrototypeOf:function t(e){return e.__proto__||Object.getPrototypeOf(e)};return l(t)}function i(t,e){i=Object.setPrototypeOf||function t(e,i){e.__proto__=i;return e};return i(t,e)}function e(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return true}catch(t){return false}}function u(t){if(t===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function p(t,e){if(e&&(typeof e==="object"||typeof e==="function")){return e}return u(t)}function y(r){var a=e();return function t(){var e=l(r),i;if(a){var n=l(this).constructor;i=Reflect.construct(e,arguments,n)}else{i=e.apply(this,arguments)}return p(this,i)}}var m=function(t){s(i,t);var e=y(i);function i(){var s;r(this,i);s=e.call(this);s._align="center";s._data=[];s._direction="row";s._duration=600;s._height=200;s._id=Ft.accessor("id");s._label=Ft.accessor("id");s._lineData=[];s._outerBounds={width:0,height:0,x:0,y:0};s._padding=5;s._shape=Ft.constant("Rect");s._shapes=[];s._shapeConfig={fill:Ft.accessor("color"),height:Ft.constant(10),hitArea:function t(e,i){var n=s._lineData[i],r=Dt.max([n.height,n.shapeHeight]);return{width:n.width+n.shapeWidth,height:r,x:-n.shapeWidth/2,y:-r/2}},labelBounds:function t(e,i){var n=s._lineData[i];var r=n.shapeWidth;if(n.shape==="Circle")r-=n.shapeR;var a=Dt.max([n.shapeHeight,n.height]);return{width:n.width,height:a,x:r,y:-a/2}},labelConfig:{fontColor:Ft.constant("#444"),fontFamily:(new Lt.TextBox).fontFamily(),fontResize:false,fontSize:Ft.constant(10),verticalAlign:"middle"},opacity:1,r:Ft.constant(5),width:Ft.constant(10),x:function t(e,i){var n=s._lineData[i];var r=n.y;var a=s._align==="left"||s._align==="right"&&s._direction==="column"?0:s._align==="center"?(s._outerBounds.width-s._rowWidth(s._lineData.filter(function(t){return r===t.y})))/2:s._outerBounds.width-s._rowWidth(s._lineData.filter(function(t){return r===t.y}));var o=s._lineData.slice(0,i).filter(function(t){return r===t.y});return s._rowWidth(o)+s._padding*(o.length?n.sentence?2:1:0)+s._outerBounds.x+n.shapeWidth/2+a},y:function t(e,i){var n=s._lineData[i];return n.y+s._titleHeight+s._outerBounds.y+Dt.max(s._lineData.filter(function(t){return n.y===t.y}).map(function(t){return t.height}).concat(s._data.map(function(t,e){return s._fetchConfig("height",t,e)})))/2}};s._titleClass=new Lt.TextBox;s._titleConfig={};s._verticalAlign="middle";s._width=400;return s}o(i,[{key:"_fetchConfig",value:function t(e,i,n){var r=this._shapeConfig[e]!==undefined?this._shapeConfig[e]:this._shapeConfig.labelConfig[e];if(!r&&e==="lineHeight")return this._fetchConfig("fontSize",i,n)*1.4;return typeof r==="function"?r(i,n):r}},{key:"_rowHeight",value:function t(e){return Dt.max(e.map(function(t){return t.height}).concat(e.map(function(t){return t.shapeHeight})))+this._padding}},{key:"_rowWidth",value:function t(n){var r=this;return Dt.sum(n.map(function(t,e){var i=r._padding*(e===n.length-1?0:t.width?2:1);return t.shapeWidth+t.width+i}))}},{key:"render",value:function t(e){var c=this;if(this._select===void 0)this.select(Ht.select("body").append("svg").attr("width","".concat(this._width,"px")).attr("height","".concat(this._height,"px")).node());this._group=Ft.elem("g.d3plus-Legend",{parent:this._select});this._titleGroup=Ft.elem("g.d3plus-Legend-title",{parent:this._group});this._shapeGroup=Ft.elem("g.d3plus-Legend-shape",{parent:this._group});var f=this._height;this._titleHeight=0;this._titleWidth=0;if(this._title){var i=this._titleConfig.fontFamily||this._titleClass.fontFamily()(),n=this._titleConfig.fontSize||this._titleClass.fontSize()();var r=r=this._titleConfig.lineHeight||this._titleClass.lineHeight();r=r?r():n*1.4;var a=Lt.textWrap().fontFamily(i).fontSize(n).lineHeight(r).width(this._width).height(this._height)(this._title);this._titleHeight=r+a.lines.length+this._padding;this._titleWidth=Dt.max(a.widths);f-=this._titleHeight}this._lineData=this._data.map(function(t,e){var i=c._label(t,e);var n=c._shape(t,e);var r=c._fetchConfig("r",t,e);var a={data:t,i:e,id:c._id(t,e),shape:n,shapeR:r,shapeWidth:n==="Circle"?r*2:c._fetchConfig("width",t,e),shapeHeight:n==="Circle"?r*2:c._fetchConfig("height",t,e),y:0};if(!i){a.sentence=false;a.words=[];a.height=0;a.width=0;return a}var o=c._fetchConfig("fontFamily",t,e),s=c._fetchConfig("lineHeight",t,e),l=c._fetchConfig("fontSize",t,e);var u=f-(c._data.length+1)*c._padding,h=c._width;a=Object.assign(a,Lt.textWrap().fontFamily(o).fontSize(l).lineHeight(s).width(h).height(u)(i));a.width=Math.ceil(Dt.max(a.lines.map(function(t){return Lt.textWidth(t,{"font-family":o,"font-size":l})})))+l*.75;a.height=Math.ceil(a.lines.length*(s+1));a.og={height:a.height,width:a.width};a.f=o;a.s=l;a.lh=s;return a});var o;var l=this._width-this._padding*2;o=this._rowWidth(this._lineData);if(this._direction==="column"||o>l){var u=1,h=[];var d=Dt.max(this._lineData.map(function(t){return t.words.length}));this._wrapLines=function(){var e=this;u++;if(u>d)return;var o=u===1?this._lineData.slice():this._lineData.filter(function(t){return t.width+t.shapeWidth+e._padding*(t.width?2:1)>l&&t.words.length>=u}).sort(function(t,e){return e.sentence.length-t.sentence.length});if(o.length&&f>o[0].height*u){var s=false;var t=function t(e){var i=o[e];var n=i.og.height*u,r=i.og.width*(1.5*(1/u));var a=Lt.textWrap().fontFamily(i.f).fontSize(i.s).lineHeight(i.lh).width(r).height(n)(i.sentence);if(!a.truncated){i.width=Math.ceil(Dt.max(a.lines.map(function(t){return Lt.textWidth(t,{"font-family":i.f,"font-size":i.s})})))+i.s;i.height=a.lines.length*(i.lh+1)}else{s=true;return"break"}};for(var i=0;i<o.length;i++){var n=t(i);if(n==="break")break}if(!s)this._wrapRows()}else{h=[];return}};this._wrapRows=function(){h=[];var t=1,e=0;for(var i=0;i<this._lineData.length;i++){var n=this._lineData[i],r=n.width+this._padding*(n.width?2:1)+n.shapeWidth;if(Dt.sum(h.map(function(t){return Dt.max(t,function(t){return Dt.max([t.height,t.shapeHeight])})}))>f){h=[];break}if(r>l){h=[];this._wrapLines();break}else if(e+r<l){e+=r}else if(this._direction!=="column"){e=r;t++}if(!h[t-1])h[t-1]=[];h[t-1].push(n);if(this._direction==="column"){e=0;t++}}};this._wrapRows();if(!h.length||Dt.sum(h,this._rowHeight.bind(this))+this._padding>f){o=Dt.sum(this._lineData.map(function(t){return t.shapeWidth+c._padding}))-this._padding;for(var s=0;s<this._lineData.length;s++){this._lineData[s].width=0;this._lineData[s].height=0}this._wrapRows()}if(h.length&&Dt.sum(h,this._rowHeight.bind(this))+this._padding<f){h.forEach(function(t,e){t.forEach(function(t){if(e){t.y=Dt.sum(h.slice(0,e),c._rowHeight.bind(c))}})});o=Dt.max(h,this._rowWidth.bind(this))}}var g=Dt.max(this._lineData,function(t,e){return Dt.max([t.height,c._fetchConfig("height",t.data,e)])+t.y})+this._titleHeight,v=Dt.max([o,this._titleWidth]);this._outerBounds.width=v;this._outerBounds.height=g;var _=this._padding,p=this._padding;if(this._align==="center")_=(this._width-v)/2;else if(this._align==="right")_=this._width-this._padding-v;if(this._verticalAlign==="middle")p=(this._height-g)/2;else if(this._verticalAlign==="bottom")p=this._height-this._padding-g;this._outerBounds.x=_;this._outerBounds.y=p;this._titleClass.data(this._title?[{text:this._title}]:[]).duration(this._duration).select(this._titleGroup.node()).textAnchor({left:"start",center:"middle",right:"end"}[this._align]).width(this._width-this._padding*2).x(this._padding).y(this._outerBounds.y).config(this._titleConfig).render();this._shapes=[];var y=Ft.configPrep.bind(this)(this._shapeConfig,"legend"),m={id:function t(e){return e.id},label:function t(e){return e.label},lineHeight:function t(e){return e.lH}};var b=this._data.map(function(t,e){var i={__d3plus__:true,data:t,i:e,id:c._id(t,e),label:c._lineData[e].width?c._label(t,e):false,lH:c._fetchConfig("lineHeight",t,e),shape:c._shape(t,e)};return i});this._shapes=[];["Circle","Rect"].forEach(function(e){c._shapes.push((new w[e]).parent(c).data(b.filter(function(t){return t.shape===e})).duration(c._duration).labelConfig({padding:0}).select(c._shapeGroup.node()).verticalAlign("top").config(Ft.assign({},y,m)).render())});if(e)setTimeout(e,this._duration+100);return this}},{key:"active",value:function t(e){this._shapes.forEach(function(t){return t.active(e)});return this}},{key:"align",value:function t(e){return arguments.length?(this._align=e,this):this._align}},{key:"data",value:function t(e){return arguments.length?(this._data=e,this):this._data}},{key:"direction",value:function t(e){return arguments.length?(this._direction=e,this):this._direction}},{key:"duration",value:function t(e){return arguments.length?(this._duration=e,this):this._duration}},{key:"height",value:function t(e){return arguments.length?(this._height=e,this):this._height}},{key:"hover",value:function t(e){this._shapes.forEach(function(t){return t.hover(e)});return this}},{key:"id",value:function t(e){return arguments.length?(this._id=e,this):this._id}},{key:"label",value:function t(e){return arguments.length?(this._label=typeof e==="function"?e:Ft.constant(e),this):this._label}},{key:"outerBounds",value:function t(){return this._outerBounds}},{key:"padding",value:function t(e){return arguments.length?(this._padding=e,this):this._padding}},{key:"select",value:function t(e){return arguments.length?(this._select=Ht.select(e),this):this._select}},{key:"shape",value:function t(e){return arguments.length?(this._shape=typeof e==="function"?e:Ft.constant(e),this):this._shape}},{key:"shapeConfig",value:function t(e){return arguments.length?(this._shapeConfig=Ft.assign(this._shapeConfig,e),this):this._shapeConfig}},{key:"title",value:function t(e){return arguments.length?(this._title=e,this):this._title}},{key:"titleConfig",value:function t(e){return arguments.length?(this._titleConfig=Ft.assign(this._titleConfig,e),this):this._titleConfig}},{key:"verticalAlign",value:function t(e){return arguments.length?(this._verticalAlign=e,this):this._verticalAlign}},{key:"width",value:function t(e){return arguments.length?(this._width=e,this):this._width}}]);return i}(Ft.BaseClass);var b=function(t){s(i,t);var e=y(i);function i(){var f;r(this,i);f=e.call(this);f._axisClass=new n.Axis;f._axisConfig={gridSize:0,shapeConfig:{labelConfig:{fontColor:"#222"}},titleConfig:{fontSize:12}};f._axisTest=new n.Axis;f._align="middle";f._buckets=5;f._bucketAxis=false;f._bucketFormat=function(e,t,i,n){var r=f._axisConfig.tickFormat?f._axisConfig.tickFormat:d.formatAbbreviate;var a=i[t+1];var o=t?i[t-1]:false;var s=t===i.length-1;if(e===a||s){var l=s&&e<Dt.max(n)?"+":"";return"".concat(r(e)).concat(l)}else{var u=a?a/100:e/100;var h=u>=1||u<=-1?Math.round(u).toString().length-1:u.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length*-1;var c=Math.pow(10,h);return o===e&&t===1?"".concat(r(Dt.min([e+c,n.find(function(t){return t>e&&t<a})]))," - ").concat(r(a)):"".concat(r(e)," - ").concat(r(Dt.max([a-c,n.reverse().find(function(t){return t>e&&t<a})])))}};f._centered=true;f._colorMax="#0C8040";f._colorMid="#f7f7f7";f._colorMin="#b22200";f._data=[];f._duration=600;f._height=200;f._labelClass=new Lt.TextBox;f._legendClass=new m;f._legendConfig={shapeConfig:{labelConfig:{fontColor:"#222"},stroke:"#444",strokeWidth:1}};f._midpoint=0;f._orient="bottom";f._outerBounds={width:0,height:0,x:0,y:0};f._padding=5;f._rectClass=(new w.Rect).parent(u(f));f._rectConfig={stroke:"#444",strokeWidth:1};f._scale="linear";f._size=10;f._value=Ft.accessor("value");f._width=400;return f}o(i,[{key:"render",value:function t(e){var r=this;if(this._select===void 0)this.select(Ht.select("body").append("svg").attr("width","".concat(this._width,"px")).attr("height","".concat(this._height,"px")).node());var i=["bottom","top"].includes(this._orient);var n=i?"height":"width",a=i?"width":"height",o=i?"x":"y",s=i?"y":"x";this._group=Ft.elem("g.d3plus-ColorScale",{parent:this._select});var l=this._data.map(this._value).sort(function(t,e){return t-e});var u=Dt.extent(l);var h=u[0]<this._midpoint;var c=u[1]>this._midpoint;var f=h&&c;var d=this._buckets instanceof Array?this._buckets.length:this._buckets;var g=this._color,v,_;if(g&&!(g instanceof Array)){g=Dt.range(0,d,1).map(function(t){return Gt.colorLighter(g,(t+1)/d)}).reverse()}if(this._scale==="jenks"){var p=this._data.map(this._value).filter(function(t){return t!==null&&typeof t==="number"});var y=Dt.min([g?g.length:d,p.length]);var m=[];if(this._buckets instanceof Array){_=this._buckets}else{if(f&&this._centered){var b=Math.floor(y/2);var w=y%2;var x=p.filter(function(t){return t<r._midpoint});var C=Dt.deviation(x);var k=p.concat(this._midpoint).filter(function(t){return t>=r._midpoint});var S=Dt.deviation(k);var M=C>S?1:0;var O=S>C?1:0;var j=Nt(x,b+w*M);var A=Nt(k,b+w*O);m=j.concat(A)}else{m=Nt(p,y)}_=m.map(function(t){return t[0]})}var E=new Set(_);if(_.length!==E.size){v=Array.from(E)}if(!g){if(f){g=[this._colorMin,this._colorMid,this._colorMax];var T=_.slice(0,y).filter(function(t,e){return t<r._midpoint&&_[e+1]<=r._midpoint});var B=_.slice(0,y).filter(function(t,e){return t<=r._midpoint&&_[e+1]>r._midpoint});var W=_.slice(0,y).filter(function(t,e){return t>r._midpoint&&_[e+1]>r._midpoint});var P=T.map(function(t,e){return!e?g[0]:Gt.colorLighter(g[0],e/T.length)});var z=B.map(function(){return g[1]});var D=W.map(function(t,e){return e===W.length-1?g[2]:Gt.colorLighter(g[2],1-(e+1)/W.length)});g=P.concat(z).concat(D)}else{g=Dt.range(0,d,1).map(function(t){return Gt.colorLighter(r._colorMax,t/d)}).reverse()}}if(p.length<=y){g=g.slice(y-p.length)}g=[g[0]].concat(g);this._colorScale=Rt.scaleThreshold().domain(_).range(g)}else{var H=this._buckets instanceof Array?this._buckets:undefined;if(f&&!g){var F=Math.floor(d/2);var L=Dt.range(0,F,1).map(function(t){return!t?r._colorMin:Gt.colorLighter(r._colorMin,t/F)});var R=(d%2?[0]:[]).map(function(){return r._colorMid});var q=Dt.range(0,F,1).map(function(t){return!t?r._colorMax:Gt.colorLighter(r._colorMax,t/F)}).reverse();g=L.concat(R).concat(q);if(!H){var G=(g.length-1)/2;H=[u[0],this._midpoint,u[1]];H=Dt.range(u[0],this._midpoint,-(u[0]-this._midpoint)/G).concat(Dt.range(this._midpoint,u[1],(u[1]-this._midpoint)/G)).concat([u[1]])}}else{if(!g){if(this._scale==="buckets"||this._scale==="quantile"){g=Dt.range(0,d,1).map(function(t){return Gt.colorLighter(h?r._colorMin:r._colorMax,t/d)});if(c)g=g.reverse()}else{g=h?[this._colorMin,Gt.colorLighter(this._colorMin,.8)]:[Gt.colorLighter(this._colorMax,.8),this._colorMax]}}if(!H){if(this._scale==="quantile"){var N=1/(g.length-1);H=Dt.range(0,1+N/2,N).map(function(t){return Dt.quantile(l,t)})}else if(f&&this._color&&this._centered){var I=(this._midpoint-u[0])/Math.floor(g.length/2);var V=(u[1]-this._midpoint)/Math.floor(g.length/2);var $=Dt.range(u[0],this._midpoint,I);var K=Dt.range(this._midpoint,u[1]+V/2,V);H=$.concat(K)}else{var X=(u[1]-u[0])/(g.length-1);H=Dt.range(u[0],u[1]+X/2,X)}}}if(this._scale==="buckets"||this._scale==="quantile"){_=H;g=[g[0]].concat(g)}else if(this._scale==="log"){var Y=H.filter(function(t){return t<0});if(Y.length){var J=Y[0];var Q=Y.map(function(t){return-Math.pow(Math.abs(J),t/J)});Y.forEach(function(t,e){H[H.indexOf(t)]=Q[e]})}var U=H.filter(function(t){return t>0});if(U.length){var Z=U[U.length-1];var tt=U.map(function(t){return Math.pow(Z,t/Z)});U.forEach(function(t,e){H[H.indexOf(t)]=tt[e]})}if(H.includes(0))H[H.indexOf(0)]=1}this._colorScale=(this._scale==="buckets"||this._scale==="quantile"?Rt.scaleThreshold:Rt.scaleLinear)().domain(H).range(g)}var et=this._bucketAxis||!["buckets","jenks","quantile"].includes(this._scale);var it=qt.transition().duration(this._duration);var nt={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:it,update:{opacity:1}};var rt=Ft.elem("g.d3plus-ColorScale-labels",Object.assign({condition:et},nt));var at=Ft.elem("g.d3plus-ColorScale-Rect",Object.assign({condition:et},nt));var ot=Ft.elem("g.d3plus-ColorScale-legend",Object.assign({condition:!et},nt));if(et){var st;var lt={x:0,y:0};var ut=u.slice();if(this._bucketAxis){var ht=ut[ut.length-1];var ct=ut[ut.length-2];var ft=ht?ht/10:ct/10;var dt=ft>=1||ft<=-1?Math.round(ft).toString().length-1:ft.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length*-1;var gt=Math.pow(10,dt);ut[ut.length-1]=ht+gt}var vt=Ft.assign({domain:ut,duration:this._duration,height:this._height,labels:v||_,orient:this._orient,padding:this._padding,scale:this._scale==="log"?"log":"linear",ticks:_,width:this._width},this._axisConfig);var _t=Ft.assign({height:this["_".concat(n)]/2,width:this["_".concat(a)]/2},this._labelConfig||this._axisConfig.titleConfig);this._labelClass.config(_t);var pt=[];if(i&&this._labelMin){var yt={"font-family":this._labelClass.fontFamily()(this._labelMin),"font-size":this._labelClass.fontSize()(this._labelMin),"font-weight":this._labelClass.fontWeight()(this._labelMin)};if(yt["font-family"]instanceof Array)yt["font-family"]=yt["font-family"][0];var mt=Lt.textWidth(this._labelMin,yt);if(mt&&mt<this["_".concat(a)]/2){pt.push(this._labelMin);mt+=this._padding;if(i)lt.x+=mt;vt[a]-=mt}}if(i&&this._labelMax){var bt={"font-family":this._labelClass.fontFamily()(this._labelMax),"font-size":this._labelClass.fontSize()(this._labelMax),"font-weight":this._labelClass.fontWeight()(this._labelMax)};if(bt["font-family"]instanceof Array)bt["font-family"]=bt["font-family"][0];var wt=Lt.textWidth(this._labelMax,bt);if(wt&&wt<this["_".concat(a)]/2){pt.push(this._labelMax);wt+=this._padding;if(!i)lt.y+=wt;vt[a]-=wt}}this._axisTest.select(Ft.elem("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:this._group}).node()).config(vt).duration(0).render();var xt=this._axisTest.outerBounds();this._outerBounds[a]=this["_".concat(a)]-this._padding*2;this._outerBounds[n]=xt[n]+this._size;this._outerBounds[o]=this._padding;this._outerBounds[s]=this._padding;if(this._align==="middle")this._outerBounds[s]=(this["_".concat(n)]-this._outerBounds[n])/2;else if(this._align==="end")this._outerBounds[s]=this["_".concat(n)]-this._padding-this._outerBounds[n];var Ct=this._outerBounds[s]+(["bottom","right"].includes(this._orient)?this._size:0)-(vt.padding||this._axisClass.padding());var kt="translate(".concat(lt.x+(i?0:Ct),", ").concat(lt.y+(i?Ct:0),")");this._axisClass.select(Ft.elem("g.d3plus-ColorScale-axis",Ft.assign(nt,{condition:true,enter:{transform:kt},update:{transform:kt}})).node()).config(vt).align("start").render();var St=this._axisTest._getPosition.bind(this._axisTest);var Mt=this._axisTest._getRange();var Ot=this._group.selectAll("defs").data([0]);var jt=Ot.enter().append("defs");jt.append("linearGradient").attr("id","gradient-".concat(this._uuid));Ot=jt.merge(Ot);Ot.select("linearGradient").attr("".concat(o,"1"),i?"0%":"100%").attr("".concat(o,"2"),i?"100%":"0%").attr("".concat(s,"1"),"0%").attr("".concat(s,"2"),"0%");var At=Ot.select("linearGradient").selectAll("stop").data(g);var Et=this._colorScale.domain();var Tt=Rt.scaleLinear().domain(Mt).range(i?[0,100]:[100,0]);At.enter().append("stop").merge(At).attr("offset",function(t,e){return"".concat(e<=Et.length-1?Tt(St(Et[e])):100,"%")}).attr("stop-color",String);var Bt=function t(e,i){var n=_[i+1]||ut[ut.length-1];return Math.abs(St(n)-St(e))};var Wt=Ft.assign((st={duration:this._duration,fill:_?function(t){return r._colorScale(t)}:"url(#gradient-".concat(this._uuid,")")},It(st,o,_?function(t,e){return St(t)+Bt(t,e)/2-(["left","right"].includes(r._orient)?Bt(t,e):0)}:Mt[0]+(Mt[1]-Mt[0])/2+lt[o]),It(st,s,this._outerBounds[s]+(["top","left"].includes(this._orient)?xt[n]:0)+this._size/2+lt[s]),It(st,a,_?Bt:Mt[1]-Mt[0]),It(st,n,this._size),st),this._rectConfig);this._rectClass.data(_||[0]).id(function(t,e){return e}).select(at.node()).config(Wt).render();_t.height=this._outerBounds[n];_t.width=this._outerBounds[a];this._labelClass.config(_t).data(pt).select(rt.node()).x(function(t){return t===r._labelMax?Wt.x+Wt.width/2+r._padding:r._outerBounds.x}).y(function(t){return Wt.y-r._labelClass.fontSize()(t)/2}).text(function(t){return t}).rotate(i?0:this._orient==="right"?90:-90).render()}else{Ft.elem("g.d3plus-ColorScale-axis",Object.assign({condition:et},nt));var Pt=_.reduce(function(t,e,i){var n=r._bucketFormat.bind(r)(e,i,_,l);t.push({color:g[i+1],id:n});return t},[]);var zt=Ft.assign({align:i?"center":{start:"left",middle:"center",end:"right"}[this._align],direction:i?"row":"column",duration:this._duration,height:this._height,padding:this._padding,shapeConfig:Ft.assign({duration:this._duration},this._axisConfig.shapeConfig||{}),title:this._axisConfig.title,titleConfig:this._axisConfig.titleConfig||{},width:this._width,verticalAlign:i?{start:"top",middle:"middle",end:"bottom"}[this._align]:"middle"},this._legendConfig);this._legendClass.data(Pt).select(ot.node()).config(zt).render();this._outerBounds=this._legendClass.outerBounds()}if(e)setTimeout(e,this._duration+100);return this}},{key:"axisConfig",value:function t(e){return arguments.length?(this._axisConfig=Ft.assign(this._axisConfig,e),this):this._axisConfig}},{key:"align",value:function t(e){return arguments.length?(this._align=e,this):this._align}},{key:"buckets",value:function t(e){return arguments.length?(this._buckets=e,this):this._buckets}},{key:"bucketAxis",value:function t(e){return arguments.length?(this._bucketAxis=e,this):this._bucketAxis}},{key:"bucketFormat",value:function t(e){return arguments.length?(this._bucketFormat=e,this):this._bucketFormat}},{key:"centered",value:function t(e){return arguments.length?(this._centered=e,this):this._centered}},{key:"color",value:function t(e){return arguments.length?(this._color=e,this):this._color}},{key:"colorMax",value:function t(e){return arguments.length?(this._colorMax=e,this):this._colorMax}},{key:"colorMid",value:function t(e){return arguments.length?(this._colorMid=e,this):this._colorMid}},{key:"colorMin",value:function t(e){return arguments.length?(this._colorMin=e,this):this._colorMin}},{key:"data",value:function t(e){return arguments.length?(this._data=e,this):this._data}},{key:"duration",value:function t(e){return arguments.length?(this._duration=e,this):this._duration}},{key:"height",value:function t(e){return arguments.length?(this._height=e,this):this._height}},{key:"labelConfig",value:function t(e){return arguments.length?(this._labelConfig=e,this):this._labelConfig}},{key:"labelMin",value:function t(e){return arguments.length?(this._labelMin=e,this):this._labelMin}},{key:"labelMax",value:function t(e){return arguments.length?(this._labelMax=e,this):this._labelMax}},{key:"legendConfig",value:function t(e){return arguments.length?(this._legendConfig=Ft.assign(this._legendConfig,e),this):this._legendConfig}},{key:"midpoint",value:function t(e){return arguments.length?(this._midpoint=e,this):this._midpoint}},{key:"orient",value:function t(e){return arguments.length?(this._orient=e,this):this._orient}},{key:"outerBounds",value:function t(){return this._outerBounds}},{key:"padding",value:function t(e){return arguments.length?(this._padding=e,this):this._padding}},{key:"rectConfig",value:function t(e){return arguments.length?(this._rectConfig=Ft.assign(this._rectConfig,e),this):this._rectConfig}},{key:"scale",value:function t(e){return arguments.length?(this._scale=e,this):this._scale}},{key:"select",value:function t(e){return arguments.length?(this._select=Ht.select(e),this):this._select}},{key:"size",value:function t(e){return arguments.length?(this._size=e,this):this._size}},{key:"value",value:function t(e){return arguments.length?(this._value=typeof e==="function"?e:Ft.constant(e),this):this._value}},{key:"width",value:function t(e){return arguments.length?(this._width=e,this):this._width}}]);return i}(Ft.BaseClass);t.ColorScale=b;t.Legend=m;t.ckmeans=Nt;Object.defineProperty(t,"__esModule",{value:true})});

@@ -31,3 +31,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

import Legend from "./Legend";
import { extent, merge, min, quantile, range, deviation } from "d3-array";
import { extent, max, min, quantile, range, deviation } from "d3-array";
import { scaleLinear, scaleThreshold } from "d3-scale";

@@ -80,2 +80,24 @@ import { select as _select } from "d3-selection";

_this._bucketAxis = false;
_this._bucketFormat = function (tick, i, ticks, allValues) {
var format = _this._axisConfig.tickFormat ? _this._axisConfig.tickFormat : formatAbbreviate;
var next = ticks[i + 1];
var prev = i ? ticks[i - 1] : false;
var last = i === ticks.length - 1;
if (tick === next || last) {
var suffix = last && tick < max(allValues) ? "+" : "";
return "".concat(format(tick)).concat(suffix);
} else {
var mod = next ? next / 100 : tick / 100;
var pow = mod >= 1 || mod <= -1 ? Math.round(mod).toString().length - 1 : mod.toString().split(".")[1].replace(/([1-9])[1-9].*$/, "$1").length * -1;
var ten = Math.pow(10, pow);
return prev === tick && i === 1 ? "".concat(format(min([tick + ten, allValues.find(function (d) {
return d > tick && d < next;
})])), " - ").concat(format(next)) : "".concat(format(tick), " - ").concat(format(max([next - ten, allValues.reverse().find(function (d) {
return d > tick && d < next;
})])));
}
};
_this._centered = true;

@@ -151,2 +173,3 @@ _this._colorMax = "#0C8040";

var diverging = negative && positive;
var numBuckets = this._buckets instanceof Array ? this._buckets.length : this._buckets;
var colors = this._color,

@@ -157,4 +180,4 @@ labels,

if (colors && !(colors instanceof Array)) {
colors = range(0, this._buckets, 1).map(function (i) {
return colorLighter(colors, (i + 1) / _this2._buckets);
colors = range(0, numBuckets, 1).map(function (i) {
return colorLighter(colors, (i + 1) / numBuckets);
}).reverse();

@@ -168,28 +191,33 @@ }

var buckets = min([colors ? colors.length : this._buckets, data.length]);
var buckets = min([colors ? colors.length : numBuckets, data.length]);
var jenks = [];
if (diverging && this._centered) {
var half = Math.floor(buckets / 2);
var residual = buckets % 2;
var negatives = data.filter(function (d) {
return d < _this2._midpoint;
if (this._buckets instanceof Array) {
ticks = this._buckets;
} else {
if (diverging && this._centered) {
var half = Math.floor(buckets / 2);
var residual = buckets % 2;
var negatives = data.filter(function (d) {
return d < _this2._midpoint;
});
var negativesDeviation = deviation(negatives);
var positives = data.concat(this._midpoint).filter(function (d) {
return d >= _this2._midpoint;
});
var positivesDeviation = deviation(positives);
var isNegativeMax = negativesDeviation > positivesDeviation ? 1 : 0;
var isPositiveMax = positivesDeviation > negativesDeviation ? 1 : 0;
var negativeJenks = ckmeans(negatives, half + residual * isNegativeMax);
var positiveJenks = ckmeans(positives, half + residual * isPositiveMax);
jenks = negativeJenks.concat(positiveJenks);
} else {
jenks = ckmeans(data, buckets);
}
ticks = jenks.map(function (c) {
return c[0];
});
var negativesDeviation = deviation(negatives);
var positives = data.concat(this._midpoint).filter(function (d) {
return d >= _this2._midpoint;
});
var positivesDeviation = deviation(positives);
var isNegativeMax = negativesDeviation > positivesDeviation ? 1 : 0;
var isPositiveMax = positivesDeviation > negativesDeviation ? 1 : 0;
var negativeJenks = ckmeans(negatives, half + residual * isNegativeMax);
var positiveJenks = ckmeans(positives, half + residual * isPositiveMax);
jenks = negativeJenks.concat(positiveJenks);
} else {
jenks = ckmeans(data, buckets);
}
ticks = merge(jenks.map(function (c, i) {
return i === jenks.length - 1 ? [c[0], c[c.length - 1]] : [c[0]];
}));
var tickSet = new Set(ticks);

@@ -231,4 +259,4 @@

} else {
colors = range(0, this._buckets, 1).map(function (i) {
return colorLighter(_this2._colorMax, i / _this2._buckets);
colors = range(0, numBuckets, 1).map(function (i) {
return colorLighter(_this2._colorMax, i / numBuckets);
}).reverse();

@@ -242,8 +270,9 @@ }

this._colorScale = scaleThreshold().domain(ticks).range(["black"].concat(colors).concat(colors[colors.length - 1]));
colors = [colors[0]].concat(colors);
this._colorScale = scaleThreshold().domain(ticks).range(colors);
} else {
var _buckets;
var _buckets = this._buckets instanceof Array ? this._buckets : undefined;
if (diverging && !colors) {
var _half = Math.floor(this._buckets / 2);
var _half = Math.floor(numBuckets / 2);

@@ -254,3 +283,3 @@ var _negativeColors = range(0, _half, 1).map(function (i) {

var _spanningColors = (this._buckets % 2 ? [0] : []).map(function () {
var _spanningColors = (numBuckets % 2 ? [0] : []).map(function () {
return _this2._colorMid;

@@ -264,10 +293,13 @@ });

colors = _negativeColors.concat(_spanningColors).concat(_positiveColors);
var step = (colors.length - 1) / 2;
_buckets = [domain[0], this._midpoint, domain[1]];
_buckets = range(domain[0], this._midpoint, -(domain[0] - this._midpoint) / step).concat(range(this._midpoint, domain[1], (domain[1] - this._midpoint) / step)).concat([domain[1]]);
if (!_buckets) {
var step = (colors.length - 1) / 2;
_buckets = [domain[0], this._midpoint, domain[1]];
_buckets = range(domain[0], this._midpoint, -(domain[0] - this._midpoint) / step).concat(range(this._midpoint, domain[1], (domain[1] - this._midpoint) / step)).concat([domain[1]]);
}
} else {
if (!colors) {
if (this._scale === "buckets" || this._scale === "quantile") {
colors = range(0, this._buckets, 1).map(function (i) {
return colorLighter(negative ? _this2._colorMin : _this2._colorMax, i / _this2._buckets);
colors = range(0, numBuckets, 1).map(function (i) {
return colorLighter(negative ? _this2._colorMin : _this2._colorMax, i / numBuckets);
});

@@ -280,18 +312,20 @@ if (positive) colors = colors.reverse();

if (this._scale === "quantile") {
var _step = 1 / (colors.length - 1);
if (!_buckets) {
if (this._scale === "quantile") {
var _step = 1 / (colors.length - 1);
_buckets = range(0, 1 + _step / 2, _step).map(function (d) {
return quantile(allValues, d);
});
} else if (diverging && this._color && this._centered) {
var negativeStep = (this._midpoint - domain[0]) / Math.floor(colors.length / 2);
var positiveStep = (domain[1] - this._midpoint) / Math.floor(colors.length / 2);
var negativeBuckets = range(domain[0], this._midpoint, negativeStep);
var positiveBuckets = range(this._midpoint, domain[1] + positiveStep / 2, positiveStep);
_buckets = negativeBuckets.concat(positiveBuckets);
} else {
var _step2 = (domain[1] - domain[0]) / (colors.length - 1);
_buckets = range(0, 1 + _step / 2, _step).map(function (d) {
return quantile(allValues, d);
});
} else if (diverging && this._color && this._centered) {
var negativeStep = (this._midpoint - domain[0]) / Math.floor(colors.length / 2);
var positiveStep = (domain[1] - this._midpoint) / Math.floor(colors.length / 2);
var negativeBuckets = range(domain[0], this._midpoint, negativeStep);
var positiveBuckets = range(this._midpoint, domain[1] + positiveStep / 2, positiveStep);
_buckets = negativeBuckets.concat(positiveBuckets);
} else {
var _step2 = (domain[1] - domain[0]) / (colors.length - 1);
_buckets = range(domain[0], domain[1] + _step2 / 2, _step2);
_buckets = range(domain[0], domain[1] + _step2 / 2, _step2);
}
}

@@ -301,3 +335,4 @@ }

if (this._scale === "buckets" || this._scale === "quantile") {
ticks = _buckets.concat([_buckets[_buckets.length - 1]]);
ticks = _buckets;
colors = [colors[0]].concat(colors);
} else if (this._scale === "log") {

@@ -339,3 +374,3 @@ var _negativeBuckets = _buckets.filter(function (d) {

this._colorScale = scaleLinear().domain(_buckets).range(colors);
this._colorScale = (this._scale === "buckets" || this._scale === "quantile" ? scaleThreshold : scaleLinear)().domain(_buckets).range(colors);
}

@@ -375,4 +410,15 @@

};
var axisDomain = domain.slice();
if (this._bucketAxis) {
var last = axisDomain[axisDomain.length - 1];
var prev = axisDomain[axisDomain.length - 2];
var mod = last ? last / 10 : prev / 10;
var pow = mod >= 1 || mod <= -1 ? Math.round(mod).toString().length - 1 : mod.toString().split(".")[1].replace(/([1-9])[1-9].*$/, "$1").length * -1;
var ten = Math.pow(10, pow);
axisDomain[axisDomain.length - 1] = last + ten;
}
var axisConfig = assign({
domain: horizontal ? domain : domain.reverse(),
domain: axisDomain,
duration: this._duration,

@@ -469,3 +515,3 @@ height: this._height,

defs.select("linearGradient").attr("".concat(x, "1"), horizontal ? "0%" : "100%").attr("".concat(x, "2"), horizontal ? "100%" : "0%").attr("".concat(y, "1"), "0%").attr("".concat(y, "2"), "0%");
var stops = defs.select("linearGradient").selectAll("stop").data(horizontal ? colors : colors);
var stops = defs.select("linearGradient").selectAll("stop").data(colors);

@@ -476,3 +522,3 @@ var scaleDomain = this._colorScale.domain();

stops.enter().append("stop").merge(stops).attr("offset", function (d, i) {
return "".concat(offsetScale(axisScale(scaleDomain[i])), "%");
return "".concat(i <= scaleDomain.length - 1 ? offsetScale(axisScale(scaleDomain[i])) : 100, "%");
}).attr("stop-color", String);

@@ -482,4 +528,4 @@ /** determines the width of buckets */

var bucketWidth = function bucketWidth(d, i) {
var w = Math.abs(axisScale(ticks[i + 1]) - axisScale(d));
return w || 2;
var next = ticks[i + 1] || axisDomain[axisDomain.length - 1];
return Math.abs(axisScale(next) - axisScale(d));
};

@@ -496,3 +542,3 @@

this._rectClass.data(ticks ? ticks.slice(0, ticks.length - 1) : [0]).id(function (d, i) {
this._rectClass.data(ticks || [0]).id(function (d, i) {
return i;

@@ -515,12 +561,9 @@ }).select(rectGroup.node()).config(rectConfig).render();

}, groupParams));
var format = this._axisConfig.tickFormat ? this._axisConfig.tickFormat : formatAbbreviate;
var legendData = ticks.reduce(function (arr, tick, i) {
if (i !== ticks.length - 1) {
var next = ticks[i + 1];
arr.push({
color: colors[i],
id: tick === next ? "".concat(format(tick), "+") : "".concat(format(tick), " - ").concat(format(next))
});
}
var label = _this2._bucketFormat.bind(_this2)(tick, i, ticks, allValues);
arr.push({
color: colors[i + 1],
id: label
});
return arr;

@@ -585,4 +628,4 @@ }, []);

@memberof ColorScale
@desc The number of discrete buckets to create in a bucketed color scale. Will be overridden by any custom Array of colors passed to the `color` method.
@param {Number} [*value* = 5]
@desc The number of discrete buckets to create in a bucketed color scale. Will be overridden by any custom Array of colors passed to the `color` method. Optionally, users can supply an Array of values used to separate buckets, such as `[0, 10, 25, 50, 90]` for a percentage scale. This value would create 4 buckets, with each value representing the break point between each bucket (so 5 values makes 4 buckets).
@param {Number|Array} [*value* = 5]
@chainable

@@ -610,2 +653,14 @@ */

@memberof ColorScale
@desc A function for formatting the labels associated to each bucket in a bucket-type scale ("jenks", "quantile", etc). The function is passed four arguments: the start value of the current bucket, it's index in the full Array of buckets, the full Array of buckets, and an Array of every value present in the data used to construct the buckets. Keep in mind that the end value for the bucket is not actually the next bucket in the list, but includes every value up until that next bucket value (less than, but not equal to). By default, d3plus will make the end value slightly less than it's current value, so that it does not overlap with the start label for the next bucket.
@param {Function} [*value*]
@chainable
*/
}, {
key: "bucketFormat",
value: function bucketFormat(_) {
return arguments.length ? (this._bucketFormat = _, this) : this._bucketFormat;
}
/**
@memberof ColorScale
@desc Determines whether or not to display a midpoint centered Axis. Does not apply to quantile scales.

@@ -612,0 +667,0 @@ @param {Boolean} [*value* = false]

{
"name": "d3plus-legend",
"version": "0.9.0",
"version": "0.9.1",
"description": "An easy to use javascript chart legend.",

@@ -5,0 +5,0 @@ "main": "build/d3plus-legend.js",

@@ -44,2 +44,3 @@ # d3plus-legend

* [.bucketAxis([*value*])](#ColorScale.bucketAxis) ↩︎
* [.bucketFormat([*value*])](#ColorScale.bucketFormat) ↩︎
* [.centered([*value*])](#ColorScale.centered) ↩︎

@@ -77,3 +78,3 @@ * [.color([*value*])](#ColorScale.color) ↩︎

<a name="ColorScale.render" href="#ColorScale.render">#</a> ColorScale.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L93)
<a name="ColorScale.render" href="#ColorScale.render">#</a> ColorScale.**render**([*callback*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L116)

@@ -86,3 +87,3 @@ Renders the current ColorScale to the page. If a *callback* is specified, it will be called once the ColorScale is done drawing.

<a name="ColorScale.axisConfig" href="#ColorScale.axisConfig">#</a> ColorScale.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L484)
<a name="ColorScale.axisConfig" href="#ColorScale.axisConfig">#</a> ColorScale.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L527)

@@ -95,3 +96,3 @@ The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Axis](http://d3plus.org/docs/#Axis). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/).

<a name="ColorScale.align" href="#ColorScale.align">#</a> ColorScale.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L494)
<a name="ColorScale.align" href="#ColorScale.align">#</a> ColorScale.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L537)

@@ -104,5 +105,5 @@ If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance. If *value* is not specified, returns the current horizontal alignment.

<a name="ColorScale.buckets" href="#ColorScale.buckets">#</a> ColorScale.**buckets**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L504)
<a name="ColorScale.buckets" href="#ColorScale.buckets">#</a> ColorScale.**buckets**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L547)
The number of discrete buckets to create in a bucketed color scale. Will be overridden by any custom Array of colors passed to the `color` method.
The number of discrete buckets to create in a bucketed color scale. Will be overridden by any custom Array of colors passed to the `color` method. Optionally, users can supply an Array of values used to separate buckets, such as `[0, 10, 25, 50, 90]` for a percentage scale. This value would create 4 buckets, with each value representing the break point between each bucket (so 5 values makes 4 buckets).

@@ -113,3 +114,3 @@

<a name="ColorScale.bucketAxis" href="#ColorScale.bucketAxis">#</a> ColorScale.**bucketAxis**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L514)
<a name="ColorScale.bucketAxis" href="#ColorScale.bucketAxis">#</a> ColorScale.**bucketAxis**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L557)

@@ -122,4 +123,12 @@ Determines whether or not to use an Axis to display bucket scales (both "buckets" and "jenks"). When set to `false`, bucketed scales will use the `Legend` class to display squares for each range of data. When set to `true`, bucketed scales will be displayed on an `Axis`, similar to "linear" scales.

<a name="ColorScale.centered" href="#ColorScale.centered">#</a> ColorScale.**centered**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L525)
<a name="ColorScale.bucketFormat" href="#ColorScale.bucketFormat">#</a> ColorScale.**bucketFormat**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L567)
A function for formatting the labels associated to each bucket in a bucket-type scale ("jenks", "quantile", etc). The function is passed four arguments: the start value of the current bucket, it's index in the full Array of buckets, the full Array of buckets, and an Array of every value present in the data used to construct the buckets. Keep in mind that the end value for the bucket is not actually the next bucket in the list, but includes every value up until that next bucket value (less than, but not equal to). By default, d3plus will make the end value slightly less than it's current value, so that it does not overlap with the start label for the next bucket.
This is a static method of [<code>ColorScale</code>](#ColorScale), and is chainable with other methods of this Class.
<a name="ColorScale.centered" href="#ColorScale.centered">#</a> ColorScale.**centered**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L578)
Determines whether or not to display a midpoint centered Axis. Does not apply to quantile scales.

@@ -131,3 +140,3 @@

<a name="ColorScale.color" href="#ColorScale.color">#</a> ColorScale.**color**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L535)
<a name="ColorScale.color" href="#ColorScale.color">#</a> ColorScale.**color**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L588)

@@ -140,3 +149,3 @@ Overrides the default internal logic of `colorMin`, `colorMid`, and `colorMax` to only use just this specified color. If a single color is given as a String, then the scale is interpolated by lightening that color. Otherwise, the function expects an Array of color values to be used in order for the scale.

<a name="ColorScale.colorMax" href="#ColorScale.colorMax">#</a> ColorScale.**colorMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L545)
<a name="ColorScale.colorMax" href="#ColorScale.colorMax">#</a> ColorScale.**colorMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L598)

@@ -149,3 +158,3 @@ Defines the color to be used for numbers greater than the value of the `midpoint` on the scale (defaults to `0`). Colors in between this value and the value of `colorMid` will be interpolated, unless a custom Array of colors has been specified using the `color` method.

<a name="ColorScale.colorMid" href="#ColorScale.colorMid">#</a> ColorScale.**colorMid**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L555)
<a name="ColorScale.colorMid" href="#ColorScale.colorMid">#</a> ColorScale.**colorMid**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L608)

@@ -158,3 +167,3 @@ Defines the color to be used for the midpoint of a diverging scale, based on the current value of the `midpoint` method (defaults to `0`). Colors in between this value and the values of `colorMin` and `colorMax` will be interpolated, unless a custom Array of colors has been specified using the `color` method.

<a name="ColorScale.colorMin" href="#ColorScale.colorMin">#</a> ColorScale.**colorMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L565)
<a name="ColorScale.colorMin" href="#ColorScale.colorMin">#</a> ColorScale.**colorMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L618)

@@ -167,3 +176,3 @@ Defines the color to be used for numbers less than the value of the `midpoint` on the scale (defaults to `0`). Colors in between this value and the value of `colorMid` will be interpolated, unless a custom Array of colors has been specified using the `color` method.

<a name="ColorScale.data" href="#ColorScale.data">#</a> ColorScale.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L575)
<a name="ColorScale.data" href="#ColorScale.data">#</a> ColorScale.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L628)

@@ -176,3 +185,3 @@ If *data* is specified, sets the data array to the specified array and returns the current class instance. If *data* is not specified, returns the current data array. A shape key will be drawn for each object in the array.

<a name="ColorScale.duration" href="#ColorScale.duration">#</a> ColorScale.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L585)
<a name="ColorScale.duration" href="#ColorScale.duration">#</a> ColorScale.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L638)

@@ -185,3 +194,3 @@ If *value* is specified, sets the transition duration of the ColorScale and returns the current class instance. If *value* is not specified, returns the current duration.

<a name="ColorScale.height" href="#ColorScale.height">#</a> ColorScale.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L595)
<a name="ColorScale.height" href="#ColorScale.height">#</a> ColorScale.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L648)

@@ -194,3 +203,3 @@ If *value* is specified, sets the overall height of the ColorScale and returns the current class instance. If *value* is not specified, returns the current height value.

<a name="ColorScale.labelConfig" href="#ColorScale.labelConfig">#</a> ColorScale.**labelConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L605)
<a name="ColorScale.labelConfig" href="#ColorScale.labelConfig">#</a> ColorScale.**labelConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L658)

@@ -203,3 +212,3 @@ A pass-through for the [TextBox](http://d3plus.org/docs/#TextBox) class used to style the labelMin and labelMax text.

<a name="ColorScale.labelMin" href="#ColorScale.labelMin">#</a> ColorScale.**labelMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L615)
<a name="ColorScale.labelMin" href="#ColorScale.labelMin">#</a> ColorScale.**labelMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L668)

@@ -212,3 +221,3 @@ Defines a text label to be displayed off of the end of the minimum point in the scale (currently only available in horizontal orientation).

<a name="ColorScale.labelMax" href="#ColorScale.labelMax">#</a> ColorScale.**labelMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L625)
<a name="ColorScale.labelMax" href="#ColorScale.labelMax">#</a> ColorScale.**labelMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L678)

@@ -221,3 +230,3 @@ Defines a text label to be displayed off of the end of the maximum point in the scale (currently only available in horizontal orientation).

<a name="ColorScale.legendConfig" href="#ColorScale.legendConfig">#</a> ColorScale.**legendConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L635)
<a name="ColorScale.legendConfig" href="#ColorScale.legendConfig">#</a> ColorScale.**legendConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L688)

@@ -230,3 +239,3 @@ The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Axis](http://d3plus.org/docs/#Axis). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/).

<a name="ColorScale.midpoint" href="#ColorScale.midpoint">#</a> ColorScale.**midpoint**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L645)
<a name="ColorScale.midpoint" href="#ColorScale.midpoint">#</a> ColorScale.**midpoint**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L698)

@@ -239,3 +248,3 @@ The number value to be used as the anchor for `colorMid`, and defines the center point of the diverging color scale.

<a name="ColorScale.orient" href="#ColorScale.orient">#</a> ColorScale.**orient**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L655)
<a name="ColorScale.orient" href="#ColorScale.orient">#</a> ColorScale.**orient**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L708)

@@ -248,3 +257,3 @@ Sets the flow of the items inside the ColorScale. If no value is passed, the current flow will be returned.

<a name="ColorScale.outerBounds" href="#ColorScale.outerBounds">#</a> ColorScale.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L665)
<a name="ColorScale.outerBounds" href="#ColorScale.outerBounds">#</a> ColorScale.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L718)

@@ -262,3 +271,3 @@ If called after the elements have been drawn to DOM, will returns the outer bounds of the ColorScale content.

<a name="ColorScale.padding" href="#ColorScale.padding">#</a> ColorScale.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L675)
<a name="ColorScale.padding" href="#ColorScale.padding">#</a> ColorScale.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L728)

@@ -271,3 +280,3 @@ If *value* is specified, sets the padding between each key to the specified number and returns the current class instance. If *value* is not specified, returns the current padding value.

<a name="ColorScale.rectConfig" href="#ColorScale.rectConfig">#</a> ColorScale.**rectConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L685)
<a name="ColorScale.rectConfig" href="#ColorScale.rectConfig">#</a> ColorScale.**rectConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L738)

@@ -280,3 +289,3 @@ The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Rect](http://d3plus.org/docs/#Rect). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/).

<a name="ColorScale.scale" href="#ColorScale.scale">#</a> ColorScale.**scale**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L695)
<a name="ColorScale.scale" href="#ColorScale.scale">#</a> ColorScale.**scale**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L748)

@@ -289,3 +298,3 @@ If *value* is specified, sets the scale of the ColorScale and returns the current class instance. If *value* is not specified, returns the current scale value.

<a name="ColorScale.select" href="#ColorScale.select">#</a> ColorScale.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L705)
<a name="ColorScale.select" href="#ColorScale.select">#</a> ColorScale.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L758)

@@ -298,3 +307,3 @@ If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If *selector* is not specified, returns the current SVG container element.

<a name="ColorScale.size" href="#ColorScale.size">#</a> ColorScale.**size**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L715)
<a name="ColorScale.size" href="#ColorScale.size">#</a> ColorScale.**size**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L768)

@@ -307,3 +316,3 @@ The height of horizontal color scales, and width when positioned vertical.

<a name="ColorScale.value" href="#ColorScale.value">#</a> ColorScale.**value**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L729)
<a name="ColorScale.value" href="#ColorScale.value">#</a> ColorScale.**value**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L782)

@@ -323,3 +332,3 @@ If *value* is specified, sets the value accessor to the specified function or string and returns the current class instance. If *value* is not specified, returns the current value accessor.

<a name="ColorScale.width" href="#ColorScale.width">#</a> ColorScale.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L739)
<a name="ColorScale.width" href="#ColorScale.width">#</a> ColorScale.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L792)

@@ -538,2 +547,2 @@ If *value* is specified, sets the overall width of the ColorScale and returns the current class instance. If *value* is not specified, returns the current width value.

###### <sub>Documentation generated on Tue, 14 Jul 2020 21:05:17 GMT</sub>
###### <sub>Documentation generated on Wed, 02 Sep 2020 21:11:56 GMT</sub>

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc