d3plus-legend
Advanced tools
Comparing version 0.8.34 to 0.8.35
/* | ||
d3plus-legend v0.8.34 | ||
d3plus-legend v0.8.35 | ||
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 B=Object.defineProperty;var E=d?B:function t(e,i,n){A(e);i=y(i,true);A(n);if(S)try{return B(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:E};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]&<[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 Bt=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 Et=/#|\.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(Et,".").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;Bt(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 Be=Object.defineProperty;var Ee=!Ae||o(function(){if(d&&Ae({b:1},Ae(Be({},"a",{enumerable:true,get:function(){Be(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!==Ee},{assign:Ee});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(){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,Bt,Et,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=Bt.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=Bt.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+Bt.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 Bt.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 Bt.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(Et.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=Bt.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(Bt.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=Bt.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(Bt.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(Bt.sum(h.map(function(t){return Bt.max(t,function(t){return Bt.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||Bt.sum(h,this._rowHeight.bind(this))+this._padding>f){o=Bt.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&&Bt.sum(h,this._rowHeight.bind(this))+this._padding<f){h.forEach(function(t,e){t.forEach(function(t){if(e){t.y=Bt.sum(h.slice(0,e),c._rowHeight.bind(c))}})});o=Bt.max(h,this._rowWidth.bind(this))}}var g=Bt.max(this._lineData,function(t,e){return Bt.max([t.height,c._fetchConfig("height",t.data,e)])+t.y})+this._titleHeight,v=Bt.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]).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=Et.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;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(Et.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=Bt.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=Bt.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=Bt.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=Bt.deviation(w);var C=_.concat(this._midpoint).filter(function(t){return t>=i._midpoint});var k=Bt.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=Bt.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 B=v.slice(0,p).filter(function(t,e){return t<i._midpoint&&v[e+1]<=i._midpoint});var E=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=B.map(function(t,e){return!e?d[0]:Dt.colorLighter(d[0],e/B.length)});var P=E.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=Bt.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=Bt.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=Bt.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=Bt.range(u[0],this._midpoint,-(u[0]-this._midpoint)/q).concat(Bt.range(this._midpoint,u[1],(u[1]-this._midpoint)/q)).concat([u[1]])}else{if(!d){if(this._scale==="buckets"||this._scale==="quantile"){d=Bt.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=Bt.range(0,1+G/2,G).map(function(t){return Bt.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=Bt.range(u[0],this._midpoint,N);var K=Bt.range(this._midpoint,u[1]+I/2,I);D=V.concat(K)}else{var X=(u[1]-u[0])/(d.length-1);D=Bt.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&><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=Et.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 B=Object.defineProperty;var E=d?B:function t(e,i,n){A(e);i=y(i,true);A(n);if(S)try{return B(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:E};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]&<[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 Bt=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 Et=/#|\.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(Et,".").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;Bt(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 Be=Object.defineProperty;var Ee=!Ae||o(function(){if(d&&Ae({b:1},Ae(Be({},"a",{enumerable:true,get:function(){Be(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!==Ee},{assign:Ee});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(){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,Bt,Et,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=Bt.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=Bt.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+Bt.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 Bt.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 Bt.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(Et.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=Bt.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(Bt.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=Bt.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(Bt.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(Bt.sum(h.map(function(t){return Bt.max(t,function(t){return Bt.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||Bt.sum(h,this._rowHeight.bind(this))+this._padding>f){o=Bt.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&&Bt.sum(h,this._rowHeight.bind(this))+this._padding<f){h.forEach(function(t,e){t.forEach(function(t){if(e){t.y=Bt.sum(h.slice(0,e),c._rowHeight.bind(c))}})});o=Bt.max(h,this._rowWidth.bind(this))}}var g=Bt.max(this._lineData,function(t,e){return Bt.max([t.height,c._fetchConfig("height",t.data,e)])+t.y})+this._titleHeight,v=Bt.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=Et.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(Et.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=Bt.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=Bt.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=Bt.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=Bt.deviation(w);var C=_.concat(this._midpoint).filter(function(t){return t>=i._midpoint});var k=Bt.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=Bt.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 B=v.slice(0,p).filter(function(t,e){return t<i._midpoint&&v[e+1]<=i._midpoint});var E=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=B.map(function(t,e){return!e?d[0]:Dt.colorLighter(d[0],e/B.length)});var P=E.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=Bt.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=Bt.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=Bt.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=Bt.range(u[0],this._midpoint,-(u[0]-this._midpoint)/q).concat(Bt.range(this._midpoint,u[1],(u[1]-this._midpoint)/q)).concat([u[1]])}else{if(!d){if(this._scale==="buckets"||this._scale==="quantile"){d=Bt.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=Bt.range(0,1+G/2,G).map(function(t){return Bt.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=Bt.range(u[0],this._midpoint,N);var K=Bt.range(this._midpoint,u[1]+I/2,I);D=V.concat(K)}else{var X=(u[1]-u[0])/(d.length-1);D=Bt.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&><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=Et.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})}); |
@@ -106,3 +106,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); } | ||
_this._padding = 5; | ||
_this._rectClass = new Rect(); | ||
_this._rectClass = new Rect().parent(_assertThisInitialized(_this)); | ||
_this._rectConfig = { | ||
@@ -109,0 +109,0 @@ stroke: "#444", |
@@ -433,3 +433,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); } | ||
["Circle", "Rect"].forEach(function (Shape) { | ||
_this3._shapes.push(new shapes[Shape]().data(data.filter(function (d) { | ||
_this3._shapes.push(new shapes[Shape]().parent(_this3).data(data.filter(function (d) { | ||
return d.shape === Shape; | ||
@@ -436,0 +436,0 @@ })).duration(_this3._duration).labelConfig({ |
{ | ||
"name": "d3plus-legend", | ||
"version": "0.8.34", | ||
"version": "0.8.35", | ||
"description": "An easy to use javascript chart legend.", | ||
@@ -5,0 +5,0 @@ "main": "build/d3plus-legend.js", |
@@ -351,3 +351,3 @@ # d3plus-legend | ||
<a name="Legend.active" href="#Legend.active">#</a> Legend.**active**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L373) | ||
<a name="Legend.active" href="#Legend.active">#</a> Legend.**active**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L374) | ||
@@ -360,3 +360,3 @@ If *value* is specified, sets the active method for all shapes to the specified function and returns the current class instance. If *value* is not specified, returns the current active method. | ||
<a name="Legend.align" href="#Legend.align">#</a> Legend.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L384) | ||
<a name="Legend.align" href="#Legend.align">#</a> Legend.**align**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L385) | ||
@@ -369,3 +369,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="Legend.data" href="#Legend.data">#</a> Legend.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L394) | ||
<a name="Legend.data" href="#Legend.data">#</a> Legend.**data**([*data*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L395) | ||
@@ -378,3 +378,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="Legend.direction" href="#Legend.direction">#</a> Legend.**direction**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L404) | ||
<a name="Legend.direction" href="#Legend.direction">#</a> Legend.**direction**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L405) | ||
@@ -387,3 +387,3 @@ Sets the flow of the items inside the legend. If no value is passed, the current flow will be returned. | ||
<a name="Legend.duration" href="#Legend.duration">#</a> Legend.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L414) | ||
<a name="Legend.duration" href="#Legend.duration">#</a> Legend.**duration**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L415) | ||
@@ -396,3 +396,3 @@ If *value* is specified, sets the transition duration of the legend and returns the current class instance. If *value* is not specified, returns the current duration. | ||
<a name="Legend.height" href="#Legend.height">#</a> Legend.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L424) | ||
<a name="Legend.height" href="#Legend.height">#</a> Legend.**height**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L425) | ||
@@ -405,3 +405,3 @@ If *value* is specified, sets the overall height of the legend and returns the current class instance. If *value* is not specified, returns the current height value. | ||
<a name="Legend.hover" href="#Legend.hover">#</a> Legend.**hover**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L434) | ||
<a name="Legend.hover" href="#Legend.hover">#</a> Legend.**hover**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L435) | ||
@@ -414,3 +414,3 @@ If *value* is specified, sets the hover method for all shapes to the specified function and returns the current class instance. If *value* is not specified, returns the current hover method. | ||
<a name="Legend.id" href="#Legend.id">#</a> Legend.**id**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L449) | ||
<a name="Legend.id" href="#Legend.id">#</a> Legend.**id**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L450) | ||
@@ -430,3 +430,3 @@ If *value* is specified, sets the id accessor to the specified function and returns the current class instance. If *value* is not specified, returns the current id accessor. | ||
<a name="Legend.label" href="#Legend.label">#</a> Legend.**label**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L459) | ||
<a name="Legend.label" href="#Legend.label">#</a> Legend.**label**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L460) | ||
@@ -439,3 +439,3 @@ If *value* is specified, sets the label accessor to the specified function or string and returns the current class instance. If *value* is not specified, returns the current label accessor, which is the [id](#shape.id) accessor by default. | ||
<a name="Legend.outerBounds" href="#Legend.outerBounds">#</a> Legend.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L469) | ||
<a name="Legend.outerBounds" href="#Legend.outerBounds">#</a> Legend.**outerBounds**() [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L470) | ||
@@ -453,3 +453,3 @@ If called after the elements have been drawn to DOM, will returns the outer bounds of the legend content. | ||
<a name="Legend.padding" href="#Legend.padding">#</a> Legend.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L479) | ||
<a name="Legend.padding" href="#Legend.padding">#</a> Legend.**padding**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L480) | ||
@@ -462,3 +462,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="Legend.select" href="#Legend.select">#</a> Legend.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L489) | ||
<a name="Legend.select" href="#Legend.select">#</a> Legend.**select**([*selector*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L490) | ||
@@ -471,3 +471,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="Legend.shape" href="#Legend.shape">#</a> Legend.**shape**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L499) | ||
<a name="Legend.shape" href="#Legend.shape">#</a> Legend.**shape**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L500) | ||
@@ -480,3 +480,3 @@ If *value* is specified, sets the shape accessor to the specified function or string and returns the current class instance. If *value* is not specified, returns the current shape accessor. | ||
<a name="Legend.shapeConfig" href="#Legend.shapeConfig">#</a> Legend.**shapeConfig**([*config*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L509) | ||
<a name="Legend.shapeConfig" href="#Legend.shapeConfig">#</a> Legend.**shapeConfig**([*config*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L510) | ||
@@ -489,3 +489,3 @@ If *config* is specified, sets the methods that correspond to the key/value pairs for each shape and returns the current class instance. If *config* is not specified, returns the current shape configuration. | ||
<a name="Legend.title" href="#Legend.title">#</a> Legend.**title**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L519) | ||
<a name="Legend.title" href="#Legend.title">#</a> Legend.**title**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L520) | ||
@@ -498,3 +498,3 @@ If *value* is specified, sets the title of the legend and returns the current class instance. If *value* is not specified, returns the current title. | ||
<a name="Legend.titleConfig" href="#Legend.titleConfig">#</a> Legend.**titleConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L529) | ||
<a name="Legend.titleConfig" href="#Legend.titleConfig">#</a> Legend.**titleConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L530) | ||
@@ -507,3 +507,3 @@ If *value* is specified, sets the title configuration of the legend and returns the current class instance. If *value* is not specified, returns the current title configuration. | ||
<a name="Legend.verticalAlign" href="#Legend.verticalAlign">#</a> Legend.**verticalAlign**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L539) | ||
<a name="Legend.verticalAlign" href="#Legend.verticalAlign">#</a> Legend.**verticalAlign**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L540) | ||
@@ -516,3 +516,3 @@ If *value* is specified, sets the vertical alignment to the specified value and returns the current class instance. If *value* is not specified, returns the current vertical alignment. | ||
<a name="Legend.width" href="#Legend.width">#</a> Legend.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L549) | ||
<a name="Legend.width" href="#Legend.width">#</a> Legend.**width**([*value*]) [<>](https://github.com/d3plus/d3plus-legend/blob/master/src/Legend.js#L550) | ||
@@ -528,2 +528,2 @@ If *value* is specified, sets the overall width of the legend and returns the current class instance. If *value* is not specified, returns the current width value. | ||
###### <sub>Documentation generated on Tue, 30 Jun 2020 16:10:15 GMT</sub> | ||
###### <sub>Documentation generated on Tue, 30 Jun 2020 16:35:23 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
363425