d3plus-legend
Advanced tools
Comparing version 0.8.30 to 0.8.31
/* | ||
d3plus-legend v0.8.30 | ||
d3plus-legend v0.8.31 | ||
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="object";var n=function(t){return t&&t.Math==Math&&t};var c=n(typeof globalThis==i&&globalThis)||n(typeof window==i&&window)||n(typeof self==i&&self)||n(typeof t==i&&t)||Function("return this")();var r=function(t){try{return!!t()}catch(t){return true}};var d=!r(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7});var a={}.propertyIsEnumerable;var o=Object.getOwnPropertyDescriptor;var s=o&&!a.call({1:2},1);var h=s?function t(e){var i=o(this,e);return!!i&&i.enumerable}:a;var g={f:h};var l=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}};var u={}.toString;var f=function(t){return u.call(t).slice(8,-1)};var v="".split;var b=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return f(t)=="String"?v.call(t,""):Object(t)}:Object;var _=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var p=function(t){return b(_(t))};var y=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var m=function(t,e){if(!y(t))return t;var i,n;if(e&&typeof(i=t.toString)=="function"&&!y(n=i.call(t)))return n;if(typeof(i=t.valueOf)=="function"&&!y(n=i.call(t)))return n;if(!e&&typeof(i=t.toString)=="function"&&!y(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var w={}.hasOwnProperty;var x=function(t,e){return w.call(t,e)};var C=c.document;var k=y(C)&&y(C.createElement);var M=function(t){return k?C.createElement(t):{}};var S=!d&&!r(function(){return Object.defineProperty(M("div"),"a",{get:function(){return 7}}).a!=7});var O=Object.getOwnPropertyDescriptor;var j=d?O:function t(e,i){e=p(e);i=m(i,true);if(S)try{return O(e,i)}catch(t){}if(x(e,i))return l(!g.f.call(e,i),e[i])};var A={f:j};var B=function(t){if(!y(t)){throw TypeError(String(t)+" is not an object")}return t};var T=Object.defineProperty;var W=d?T:function t(e,i,n){B(e);i=m(i,true);B(n);if(S)try{return T(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 E={f:W};var z=d?function(t,e,i){return E.f(t,e,l(1,i))}:function(t,e,i){t[e]=i;return t};var H=function(e,i){try{z(c,e,i)}catch(t){c[e]=i}return i};var P=e(function(t){var e="__core-js_shared__";var i=c[e]||H(e,{});(t.exports=function(t,e){return i[t]||(i[t]=e!==undefined?e:{})})("versions",[]).push({version:"3.2.1",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})});var D=P("native-function-to-string",Function.toString);var L=c.WeakMap;var F=typeof L==="function"&&/native code/.test(D.call(L));var R=0;var q=Math.random();var N=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++R+q).toString(36)};var G=P("keys");var I=function(t){return G[t]||(G[t]=N(t))};var V={};var K=c.WeakMap;var Y,J,Q;var U=function(t){return Q(t)?J(t):Y(t,{})};var X=function(i){return function(t){var e;if(!y(t)||(e=J(t)).type!==i){throw TypeError("Incompatible receiver, "+i+" required")}return e}};if(F){var Z=new K;var $=Z.get;var tt=Z.has;var et=Z.set;Y=function(t,e){et.call(Z,t,e);return e};J=function(t){return $.call(Z,t)||{}};Q=function(t){return tt.call(Z,t)}}else{var it=I("state");V[it]=true;Y=function(t,e){z(t,it,e);return e};J=function(t){return x(t,it)?t[it]:{}};Q=function(t){return x(t,it)}}var nt={set:Y,get:J,has:Q,enforce:U,getterFor:X};var rt=e(function(t){var e=nt.get;var s=nt.enforce;var h=String(D).split("toString");P("inspectSource",function(t){return D.call(t)});(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"&&!x(i,"name"))z(i,"name",e);s(i).source=h.join(typeof e=="string"?e:"")}if(t===c){if(a)t[e]=i;else H(e,i);return}else if(!r){delete t[e]}else if(!o&&t[e]){a=true}if(a)t[e]=i;else z(t,e,i)})(Function.prototype,"toString",function t(){return typeof this=="function"&&e(this).source||D.call(this)})});var at=c;var ot=function(t){return typeof t=="function"?t:undefined};var st=function(t,e){return arguments.length<2?ot(at[t])||ot(c[t]):at[t]&&at[t][e]||c[t]&&c[t][e]};var ht=Math.ceil;var lt=Math.floor;var ut=function(t){return isNaN(t=+t)?0:(t>0?lt:ht)(t)};var ct=Math.min;var ft=function(t){return t>0?ct(ut(t),9007199254740991):0};var dt=Math.max;var gt=Math.min;var vt=function(t,e){var i=ut(t);return i<0?dt(i+e,0):gt(i,e)};var _t=function(s){return function(t,e,i){var n=p(t);var r=ft(n.length);var a=vt(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 pt={includes:_t(true),indexOf:_t(false)};var yt=pt.indexOf;var mt=function(t,e){var i=p(t);var n=0;var r=[];var a;for(a in i)!x(V,a)&&x(i,a)&&r.push(a);while(e.length>n)if(x(i,a=e[n++])){~yt(r,a)||r.push(a)}return r};var bt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var wt=bt.concat("length","prototype");var xt=Object.getOwnPropertyNames||function t(e){return mt(e,wt)};var Ct={f:xt};var kt=Object.getOwnPropertySymbols;var Mt={f:kt};var St=st("Reflect","ownKeys")||function t(e){var i=Ct.f(B(e));var n=Mt.f;return n?i.concat(n(e)):i};var Ot=function(t,e){var i=St(e);var n=E.f;var r=A.f;for(var a=0;a<i.length;a++){var o=i[a];if(!x(t,o))n(t,o,r(e,o))}};var jt=/#|\.prototype\./;var At=function(t,e){var i=Tt[Bt(t)];return i==Et?true:i==Wt?false:typeof e=="function"?r(e):!!e};var Bt=At.normalize=function(t){return String(t).replace(jt,".").toLowerCase()};var Tt=At.data={};var Wt=At.NATIVE="N";var Et=At.POLYFILL="P";var zt=At;var Ht=A.f;var Pt=function(t,e){var i=t.target;var n=t.global;var r=t.stat;var a,o,s,h,l,u;if(n){o=c}else if(r){o=c[i]||H(i,{})}else{o=(c[i]||{}).prototype}if(o)for(s in e){l=e[s];if(t.noTargetGet){u=Ht(o,s);h=u&&u.value}else h=o[s];a=zt(n?s:i+(r?".":"#")+s,t.forced);if(!a&&h!==undefined){if(typeof l===typeof h)continue;Ot(l,h)}if(t.sham||h&&h.sham){z(l,"sham",true)}rt(o,s,l,t)}};var Dt=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var Lt=function(n,r,t){Dt(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 Ft=function(t){return Object(_(t))};var Rt=Array.isArray||function t(e){return f(e)=="Array"};var qt=!!Object.getOwnPropertySymbols&&!r(function(){return!String(Symbol())});var Nt=c.Symbol;var Gt=P("wks");var It=function(t){return Gt[t]||(Gt[t]=qt&&Nt[t]||(qt?Nt:N)("Symbol."+t))};var Vt=It("species");var Kt=function(t,e){var i;if(Rt(t)){i=t.constructor;if(typeof i=="function"&&(i===Array||Rt(i.prototype)))i=undefined;else if(y(i)){i=i[Vt];if(i===null)i=undefined}}return new(i===undefined?Array:i)(e===0?0:e)};var Yt=[].push;var Jt=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=Ft(t);var a=b(r);var o=Lt(e,i,3);var s=ft(a.length);var h=0;var l=n||Kt;var u=g?l(t,s):v?l(t,0):undefined;var c,f;for(;s>h;h++)if(m||h in a){c=a[h];f=o(c,h,r);if(d){if(g)u[h]=f;else if(f)switch(d){case 3:return true;case 5:return c;case 6:return h;case 2:Yt.call(u,c)}else if(p)return false}}return y?-1:_||p?p:u}};var Qt={forEach:Jt(0),map:Jt(1),filter:Jt(2),some:Jt(3),every:Jt(4),find:Jt(5),findIndex:Jt(6)};var Ut=Object.keys||function t(e){return mt(e,bt)};var Xt=d?Object.defineProperties:function t(e,i){B(e);var n=Ut(i);var r=n.length;var a=0;var o;while(r>a)E.f(e,o=n[a++],i[o]);return e};var Zt=st("document","documentElement");var $t=I("IE_PROTO");var te="prototype";var ee=function(){};var ie=function(){var t=M("iframe");var e=bt.length;var i="<";var n="script";var r=">";var a="java"+n+":";var o;t.style.display="none";Zt.appendChild(t);t.src=String(a);o=t.contentWindow.document;o.open();o.write(i+n+r+"document.F=Object"+i+"/"+n+r);o.close();ie=o.F;while(e--)delete ie[te][bt[e]];return ie()};var ne=Object.create||function t(e,i){var n;if(e!==null){ee[te]=B(e);n=new ee;ee[te]=null;n[$t]=e}else n=ie();return i===undefined?n:Xt(n,i)};V[$t]=true;var re=It("unscopables");var ae=Array.prototype;if(ae[re]==undefined){z(ae,re,ne(null))}var oe=function(t){ae[re][t]=true};var se=Qt.find;var he="find";var le=true;if(he in[])Array(1)[he](function(){le=false});Pt({target:"Array",proto:true,forced:le},{find:function t(e){return se(this,e,arguments.length>1?arguments[1]:undefined)}});oe(he);var ue=pt.includes;Pt({target:"Array",proto:true},{includes:function t(e){return ue(this,e,arguments.length>1?arguments[1]:undefined)}});oe("includes");var ce=Object.assign;var fe=!ce||r(function(){var t={};var e={};var i=Symbol();var n="abcdefghijklmnopqrst";t[i]=7;n.split("").forEach(function(t){e[t]=t});return ce({},t)[i]!=7||Ut(ce({},e)).join("")!=n})?function t(e,i){var n=Ft(e);var r=arguments.length;var a=1;var o=Mt.f;var s=g.f;while(r>a){var h=b(arguments[a++]);var l=o?Ut(h).concat(o(h)):Ut(h);var u=l.length;var c=0;var f;while(u>c){f=l[c++];if(!d||s.call(h,f))n[f]=h[f]}}return n}:ce;Pt({target:"Object",stat:true,forced:Object.assign!==fe},{assign:fe});var de=It("match");var ge=function(t){var e;return y(t)&&((e=t[de])!==undefined?!!e:f(t)=="RegExp")};var ve=function(t){if(ge(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var _e=It("match");var pe=function(e){var i=/./;try{"/./"[e](i)}catch(t){try{i[_e]=false;return"/./"[e](i)}catch(t){}}return false};Pt({target:"String",proto:true,forced:!pe("includes")},{includes:function t(e){return!!~String(_(this)).indexOf(ve(e),arguments.length>1?arguments[1]:undefined)}});var ye="".startsWith;var me=Math.min;Pt({target:"String",proto:true,forced:!pe("startsWith")},{startsWith:function t(e){var i=String(_(this));ve(e);var n=ft(me(arguments.length>1?arguments[1]:undefined,i.length));var r=String(e);return ye?ye.call(i,r,n):i.slice(n,n+r.length)===r}});if(typeof window!=="undefined"){(function(){var n=function(t,e){var i=t.nodeType;if(i===3){e.push(t.textContent.replace(/&/,"&").replace(/</,"<").replace(">",">"))}else if(i===1){e.push("<",t.tagName);if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){e.push(" ",t.item.name,"='",t.item.value,"'")})}if(t.hasChildNodes()){e.push(">");[].forEach.call(t.childNodes,function(t){n(t,e)});e.push("</",t.tagName,">")}else{e.push("/>")}}else if(i==8){e.push("\x3c!--",t.nodeValue,"--\x3e")}};Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t=[];var e=this.firstChild;while(e){n(e,t);e=e.nextSibling}return t.join("")},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;var r=n.firstChild;while(r){this.appendChild(this.ownerDocument.importNode(r,true));r=r.nextSibling}}catch(t){}}});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,gt,vt,_t,w,pt,yt,mt,i,bt,wt){"use strict";function u(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 h=i;if(t>i)h=Math.max(h,r[i][t-1]||0);h=Math.max(h,r[i-1][s]||0);var l=s-1;if(e<n.length-1)l=Math.min(l,r[i][e+1]||0);for(var u=l;u>=h;--u){var c=v(u,s,a,o);if(c+n[i-1][h-1]>=n[i][s])break;var f=v(h,s,a,o);var d=f+n[i-1][h-1];if(d<n[i][s]){n[i][s]=d;r[i][s]=h}h++;var g=c+n[i-1][u-1];if(g<n[i][s]){n[i][s]=g;r[i][s]=u}}_(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,h=void 0;s<n;++s){h=t[s]-r;if(s===0){a.push(h);o.push(h*h)}else{a.push(a[s-1]+h);o.push(o[s-1]+h*h)}e[0][s]=v(0,s,a,o);i[0][s]=0}for(var l=1;l<e.length;++l){var u=n-1;if(l<e.length-1)u=l;_(u,n-1,l,e,i,a,o)}}function xt(t,e){if(e>t.length){throw new Error("Cannot generate more classes than there are data values")}var i=u(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 h=r.length-1;h>=0;h--){var l=r[h][o];s[h]=i.slice(l,o+1);if(h>0)o=l-1}return s}function n(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function r(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 a(t,e,i){if(e)r(t.prototype,e);if(i)r(t,i);return t}function Ct(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 o(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)s(t,e)}function h(t){h=Object.setPrototypeOf?Object.getPrototypeOf:function t(e){return e.__proto__||Object.getPrototypeOf(e)};return h(t)}function s(t,e){s=Object.setPrototypeOf||function t(e,i){e.__proto__=i;return e};return s(t,e)}function l(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 l(t)}var p=function(t){o(e,t);function e(){var s;n(this,e);s=g(this,h(e).call(this));s._align="center";s._data=[];s._direction="row";s._duration=600;s._height=200;s._id=_t.accessor("id");s._label=_t.accessor("id");s._lineData=[];s._outerBounds={width:0,height:0,x:0,y:0};s._padding=5;s._shape=_t.constant("Rect");s._shapes=[];s._shapeConfig={duration:s._duration,fill:_t.accessor("color"),height:_t.constant(10),hitArea:function t(e,i){var n=s._lineData[i],r=gt.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=gt.max([n.shapeHeight,n.height]);return{width:n.width,height:a,x:r,y:-a/2}},labelConfig:{fontColor:_t.constant("#444"),fontFamily:(new pt.TextBox).fontFamily(),fontResize:false,fontSize:_t.constant(10),verticalAlign:"middle"},opacity:1,r:_t.constant(5),width:_t.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+gt.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 pt.TextBox;s._titleConfig={};s._verticalAlign="middle";s._width=400;return s}a(e,[{key:"_fetchConfig",value:function t(e,i,n){var r=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 gt.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 gt.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(vt.select("body").append("svg").attr("width","".concat(this._width,"px")).attr("height","".concat(this._height,"px")).node());this._group=_t.elem("g.d3plus-Legend",{parent:this._select});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=pt.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=gt.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),h=c._fetchConfig("fontSize",t,e);var l=f-(c._data.length+1)*c._padding,u=c._width;a=Object.assign(a,pt.textWrap().fontFamily(o).fontSize(h).lineHeight(s).width(u).height(l)(i));a.width=Math.ceil(gt.max(a.lines.map(function(t){return pt.textWidth(t,{"font-family":o,"font-size":h})})))+h*.75;a.height=Math.ceil(a.lines.length*(s+1));a.og={height:a.height,width:a.width};a.f=o;a.s=h;a.lh=s;return a});var o;var h=this._width-this._padding*2;o=this._rowWidth(this._lineData);if(this._direction==="column"||o>h){var l=1,u=[];var d=gt.max(this._lineData.map(function(t){return t.words.length}));this._wrapLines=function(){var e=this;l++;if(l>d)return;var o=l===1?this._lineData.slice():this._lineData.filter(function(t){return t.width+t.shapeWidth+e._padding*(t.width?2:1)>h&&t.words.length>=l}).sort(function(t,e){return e.sentence.length-t.sentence.length});if(o.length&&f>o[0].height*l){var s=false;var t=function t(e){var i=o[e];var n=i.og.height*l,r=i.og.width*(1.5*(1/l));var a=pt.textWrap().fontFamily(i.f).fontSize(i.s).lineHeight(i.lh).width(r).height(n)(i.sentence);if(!a.truncated){i.width=Math.ceil(gt.max(a.lines.map(function(t){return pt.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{u=[];return}};this._wrapRows=function(){u=[];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(gt.sum(u.map(function(t){return gt.max(t,function(t){return gt.max([t.height,t.shapeHeight])})}))>f){u=[];break}if(r>h){u=[];this._wrapLines();break}else if(e+r<h){e+=r}else if(this._direction!=="column"){e=r;t++}if(!u[t-1])u[t-1]=[];u[t-1].push(n);if(this._direction==="column"){e=0;t++}}};this._wrapRows();if(!u.length||gt.sum(u,this._rowHeight.bind(this))+this._padding>f){o=gt.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(u.length&>.sum(u,this._rowHeight.bind(this))+this._padding<f){u.forEach(function(t,e){t.forEach(function(t){if(e){t.y=gt.sum(u.slice(0,e),c._rowHeight.bind(c))}})});o=gt.max(u,this._rowWidth.bind(this))}}var g=gt.max(this._lineData,function(t,e){return gt.max([t.height,c._fetchConfig("height",t.data,e)])+t.y})+this._titleHeight,v=gt.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._group.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=_t.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]).data(b.filter(function(t){return t.shape===e})).duration(c._duration).labelConfig({padding:0}).select(c._group.node()).verticalAlign("top").config(_t.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:_t.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=vt.select(e),this):this._select}},{key:"shape",value:function t(e){return arguments.length?(this._shape=typeof e==="function"?e:_t.constant(e),this):this._shape}},{key:"shapeConfig",value:function t(e){return arguments.length?(this._shapeConfig=_t.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=_t.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 e}(_t.BaseClass);var e=function(t){o(e,t);function e(){var t;n(this,e);t=g(this,h(e).call(this));t._axisClass=new i.Axis;t._axisConfig={gridSize:0,shapeConfig:{labelConfig:{fontColor:"#222"}},titleConfig:{fontSize:12}};t._axisTest=new i.Axis;t._align="middle";t._buckets=5;t._bucketAxis=false;t._colorMax="#0C8040";t._colorMid="#f7f7f7";t._colorMin="#b22200";t._data=[];t._duration=600;t._height=200;t._labelClass=new pt.TextBox;t._legendClass=new p;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;t._rectConfig={stroke:"#444",strokeWidth:1};t._scale="linear";t._size=10;t._value=_t.accessor("value");t._width=400;return t}a(e,[{key:"render",value:function t(e){var i=this;if(this._select===void 0)this.select(vt.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=_t.elem("g.d3plus-ColorScale",{parent:this._select});var h=gt.extent(this._data,this._value);var l=h[0]<this._midpoint;var u=h[1]>this._midpoint;var c=l&&u;var f=this._color,d,g;if(f&&!(f instanceof Array)){f=gt.range(0,this._buckets,1).map(function(t){return bt.colorLighter(f,(t+1)/i._buckets)}).reverse()}if(this._scale==="jenks"){var v=this._data.map(this._value).filter(function(t){return t!==null&&typeof t==="number"});var _=gt.min([f?f.length:this._buckets,v.length]);var p=xt(v,_);g=gt.merge(p.map(function(t,e){return e===p.length-1?[t[0],t[t.length-1]]:[t[0]]}));var y=new Set(g);if(g.length!==y.size){d=Array.from(y)}if(!f){if(c){f=[this._colorMin,this._colorMid,this._colorMax];var m=g.slice(0,_).filter(function(t,e){return t<i._midpoint&&g[e+1]<=i._midpoint});var b=g.slice(0,_).filter(function(t,e){return t<=i._midpoint&&g[e+1]>i._midpoint});var w=g.slice(0,_).filter(function(t,e){return t>i._midpoint&&g[e+1]>i._midpoint});var x=m.map(function(t,e){return!e?f[0]:bt.colorLighter(f[0],e/m.length)});var C=b.map(function(){return f[1]});var k=w.map(function(t,e){return e===w.length-1?f[2]:bt.colorLighter(f[2],1-(e+1)/w.length)});f=x.concat(C).concat(k)}else{f=gt.range(0,this._buckets,1).map(function(t){return bt.colorLighter(i._colorMax,t/i._buckets)}).reverse()}}if(v.length<=_){f=f.slice(_-v.length)}this._colorScale=yt.scaleThreshold().domain(g).range(["black"].concat(f).concat(f[f.length-1]))}else{var M;if(c&&!f){var S=Math.floor(this._buckets/2);var O=gt.range(0,S,1).map(function(t){return!t?i._colorMin:bt.colorLighter(i._colorMin,t/S)});var j=(this._buckets%2?[0]:[]).map(function(){return i._colorMid});var A=gt.range(0,S,1).map(function(t){return!t?i._colorMax:bt.colorLighter(i._colorMax,t/S)}).reverse();f=O.concat(j).concat(A);var B=(f.length-1)/2;M=[h[0],this._midpoint,h[1]];M=gt.range(h[0],this._midpoint,-(h[0]-this._midpoint)/B).concat(gt.range(this._midpoint,h[1],(h[1]-this._midpoint)/B)).concat([h[1]])}else{if(!f){if(this._scale==="buckets"){f=gt.range(0,this._buckets,1).map(function(t){return bt.colorLighter(l?i._colorMin:i._colorMax,t/i._buckets)});if(u)f=f.reverse()}else{f=l?[this._colorMin,bt.colorLighter(this._colorMin,.8)]:[bt.colorLighter(this._colorMax,.8),this._colorMax]}}var T=(h[1]-h[0])/(f.length-1);M=gt.range(h[0],h[1]+T/2,T)}if(this._scale==="buckets"){g=M.concat([M[M.length-1]])}if(this._scale==="log"){var W=M.filter(function(t){return t<0});if(W.length){var E=W[0];var z=W.map(function(t){return-Math.pow(Math.abs(E),t/E)});W.forEach(function(t,e){M[M.indexOf(t)]=z[e]})}var H=M.filter(function(t){return t>0});if(H.length){var P=H[H.length-1];var D=H.map(function(t){return Math.pow(P,t/P)});H.forEach(function(t,e){M[M.indexOf(t)]=D[e]})}if(M.includes(0))M[M.indexOf(0)]=1}this._colorScale=yt.scaleLinear().domain(M).range(f)}var L=this._bucketAxis||!["buckets","jenks"].includes(this._scale);var F=mt.transition().duration(this._duration);var R={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:F,update:{opacity:1}};var q=_t.elem("g.d3plus-ColorScale-labels",Object.assign({condition:L},R));var N=_t.elem("g.d3plus-ColorScale-Rect",Object.assign({condition:L},R));var G=_t.elem("g.d3plus-ColorScale-legend",Object.assign({condition:!L},R));if(L){var I;var V={x:0,y:0};var K=_t.assign({domain:n?h:h.reverse(),duration:this._duration,height:this._height,labels:d||g,orient:this._orient,padding:this._padding,scale:this._scale==="log"?"log":"linear",ticks:g,width:this._width},this._axisConfig);var Y=_t.assign({height:this["_".concat(r)]/2,width:this["_".concat(a)]/2},this._labelConfig||this._axisConfig.titleConfig);this._labelClass.config(Y);var J=[];if(n&&this._labelMin){var Q={"font-family":this._labelClass.fontFamily()(this._labelMin),"font-size":this._labelClass.fontSize()(this._labelMin),"font-weight":this._labelClass.fontWeight()(this._labelMin)};if(Q["font-family"]instanceof Array)Q["font-family"]=Q["font-family"][0];var U=pt.textWidth(this._labelMin,Q);if(U&&U<this["_".concat(a)]/2){J.push(this._labelMin);U+=this._padding;if(n)V.x+=U;K[a]-=U}}if(n&&this._labelMax){var X={"font-family":this._labelClass.fontFamily()(this._labelMax),"font-size":this._labelClass.fontSize()(this._labelMax),"font-weight":this._labelClass.fontWeight()(this._labelMax)};if(X["font-family"]instanceof Array)X["font-family"]=X["font-family"][0];var Z=pt.textWidth(this._labelMax,X);if(Z&&Z<this["_".concat(a)]/2){J.push(this._labelMax);Z+=this._padding;if(!n)V.y+=Z;K[a]-=Z}}this._axisTest.select(_t.elem("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:this._group}).node()).config(K).duration(0).render();var $=this._axisTest.outerBounds();this._outerBounds[a]=this["_".concat(a)]-this._padding*2;this._outerBounds[r]=$[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 tt=this._outerBounds[s]+(["bottom","right"].includes(this._orient)?this._size:0)-(K.padding||this._axisClass.padding());var et="translate(".concat(V.x+(n?0:tt),", ").concat(V.y+(n?tt:0),")");this._axisClass.select(_t.elem("g.d3plus-ColorScale-axis",_t.assign(R,{condition:true,enter:{transform:et},update:{transform:et}})).node()).config(K).align("start").render();var it=this._axisTest._getPosition.bind(this._axisTest);var nt=this._axisTest._getRange();var rt=this._group.selectAll("defs").data([0]);var at=rt.enter().append("defs");at.append("linearGradient").attr("id","gradient-".concat(this._uuid));rt=at.merge(rt);rt.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 ot=rt.select("linearGradient").selectAll("stop").data(n?f:f);var st=this._colorScale.domain();var ht=yt.scaleLinear().domain(nt).range(n?[0,100]:[100,0]);ot.enter().append("stop").merge(ot).attr("offset",function(t,e){return"".concat(ht(it(st[e])),"%")}).attr("stop-color",String);var lt=function t(e,i){var n=Math.abs(it(g[i+1])-it(e));return n||2};var ut=_t.assign((I={duration:this._duration,fill:g?function(t){return i._colorScale(t)}:"url(#gradient-".concat(this._uuid,")")},Ct(I,o,g?function(t,e){return it(t)+lt(t,e)/2-(["left","right"].includes(i._orient)?lt(t,e):0)}:nt[0]+(nt[1]-nt[0])/2+V[o]),Ct(I,s,this._outerBounds[s]+(["top","left"].includes(this._orient)?$[r]:0)+this._size/2+V[s]),Ct(I,a,g?lt:nt[1]-nt[0]),Ct(I,r,this._size),I),this._rectConfig);this._rectClass.data(g?g.slice(0,g.length-1):[0]).id(function(t,e){return e}).select(N.node()).config(ut).render();Y.height=this._outerBounds[r];Y.width=this._outerBounds[a];this._labelClass.config(Y).data(J).select(q.node()).x(function(t){return t===i._labelMax?ut.x+ut.width/2+i._padding:i._outerBounds.x}).y(function(t){return ut.y-i._labelClass.fontSize()(t)/2}).text(function(t){return t}).rotate(n?0:this._orient==="right"?90:-90).render()}else{_t.elem("g.d3plus-ColorScale-axis",Object.assign({condition:L},R));var ct=this._axisConfig.tickFormat?this._axisConfig.tickFormat:wt.formatAbbreviate;var ft=g.reduce(function(t,e,i){if(i!==g.length-1){var n=g[i+1];t.push({color:f[i],id:e===n?"".concat(ct(e),"+"):"".concat(ct(e)," - ").concat(ct(n))})}return t},[]);var dt=_t.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:_t.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(ft).select(G.node()).config(dt).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=_t.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:"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=_t.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=_t.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=vt.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:_t.constant(e),this):this._value}},{key:"width",value:function t(e){return arguments.length?(this._width=e,this):this._width}}]);return e}(_t.BaseClass);t.ColorScale=e;t.Legend=p;t.ckmeans=xt;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="object";var n=function(t){return t&&t.Math==Math&&t};var c=n(typeof globalThis==i&&globalThis)||n(typeof window==i&&window)||n(typeof self==i&&self)||n(typeof t==i&&t)||Function("return this")();var r=function(t){try{return!!t()}catch(t){return true}};var d=!r(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7});var a={}.propertyIsEnumerable;var o=Object.getOwnPropertyDescriptor;var s=o&&!a.call({1:2},1);var l=s?function t(e){var i=o(this,e);return!!i&&i.enumerable}:a;var g={f:l};var h=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}};var u={}.toString;var f=function(t){return u.call(t).slice(8,-1)};var v="".split;var b=r(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return f(t)=="String"?v.call(t,""):Object(t)}:Object;var _=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var p=function(t){return b(_(t))};var y=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var m=function(t,e){if(!y(t))return t;var i,n;if(e&&typeof(i=t.toString)=="function"&&!y(n=i.call(t)))return n;if(typeof(i=t.valueOf)=="function"&&!y(n=i.call(t)))return n;if(!e&&typeof(i=t.toString)=="function"&&!y(n=i.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var w={}.hasOwnProperty;var x=function(t,e){return w.call(t,e)};var C=c.document;var k=y(C)&&y(C.createElement);var M=function(t){return k?C.createElement(t):{}};var S=!d&&!r(function(){return Object.defineProperty(M("div"),"a",{get:function(){return 7}}).a!=7});var O=Object.getOwnPropertyDescriptor;var j=d?O:function t(e,i){e=p(e);i=m(i,true);if(S)try{return O(e,i)}catch(t){}if(x(e,i))return h(!g.f.call(e,i),e[i])};var A={f:j};var B=function(t){if(!y(t)){throw TypeError(String(t)+" is not an object")}return t};var T=Object.defineProperty;var W=d?T:function t(e,i,n){B(e);i=m(i,true);B(n);if(S)try{return T(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 E={f:W};var z=d?function(t,e,i){return E.f(t,e,h(1,i))}:function(t,e,i){t[e]=i;return t};var H=function(e,i){try{z(c,e,i)}catch(t){c[e]=i}return i};var P=e(function(t){var e="__core-js_shared__";var i=c[e]||H(e,{});(t.exports=function(t,e){return i[t]||(i[t]=e!==undefined?e:{})})("versions",[]).push({version:"3.2.1",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})});var D=P("native-function-to-string",Function.toString);var L=c.WeakMap;var F=typeof L==="function"&&/native code/.test(D.call(L));var q=0;var R=Math.random();var N=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++q+R).toString(36)};var G=P("keys");var I=function(t){return G[t]||(G[t]=N(t))};var V={};var K=c.WeakMap;var Y,J,Q;var U=function(t){return Q(t)?J(t):Y(t,{})};var X=function(i){return function(t){var e;if(!y(t)||(e=J(t)).type!==i){throw TypeError("Incompatible receiver, "+i+" required")}return e}};if(F){var Z=new K;var $=Z.get;var tt=Z.has;var et=Z.set;Y=function(t,e){et.call(Z,t,e);return e};J=function(t){return $.call(Z,t)||{}};Q=function(t){return tt.call(Z,t)}}else{var it=I("state");V[it]=true;Y=function(t,e){z(t,it,e);return e};J=function(t){return x(t,it)?t[it]:{}};Q=function(t){return x(t,it)}}var nt={set:Y,get:J,has:Q,enforce:U,getterFor:X};var rt=e(function(t){var e=nt.get;var s=nt.enforce;var l=String(D).split("toString");P("inspectSource",function(t){return D.call(t)});(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"&&!x(i,"name"))z(i,"name",e);s(i).source=l.join(typeof e=="string"?e:"")}if(t===c){if(a)t[e]=i;else H(e,i);return}else if(!r){delete t[e]}else if(!o&&t[e]){a=true}if(a)t[e]=i;else z(t,e,i)})(Function.prototype,"toString",function t(){return typeof this=="function"&&e(this).source||D.call(this)})});var at=c;var ot=function(t){return typeof t=="function"?t:undefined};var st=function(t,e){return arguments.length<2?ot(at[t])||ot(c[t]):at[t]&&at[t][e]||c[t]&&c[t][e]};var lt=Math.ceil;var ht=Math.floor;var ut=function(t){return isNaN(t=+t)?0:(t>0?ht:lt)(t)};var ct=Math.min;var ft=function(t){return t>0?ct(ut(t),9007199254740991):0};var dt=Math.max;var gt=Math.min;var vt=function(t,e){var i=ut(t);return i<0?dt(i+e,0):gt(i,e)};var _t=function(s){return function(t,e,i){var n=p(t);var r=ft(n.length);var a=vt(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 pt={includes:_t(true),indexOf:_t(false)};var yt=pt.indexOf;var mt=function(t,e){var i=p(t);var n=0;var r=[];var a;for(a in i)!x(V,a)&&x(i,a)&&r.push(a);while(e.length>n)if(x(i,a=e[n++])){~yt(r,a)||r.push(a)}return r};var bt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var wt=bt.concat("length","prototype");var xt=Object.getOwnPropertyNames||function t(e){return mt(e,wt)};var Ct={f:xt};var kt=Object.getOwnPropertySymbols;var Mt={f:kt};var St=st("Reflect","ownKeys")||function t(e){var i=Ct.f(B(e));var n=Mt.f;return n?i.concat(n(e)):i};var Ot=function(t,e){var i=St(e);var n=E.f;var r=A.f;for(var a=0;a<i.length;a++){var o=i[a];if(!x(t,o))n(t,o,r(e,o))}};var jt=/#|\.prototype\./;var At=function(t,e){var i=Tt[Bt(t)];return i==Et?true:i==Wt?false:typeof e=="function"?r(e):!!e};var Bt=At.normalize=function(t){return String(t).replace(jt,".").toLowerCase()};var Tt=At.data={};var Wt=At.NATIVE="N";var Et=At.POLYFILL="P";var zt=At;var Ht=A.f;var Pt=function(t,e){var i=t.target;var n=t.global;var r=t.stat;var a,o,s,l,h,u;if(n){o=c}else if(r){o=c[i]||H(i,{})}else{o=(c[i]||{}).prototype}if(o)for(s in e){h=e[s];if(t.noTargetGet){u=Ht(o,s);l=u&&u.value}else l=o[s];a=zt(n?s:i+(r?".":"#")+s,t.forced);if(!a&&l!==undefined){if(typeof h===typeof l)continue;Ot(h,l)}if(t.sham||l&&l.sham){z(h,"sham",true)}rt(o,s,h,t)}};var Dt=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var Lt=function(n,r,t){Dt(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 Ft=function(t){return Object(_(t))};var qt=Array.isArray||function t(e){return f(e)=="Array"};var Rt=!!Object.getOwnPropertySymbols&&!r(function(){return!String(Symbol())});var Nt=c.Symbol;var Gt=P("wks");var It=function(t){return Gt[t]||(Gt[t]=Rt&&Nt[t]||(Rt?Nt:N)("Symbol."+t))};var Vt=It("species");var Kt=function(t,e){var i;if(qt(t)){i=t.constructor;if(typeof i=="function"&&(i===Array||qt(i.prototype)))i=undefined;else if(y(i)){i=i[Vt];if(i===null)i=undefined}}return new(i===undefined?Array:i)(e===0?0:e)};var Yt=[].push;var Jt=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=Ft(t);var a=b(r);var o=Lt(e,i,3);var s=ft(a.length);var l=0;var h=n||Kt;var u=g?h(t,s):v?h(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)u[l]=f;else if(f)switch(d){case 3:return true;case 5:return c;case 6:return l;case 2:Yt.call(u,c)}else if(p)return false}}return y?-1:_||p?p:u}};var Qt={forEach:Jt(0),map:Jt(1),filter:Jt(2),some:Jt(3),every:Jt(4),find:Jt(5),findIndex:Jt(6)};var Ut=Object.keys||function t(e){return mt(e,bt)};var Xt=d?Object.defineProperties:function t(e,i){B(e);var n=Ut(i);var r=n.length;var a=0;var o;while(r>a)E.f(e,o=n[a++],i[o]);return e};var Zt=st("document","documentElement");var $t=I("IE_PROTO");var te="prototype";var ee=function(){};var ie=function(){var t=M("iframe");var e=bt.length;var i="<";var n="script";var r=">";var a="java"+n+":";var o;t.style.display="none";Zt.appendChild(t);t.src=String(a);o=t.contentWindow.document;o.open();o.write(i+n+r+"document.F=Object"+i+"/"+n+r);o.close();ie=o.F;while(e--)delete ie[te][bt[e]];return ie()};var ne=Object.create||function t(e,i){var n;if(e!==null){ee[te]=B(e);n=new ee;ee[te]=null;n[$t]=e}else n=ie();return i===undefined?n:Xt(n,i)};V[$t]=true;var re=It("unscopables");var ae=Array.prototype;if(ae[re]==undefined){z(ae,re,ne(null))}var oe=function(t){ae[re][t]=true};var se=Qt.find;var le="find";var he=true;if(le in[])Array(1)[le](function(){he=false});Pt({target:"Array",proto:true,forced:he},{find:function t(e){return se(this,e,arguments.length>1?arguments[1]:undefined)}});oe(le);var ue=pt.includes;Pt({target:"Array",proto:true},{includes:function t(e){return ue(this,e,arguments.length>1?arguments[1]:undefined)}});oe("includes");var ce=Object.assign;var fe=!ce||r(function(){var t={};var e={};var i=Symbol();var n="abcdefghijklmnopqrst";t[i]=7;n.split("").forEach(function(t){e[t]=t});return ce({},t)[i]!=7||Ut(ce({},e)).join("")!=n})?function t(e,i){var n=Ft(e);var r=arguments.length;var a=1;var o=Mt.f;var s=g.f;while(r>a){var l=b(arguments[a++]);var h=o?Ut(l).concat(o(l)):Ut(l);var u=h.length;var c=0;var f;while(u>c){f=h[c++];if(!d||s.call(l,f))n[f]=l[f]}}return n}:ce;Pt({target:"Object",stat:true,forced:Object.assign!==fe},{assign:fe});var de=It("match");var ge=function(t){var e;return y(t)&&((e=t[de])!==undefined?!!e:f(t)=="RegExp")};var ve=function(t){if(ge(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var _e=It("match");var pe=function(e){var i=/./;try{"/./"[e](i)}catch(t){try{i[_e]=false;return"/./"[e](i)}catch(t){}}return false};Pt({target:"String",proto:true,forced:!pe("includes")},{includes:function t(e){return!!~String(_(this)).indexOf(ve(e),arguments.length>1?arguments[1]:undefined)}});var ye="".startsWith;var me=Math.min;Pt({target:"String",proto:true,forced:!pe("startsWith")},{startsWith:function t(e){var i=String(_(this));ve(e);var n=ft(me(arguments.length>1?arguments[1]:undefined,i.length));var r=String(e);return ye?ye.call(i,r,n):i.slice(n,n+r.length)===r}});if(typeof window!=="undefined"){(function(){var n=function(t,e){var i=t.nodeType;if(i===3){e.push(t.textContent.replace(/&/,"&").replace(/</,"<").replace(">",">"))}else if(i===1){e.push("<",t.tagName);if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){e.push(" ",t.item.name,"='",t.item.value,"'")})}if(t.hasChildNodes()){e.push(">");[].forEach.call(t.childNodes,function(t){n(t,e)});e.push("</",t.tagName,">")}else{e.push("/>")}}else if(i==8){e.push("\x3c!--",t.nodeValue,"--\x3e")}};Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t=[];var e=this.firstChild;while(e){n(e,t);e=e.nextSibling}return t.join("")},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;var r=n.firstChild;while(r){this.appendChild(this.ownerDocument.importNode(r,true));r=r.nextSibling}}catch(t){}}});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,_t,pt,yt,w,mt,bt,wt,i,xt,Ct){"use strict";function u(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 h=s-1;if(e<n.length-1)h=Math.min(h,r[i][e+1]||0);for(var u=h;u>=l;--u){var c=v(u,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][u-1];if(g<n[i][s]){n[i][s]=g;r[i][s]=u}}_(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 h=1;h<e.length;++h){var u=n-1;if(h<e.length-1)u=h;_(u,n-1,h,e,i,a,o)}}function kt(t,e){if(e>t.length){throw new Error("Cannot generate more classes than there are data values")}var i=u(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 h=r[l][o];s[l]=i.slice(h,o+1);if(l>0)o=h-1}return s}function n(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function r(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 a(t,e,i){if(e)r(t.prototype,e);if(i)r(t,i);return t}function Mt(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 o(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)s(t,e)}function l(t){l=Object.setPrototypeOf?Object.getPrototypeOf:function t(e){return e.__proto__||Object.getPrototypeOf(e)};return l(t)}function s(t,e){s=Object.setPrototypeOf||function t(e,i){e.__proto__=i;return e};return s(t,e)}function h(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 h(t)}var p=function(t){o(e,t);function e(){var s;n(this,e);s=g(this,l(e).call(this));s._align="center";s._data=[];s._direction="row";s._duration=600;s._height=200;s._id=yt.accessor("id");s._label=yt.accessor("id");s._lineData=[];s._outerBounds={width:0,height:0,x:0,y:0};s._padding=5;s._shape=yt.constant("Rect");s._shapes=[];s._shapeConfig={duration:s._duration,fill:yt.accessor("color"),height:yt.constant(10),hitArea:function t(e,i){var n=s._lineData[i],r=_t.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=_t.max([n.shapeHeight,n.height]);return{width:n.width,height:a,x:r,y:-a/2}},labelConfig:{fontColor:yt.constant("#444"),fontFamily:(new mt.TextBox).fontFamily(),fontResize:false,fontSize:yt.constant(10),verticalAlign:"middle"},opacity:1,r:yt.constant(5),width:yt.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+_t.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 mt.TextBox;s._titleConfig={};s._verticalAlign="middle";s._width=400;return s}a(e,[{key:"_fetchConfig",value:function t(e,i,n){var r=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 _t.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 _t.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(pt.select("body").append("svg").attr("width","".concat(this._width,"px")).attr("height","".concat(this._height,"px")).node());this._group=yt.elem("g.d3plus-Legend",{parent:this._select});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=mt.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=_t.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 h=f-(c._data.length+1)*c._padding,u=c._width;a=Object.assign(a,mt.textWrap().fontFamily(o).fontSize(l).lineHeight(s).width(u).height(h)(i));a.width=Math.ceil(_t.max(a.lines.map(function(t){return mt.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 h=1,u=[];var d=_t.max(this._lineData.map(function(t){return t.words.length}));this._wrapLines=function(){var e=this;h++;if(h>d)return;var o=h===1?this._lineData.slice():this._lineData.filter(function(t){return t.width+t.shapeWidth+e._padding*(t.width?2:1)>l&&t.words.length>=h}).sort(function(t,e){return e.sentence.length-t.sentence.length});if(o.length&&f>o[0].height*h){var s=false;var t=function t(e){var i=o[e];var n=i.og.height*h,r=i.og.width*(1.5*(1/h));var a=mt.textWrap().fontFamily(i.f).fontSize(i.s).lineHeight(i.lh).width(r).height(n)(i.sentence);if(!a.truncated){i.width=Math.ceil(_t.max(a.lines.map(function(t){return mt.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{u=[];return}};this._wrapRows=function(){u=[];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(_t.sum(u.map(function(t){return _t.max(t,function(t){return _t.max([t.height,t.shapeHeight])})}))>f){u=[];break}if(r>l){u=[];this._wrapLines();break}else if(e+r<l){e+=r}else if(this._direction!=="column"){e=r;t++}if(!u[t-1])u[t-1]=[];u[t-1].push(n);if(this._direction==="column"){e=0;t++}}};this._wrapRows();if(!u.length||_t.sum(u,this._rowHeight.bind(this))+this._padding>f){o=_t.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(u.length&&_t.sum(u,this._rowHeight.bind(this))+this._padding<f){u.forEach(function(t,e){t.forEach(function(t){if(e){t.y=_t.sum(u.slice(0,e),c._rowHeight.bind(c))}})});o=_t.max(u,this._rowWidth.bind(this))}}var g=_t.max(this._lineData,function(t,e){return _t.max([t.height,c._fetchConfig("height",t.data,e)])+t.y})+this._titleHeight,v=_t.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._group.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=yt.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]).data(b.filter(function(t){return t.shape===e})).duration(c._duration).labelConfig({padding:0}).select(c._group.node()).verticalAlign("top").config(yt.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:yt.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=pt.select(e),this):this._select}},{key:"shape",value:function t(e){return arguments.length?(this._shape=typeof e==="function"?e:yt.constant(e),this):this._shape}},{key:"shapeConfig",value:function t(e){return arguments.length?(this._shapeConfig=yt.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=yt.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 e}(yt.BaseClass);var e=function(t){o(e,t);function e(){var t;n(this,e);t=g(this,l(e).call(this));t._axisClass=new i.Axis;t._axisConfig={gridSize:0,shapeConfig:{labelConfig:{fontColor:"#222"}},titleConfig:{fontSize:12}};t._axisTest=new i.Axis;t._align="middle";t._buckets=5;t._bucketAxis=false;t._colorMax="#0C8040";t._colorMid="#f7f7f7";t._colorMin="#b22200";t._data=[];t._duration=600;t._height=200;t._labelClass=new mt.TextBox;t._legendClass=new p;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;t._rectConfig={stroke:"#444",strokeWidth:1};t._scale="linear";t._size=10;t._value=yt.accessor("value");t._width=400;return t}a(e,[{key:"render",value:function t(e){var i=this;if(this._select===void 0)this.select(pt.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=yt.elem("g.d3plus-ColorScale",{parent:this._select});var l=this._data.map(this._value).sort(function(t,e){return t-e});var h=_t.extent(l);var u=h[0]<this._midpoint;var c=h[1]>this._midpoint;var f=u&&c;var d=this._color,g,v;if(d&&!(d instanceof Array)){d=_t.range(0,this._buckets,1).map(function(t){return xt.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=_t.min([d?d.length:this._buckets,_.length]);var y=kt(_,p);v=_t.merge(y.map(function(t,e){return e===y.length-1?[t[0],t[t.length-1]]:[t[0]]}));var m=new Set(v);if(v.length!==m.size){g=Array.from(m)}if(!d){if(f){d=[this._colorMin,this._colorMid,this._colorMax];var b=v.slice(0,p).filter(function(t,e){return t<i._midpoint&&v[e+1]<=i._midpoint});var w=v.slice(0,p).filter(function(t,e){return t<=i._midpoint&&v[e+1]>i._midpoint});var x=v.slice(0,p).filter(function(t,e){return t>i._midpoint&&v[e+1]>i._midpoint});var C=b.map(function(t,e){return!e?d[0]:xt.colorLighter(d[0],e/b.length)});var k=w.map(function(){return d[1]});var M=x.map(function(t,e){return e===x.length-1?d[2]:xt.colorLighter(d[2],1-(e+1)/x.length)});d=C.concat(k).concat(M)}else{d=_t.range(0,this._buckets,1).map(function(t){return xt.colorLighter(i._colorMax,t/i._buckets)}).reverse()}}if(_.length<=p){d=d.slice(p-_.length)}this._colorScale=bt.scaleThreshold().domain(v).range(["black"].concat(d).concat(d[d.length-1]))}else{var S;if(f&&!d){var O=Math.floor(this._buckets/2);var j=_t.range(0,O,1).map(function(t){return!t?i._colorMin:xt.colorLighter(i._colorMin,t/O)});var A=(this._buckets%2?[0]:[]).map(function(){return i._colorMid});var B=_t.range(0,O,1).map(function(t){return!t?i._colorMax:xt.colorLighter(i._colorMax,t/O)}).reverse();d=j.concat(A).concat(B);var T=(d.length-1)/2;S=[h[0],this._midpoint,h[1]];S=_t.range(h[0],this._midpoint,-(h[0]-this._midpoint)/T).concat(_t.range(this._midpoint,h[1],(h[1]-this._midpoint)/T)).concat([h[1]])}else{if(!d){if(this._scale==="buckets"||this._scale==="quantile"){d=_t.range(0,this._buckets,1).map(function(t){return xt.colorLighter(u?i._colorMin:i._colorMax,t/i._buckets)});if(c)d=d.reverse()}else{d=u?[this._colorMin,xt.colorLighter(this._colorMin,.8)]:[xt.colorLighter(this._colorMax,.8),this._colorMax]}}if(this._scale==="quantile"){var W=1/(d.length-1);S=_t.range(0,1+W/2,W).map(function(t){return _t.quantile(l,t)})}else{var E=(h[1]-h[0])/(d.length-1);S=_t.range(h[0],h[1]+E/2,E)}}if(this._scale==="buckets"||this._scale==="quantile"){v=S.concat([S[S.length-1]])}else if(this._scale==="log"){var z=S.filter(function(t){return t<0});if(z.length){var H=z[0];var P=z.map(function(t){return-Math.pow(Math.abs(H),t/H)});z.forEach(function(t,e){S[S.indexOf(t)]=P[e]})}var D=S.filter(function(t){return t>0});if(D.length){var L=D[D.length-1];var F=D.map(function(t){return Math.pow(L,t/L)});D.forEach(function(t,e){S[S.indexOf(t)]=F[e]})}if(S.includes(0))S[S.indexOf(0)]=1}this._colorScale=bt.scaleLinear().domain(S).range(d)}var q=this._bucketAxis||!["buckets","jenks","quantile"].includes(this._scale);var R=wt.transition().duration(this._duration);var N={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:R,update:{opacity:1}};var G=yt.elem("g.d3plus-ColorScale-labels",Object.assign({condition:q},N));var I=yt.elem("g.d3plus-ColorScale-Rect",Object.assign({condition:q},N));var V=yt.elem("g.d3plus-ColorScale-legend",Object.assign({condition:!q},N));if(q){var K;var Y={x:0,y:0};var J=yt.assign({domain:n?h:h.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 Q=yt.assign({height:this["_".concat(r)]/2,width:this["_".concat(a)]/2},this._labelConfig||this._axisConfig.titleConfig);this._labelClass.config(Q);var U=[];if(n&&this._labelMin){var X={"font-family":this._labelClass.fontFamily()(this._labelMin),"font-size":this._labelClass.fontSize()(this._labelMin),"font-weight":this._labelClass.fontWeight()(this._labelMin)};if(X["font-family"]instanceof Array)X["font-family"]=X["font-family"][0];var Z=mt.textWidth(this._labelMin,X);if(Z&&Z<this["_".concat(a)]/2){U.push(this._labelMin);Z+=this._padding;if(n)Y.x+=Z;J[a]-=Z}}if(n&&this._labelMax){var $={"font-family":this._labelClass.fontFamily()(this._labelMax),"font-size":this._labelClass.fontSize()(this._labelMax),"font-weight":this._labelClass.fontWeight()(this._labelMax)};if($["font-family"]instanceof Array)$["font-family"]=$["font-family"][0];var tt=mt.textWidth(this._labelMax,$);if(tt&&tt<this["_".concat(a)]/2){U.push(this._labelMax);tt+=this._padding;if(!n)Y.y+=tt;J[a]-=tt}}this._axisTest.select(yt.elem("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:this._group}).node()).config(J).duration(0).render();var et=this._axisTest.outerBounds();this._outerBounds[a]=this["_".concat(a)]-this._padding*2;this._outerBounds[r]=et[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 it=this._outerBounds[s]+(["bottom","right"].includes(this._orient)?this._size:0)-(J.padding||this._axisClass.padding());var nt="translate(".concat(Y.x+(n?0:it),", ").concat(Y.y+(n?it:0),")");this._axisClass.select(yt.elem("g.d3plus-ColorScale-axis",yt.assign(N,{condition:true,enter:{transform:nt},update:{transform:nt}})).node()).config(J).align("start").render();var rt=this._axisTest._getPosition.bind(this._axisTest);var at=this._axisTest._getRange();var ot=this._group.selectAll("defs").data([0]);var st=ot.enter().append("defs");st.append("linearGradient").attr("id","gradient-".concat(this._uuid));ot=st.merge(ot);ot.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 lt=ot.select("linearGradient").selectAll("stop").data(n?d:d);var ht=this._colorScale.domain();var ut=bt.scaleLinear().domain(at).range(n?[0,100]:[100,0]);lt.enter().append("stop").merge(lt).attr("offset",function(t,e){return"".concat(ut(rt(ht[e])),"%")}).attr("stop-color",String);var ct=function t(e,i){var n=Math.abs(rt(v[i+1])-rt(e));return n||2};var ft=yt.assign((K={duration:this._duration,fill:v?function(t){return i._colorScale(t)}:"url(#gradient-".concat(this._uuid,")")},Mt(K,o,v?function(t,e){return rt(t)+ct(t,e)/2-(["left","right"].includes(i._orient)?ct(t,e):0)}:at[0]+(at[1]-at[0])/2+Y[o]),Mt(K,s,this._outerBounds[s]+(["top","left"].includes(this._orient)?et[r]:0)+this._size/2+Y[s]),Mt(K,a,v?ct:at[1]-at[0]),Mt(K,r,this._size),K),this._rectConfig);this._rectClass.data(v?v.slice(0,v.length-1):[0]).id(function(t,e){return e}).select(I.node()).config(ft).render();Q.height=this._outerBounds[r];Q.width=this._outerBounds[a];this._labelClass.config(Q).data(U).select(G.node()).x(function(t){return t===i._labelMax?ft.x+ft.width/2+i._padding:i._outerBounds.x}).y(function(t){return ft.y-i._labelClass.fontSize()(t)/2}).text(function(t){return t}).rotate(n?0:this._orient==="right"?90:-90).render()}else{yt.elem("g.d3plus-ColorScale-axis",Object.assign({condition:q},N));var dt=this._axisConfig.tickFormat?this._axisConfig.tickFormat:Ct.formatAbbreviate;var gt=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(dt(e),"+"):"".concat(dt(e)," - ").concat(dt(n))})}return t},[]);var vt=yt.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:yt.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(gt).select(V.node()).config(vt).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=yt.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:"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=yt.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=yt.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=pt.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:yt.constant(e),this):this._value}},{key:"width",value:function t(e){return arguments.length?(this._width=e,this):this._width}}]);return e}(yt.BaseClass);t.ColorScale=e;t.Legend=p;t.ckmeans=kt;Object.defineProperty(t,"__esModule",{value:true})}); |
@@ -27,3 +27,3 @@ function _typeof(obj) { 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, range } from "d3-array"; | ||
import { extent, merge, min, quantile, range } from "d3-array"; | ||
import { scaleLinear, scaleThreshold } from "d3-scale"; | ||
@@ -136,3 +136,8 @@ import { select as _select } from "d3-selection"; | ||
}); | ||
var domain = extent(this._data, this._value); | ||
var allValues = this._data.map(this._value).sort(function (a, b) { | ||
return a - b; | ||
}); | ||
var domain = extent(allValues); | ||
var negative = domain[0] < this._midpoint; | ||
@@ -225,3 +230,3 @@ var positive = domain[1] > this._midpoint; | ||
if (!colors) { | ||
if (this._scale === "buckets") { | ||
if (this._scale === "buckets" || this._scale === "quantile") { | ||
colors = range(0, this._buckets, 1).map(function (i) { | ||
@@ -236,12 +241,18 @@ return colorLighter(negative ? _this2._colorMin : _this2._colorMax, i / _this2._buckets); | ||
var _step = (domain[1] - domain[0]) / (colors.length - 1); | ||
if (this._scale === "quantile") { | ||
var _step = 1 / (colors.length - 1); | ||
_buckets = range(domain[0], domain[1] + _step / 2, _step); | ||
_buckets = range(0, 1 + _step / 2, _step).map(function (d) { | ||
return quantile(allValues, d); | ||
}); | ||
} else { | ||
var _step2 = (domain[1] - domain[0]) / (colors.length - 1); | ||
_buckets = range(domain[0], domain[1] + _step2 / 2, _step2); | ||
} | ||
} | ||
if (this._scale === "buckets") { | ||
if (this._scale === "buckets" || this._scale === "quantile") { | ||
ticks = _buckets.concat([_buckets[_buckets.length - 1]]); | ||
} | ||
if (this._scale === "log") { | ||
} else if (this._scale === "log") { | ||
var negativeBuckets = _buckets.filter(function (d) { | ||
@@ -281,3 +292,3 @@ return d < 0; | ||
var gradient = this._bucketAxis || !["buckets", "jenks"].includes(this._scale); | ||
var gradient = this._bucketAxis || !["buckets", "jenks", "quantile"].includes(this._scale); | ||
var t = transition().duration(this._duration); | ||
@@ -284,0 +295,0 @@ var groupParams = { |
{ | ||
"name": "d3plus-legend", | ||
"version": "0.8.30", | ||
"version": "0.8.31", | ||
"description": "An easy to use javascript chart legend.", | ||
@@ -5,0 +5,0 @@ "main": "build/d3plus-legend.js", |
@@ -83,3 +83,3 @@ # d3plus-legend | ||
<a name="ColorScale.axisConfig" href="#ColorScale.axisConfig">#</a> ColorScale.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L445) | ||
<a name="ColorScale.axisConfig" href="#ColorScale.axisConfig">#</a> ColorScale.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L452) | ||
@@ -92,3 +92,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#L455) | ||
<a name="ColorScale.align" href="#ColorScale.align">#</a> ColorScale.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L462) | ||
@@ -101,3 +101,3 @@ 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#L465) | ||
<a name="ColorScale.buckets" href="#ColorScale.buckets">#</a> ColorScale.**buckets**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L472) | ||
@@ -110,3 +110,3 @@ 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. | ||
<a name="ColorScale.bucketAxis" href="#ColorScale.bucketAxis">#</a> ColorScale.**bucketAxis**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L475) | ||
<a name="ColorScale.bucketAxis" href="#ColorScale.bucketAxis">#</a> ColorScale.**bucketAxis**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L482) | ||
@@ -119,3 +119,3 @@ 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.color" href="#ColorScale.color">#</a> ColorScale.**color**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L485) | ||
<a name="ColorScale.color" href="#ColorScale.color">#</a> ColorScale.**color**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L492) | ||
@@ -128,3 +128,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#L495) | ||
<a name="ColorScale.colorMax" href="#ColorScale.colorMax">#</a> ColorScale.**colorMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L502) | ||
@@ -137,3 +137,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#L505) | ||
<a name="ColorScale.colorMid" href="#ColorScale.colorMid">#</a> ColorScale.**colorMid**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L512) | ||
@@ -146,3 +146,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#L515) | ||
<a name="ColorScale.colorMin" href="#ColorScale.colorMin">#</a> ColorScale.**colorMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L522) | ||
@@ -155,3 +155,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#L525) | ||
<a name="ColorScale.data" href="#ColorScale.data">#</a> ColorScale.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L532) | ||
@@ -164,3 +164,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#L535) | ||
<a name="ColorScale.duration" href="#ColorScale.duration">#</a> ColorScale.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L542) | ||
@@ -173,3 +173,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#L545) | ||
<a name="ColorScale.height" href="#ColorScale.height">#</a> ColorScale.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L552) | ||
@@ -182,3 +182,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#L555) | ||
<a name="ColorScale.labelConfig" href="#ColorScale.labelConfig">#</a> ColorScale.**labelConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L562) | ||
@@ -191,3 +191,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#L565) | ||
<a name="ColorScale.labelMin" href="#ColorScale.labelMin">#</a> ColorScale.**labelMin**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L572) | ||
@@ -200,3 +200,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#L575) | ||
<a name="ColorScale.labelMax" href="#ColorScale.labelMax">#</a> ColorScale.**labelMax**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L582) | ||
@@ -209,3 +209,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#L585) | ||
<a name="ColorScale.legendConfig" href="#ColorScale.legendConfig">#</a> ColorScale.**legendConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L592) | ||
@@ -218,3 +218,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#L595) | ||
<a name="ColorScale.midpoint" href="#ColorScale.midpoint">#</a> ColorScale.**midpoint**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L602) | ||
@@ -227,3 +227,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#L605) | ||
<a name="ColorScale.orient" href="#ColorScale.orient">#</a> ColorScale.**orient**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L612) | ||
@@ -236,3 +236,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#L615) | ||
<a name="ColorScale.outerBounds" href="#ColorScale.outerBounds">#</a> ColorScale.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L622) | ||
@@ -250,3 +250,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#L625) | ||
<a name="ColorScale.padding" href="#ColorScale.padding">#</a> ColorScale.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L632) | ||
@@ -259,3 +259,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#L635) | ||
<a name="ColorScale.rectConfig" href="#ColorScale.rectConfig">#</a> ColorScale.**rectConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L642) | ||
@@ -268,3 +268,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#L645) | ||
<a name="ColorScale.scale" href="#ColorScale.scale">#</a> ColorScale.**scale**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L652) | ||
@@ -277,3 +277,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#L655) | ||
<a name="ColorScale.select" href="#ColorScale.select">#</a> ColorScale.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L662) | ||
@@ -286,3 +286,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#L665) | ||
<a name="ColorScale.size" href="#ColorScale.size">#</a> ColorScale.**size**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L672) | ||
@@ -295,3 +295,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#L679) | ||
<a name="ColorScale.value" href="#ColorScale.value">#</a> ColorScale.**value**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L686) | ||
@@ -311,3 +311,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#L689) | ||
<a name="ColorScale.width" href="#ColorScale.width">#</a> ColorScale.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/ColorScale.js#L696) | ||
@@ -526,2 +526,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 Thu, 20 Feb 2020 14:46:04 GMT</sub> | ||
###### <sub>Documentation generated on Wed, 25 Mar 2020 19:25:55 GMT</sub> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
345772
3823