@d3plus/core 3.0.5 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -90
- package/es/src/charts/Tree.js +64 -30
- package/es/src/charts/Viz.js +3 -7
- package/es/src/charts/drawSteps/drawLegend.js +3 -1
- package/es/src/components/Timeline.js +6 -6
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +56 -41
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +13 -17
- package/umd/d3plus-core.js +56 -41
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +111 -115
package/umd/d3plus-core.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.
|
|
2
|
+
@d3plus/core v3.0.7
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
4
|
Copyright (c) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
6
6
|
*/
|
|
7
|
-
(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){if("undefined"!=typeof window){try{if("undefined"==typeof SVGElement||Boolean(SVGElement.prototype.innerHTML))return}catch(t){return}function s(t){switch(t.nodeType){case 1:var i=t,e="";return e+="<"+i.tagName,i.hasAttributes()&&[].forEach.call(i.attributes,function(t){e+=" "+t.name+'="'+t.value+'"'}),e+=">",i.hasChildNodes()&&[].forEach.call(i.childNodes,function(t){e+=s(t)}),e+="</"+i.tagName+">";case 3:return t.textContent.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");case 8:return"\x3c!--"+t.nodeValue+"--\x3e"}}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var i="";return[].forEach.call(this.childNodes,function(t){i+=s(t)}),i},set:function(t){for(;this.firstChild;)this.removeChild(this.firstChild);try{var i=new DOMParser,e=(i.async=!1,"<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>"),s=i.parseFromString(e,"text/xml").documentElement;[].forEach.call(s.childNodes,function(t){this.appendChild(this.ownerDocument.importNode(t,!0))}.bind(this))}catch(t){throw new Error("Error parsing markup string")}}}),Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})}}),((t,i)=>{"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@d3plus/dom"),require("@d3plus/locales"),require("d3-array"),require("d3-collection"),require("d3-scale"),require("d3-shape"),require("open-color/open-color.js"),require("@d3plus/color"),require("@d3plus/data"),require("@d3plus/math"),require("@d3plus/format"),require("d3-time-format"),require("d3-selection"),require("d3-transition"),require("@d3plus/text"),require("d3-interpolate"),require("d3-color"),require("textures"),require("d3-interpolate-path"),require("d3-brush"),require("@popperjs/core"),require("d3-queue"),require("d3-zoom"),require("lrucache"),require("d3-geo"),require("d3-geo-projection"),require("d3-composite-projections"),require("d3-tile"),require("topojson-client"),require("d3-force"),require("d3-polygon"),require("d3-hierarchy"),require("d3-sankey")):"function"==typeof define&&define.amd?define("@d3plus/core",["exports","@d3plus/dom","@d3plus/locales","d3-array","d3-collection","d3-scale","d3-shape","open-color/open-color.js","@d3plus/color","@d3plus/data","@d3plus/math","@d3plus/format","d3-time-format","d3-selection","d3-transition","@d3plus/text","d3-interpolate","d3-color","textures","d3-interpolate-path","d3-brush","@popperjs/core","d3-queue","d3-zoom","lrucache","d3-geo","d3-geo-projection","d3-composite-projections","d3-tile","topojson-client","d3-force","d3-polygon","d3-hierarchy","d3-sankey"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).d3plus={},t.dom,t.locales,t.d3Array,t.d3Collection,t.scales,t.paths,t.pkg,t.color,t.data,t.math,t.format,t.d3TimeFormat,t.d3Selection,t.d3Transition,t.text,t.d3Interpolate,t.d3Color,t.textures,t.d3InterpolatePath,t.d3Brush,t.core,t.d3Queue,t.d3Zoom,t.lrucache,t.d3GeoCore,t.d3GeoProjection,t.d3CompositeProjections,t.d3Tile,t.topojsonClient,t.d3Force,t.d3Polygon,t.d3Hierarchy,t.d3Sankey)})(this,function(t,Pt,$,Dt,Ot,S,
|
|
7
|
+
(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){if("undefined"!=typeof window){try{if("undefined"==typeof SVGElement||Boolean(SVGElement.prototype.innerHTML))return}catch(t){return}function s(t){switch(t.nodeType){case 1:var i=t,e="";return e+="<"+i.tagName,i.hasAttributes()&&[].forEach.call(i.attributes,function(t){e+=" "+t.name+'="'+t.value+'"'}),e+=">",i.hasChildNodes()&&[].forEach.call(i.childNodes,function(t){e+=s(t)}),e+="</"+i.tagName+">";case 3:return t.textContent.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");case 8:return"\x3c!--"+t.nodeValue+"--\x3e"}}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var i="";return[].forEach.call(this.childNodes,function(t){i+=s(t)}),i},set:function(t){for(;this.firstChild;)this.removeChild(this.firstChild);try{var i=new DOMParser,e=(i.async=!1,"<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>"),s=i.parseFromString(e,"text/xml").documentElement;[].forEach.call(s.childNodes,function(t){this.appendChild(this.ownerDocument.importNode(t,!0))}.bind(this))}catch(t){throw new Error("Error parsing markup string")}}}),Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})}}),((t,i)=>{"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@d3plus/dom"),require("@d3plus/locales"),require("d3-array"),require("d3-collection"),require("d3-scale"),require("d3-shape"),require("open-color/open-color.js"),require("@d3plus/color"),require("@d3plus/data"),require("@d3plus/math"),require("@d3plus/format"),require("d3-time-format"),require("d3-selection"),require("d3-transition"),require("@d3plus/text"),require("d3-interpolate"),require("d3-color"),require("textures"),require("d3-interpolate-path"),require("d3-brush"),require("@popperjs/core"),require("d3-queue"),require("d3-zoom"),require("lrucache"),require("d3-geo"),require("d3-geo-projection"),require("d3-composite-projections"),require("d3-tile"),require("topojson-client"),require("d3-force"),require("d3-polygon"),require("d3-hierarchy"),require("d3-sankey")):"function"==typeof define&&define.amd?define("@d3plus/core",["exports","@d3plus/dom","@d3plus/locales","d3-array","d3-collection","d3-scale","d3-shape","open-color/open-color.js","@d3plus/color","@d3plus/data","@d3plus/math","@d3plus/format","d3-time-format","d3-selection","d3-transition","@d3plus/text","d3-interpolate","d3-color","textures","d3-interpolate-path","d3-brush","@popperjs/core","d3-queue","d3-zoom","lrucache","d3-geo","d3-geo-projection","d3-composite-projections","d3-tile","topojson-client","d3-force","d3-polygon","d3-hierarchy","d3-sankey"],i):i((t="undefined"!=typeof globalThis?globalThis:t||self).d3plus={},t.dom,t.locales,t.d3Array,t.d3Collection,t.scales,t.paths,t.pkg,t.color,t.data,t.math,t.format,t.d3TimeFormat,t.d3Selection,t.d3Transition,t.text,t.d3Interpolate,t.d3Color,t.textures,t.d3InterpolatePath,t.d3Brush,t.core,t.d3Queue,t.d3Zoom,t.lrucache,t.d3GeoCore,t.d3GeoProjection,t.d3CompositeProjections,t.d3Tile,t.topojsonClient,t.d3Force,t.d3Polygon,t.d3Hierarchy,t.d3Sankey)})(this,function(t,Pt,$,Dt,Ot,S,m,g,A,Lt,E,Tt,N,j,I,H,z,n,c,u,y,x,b,d,v,C,w,k,M,P,D,O,f,e){function L(e){var s=Object.create(null);return e&&Object.keys(e).forEach(function(t){var i;"default"!==t&&(i=Object.getOwnPropertyDescriptor(e,t),Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:function(){return e[t]}}))}),s.default=e,Object.freeze(s)}var $t=L(S),Et=L(m),C=L(C),w=L(w),k=L(k);
|
|
8
8
|
/**
|
|
9
9
|
@function accessor
|
|
10
10
|
@desc Wraps an object key in a simple accessor function.
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
@param {Object} [config = this._shapeConfig] The configuration object to parse.
|
|
113
113
|
@param {String} [type = "shape"] The event classifier to user for "on" events. For example, the default event type of "shape" will apply all events in the "on" config object with that key, like "click.shape" and "mouseleave.shape", in addition to any gloval events like "click" and "mouseleave".
|
|
114
114
|
@param {String} [nest] An optional nested key to bubble up to the parent config level.
|
|
115
|
-
*/function jt(t=this._shapeConfig,s="shape",i=!1){var e={duration:this._duration,on:{}};let h=n=>(t,i,e,s)=>{if(!n)return n;let h;for(;t.__d3plus__;)h&&(t.__d3plusParent__=h),i=(h=t).i,t=t.data||t.feature;return n.bind(this)(t,i,e||h,s)},n=(t,i)=>{for(var e in i)({}.hasOwnProperty.call(i,e)&&!e.includes(".")||e.includes("."+s))&&(t.on[e]=h(i[e]))},
|
|
115
|
+
*/function jt(t=this._shapeConfig,s="shape",i=!1){var e={duration:this._duration,on:{}};let h=n=>(t,i,e,s)=>{if(!n)return n;let h;for(;t.__d3plus__;)h&&(t.__d3plusParent__=h),i=(h=t).i,t=t.data||t.feature;return n.bind(this)(t,i,e||h,s)},n=(t,i)=>{for(var e in i)({}.hasOwnProperty.call(i,e)&&!e.includes(".")||e.includes("."+s))&&(t.on[e]=h(i[e]))},a=t=>t.map(t=>t instanceof Array?a(t):"object"==typeof t?r({},t):"function"==typeof t?h(t):t),r=(t,i)=>{for(var e in i)!{}.hasOwnProperty.call(i,e)||("on"===e?n(t,i[e]):"function"==typeof i[e]?t[e]=h(i[e]):i[e]instanceof Array?t[e]=a(i[e]):"object"==typeof i[e]?(t[e]||(t[e]={}),t[e].on={},r(t[e],i[e])):t[e]=i[e])};return r(e,t),this._on&&n(e,this._on),i&&t[i]&&(r(e,t[i]),t[i].on)&&n(e,t[i].on),e}
|
|
116
116
|
/**
|
|
117
117
|
@function constant
|
|
118
118
|
@desc Wraps non-function variables in a simple return function.
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
@param {Object} d
|
|
131
131
|
@param {Number} i
|
|
132
132
|
@private
|
|
133
|
-
*/function
|
|
133
|
+
*/function r(t,i,e){return i[t]||this["_"+t](i,e)}class V{
|
|
134
134
|
/**
|
|
135
135
|
@memberof Image
|
|
136
136
|
@desc Renders the current Image to the page. If a *callback* is specified, it will be called once the images are done drawing.
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
* @private
|
|
239
239
|
*/function Y(i,e){for(let t=0;t<e.length;t++){var s=e[t];for(let t=i.length-1;0<=t;t--)if(i[t].classList.contains(s))return t;// Return the index if found
|
|
240
240
|
}return 0;// Return -1 if no element is found with the class
|
|
241
|
-
}class
|
|
241
|
+
}class a extends h{
|
|
242
242
|
/**
|
|
243
243
|
@memberof Shape
|
|
244
244
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -315,7 +315,7 @@ this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-imag
|
|
|
315
315
|
@memberof Shape
|
|
316
316
|
@desc Modifies existing shapes to show hover status.
|
|
317
317
|
@private
|
|
318
|
-
*/_renderHover(){let
|
|
318
|
+
*/_renderHover(){let a=this;this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-image, g.d3plus-${this._name}-text, g.d3plus-${this._name}-hover`).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox").each(function(t,i){(t=t||{}).parentNode||(t.parentNode=this.parentNode),t.dataIndex||(t.dataIndex=i);var e=t.dataIndex,s=t.parentNode,h=j.select(this).classed("d3plus-textBox")?"textBox":j.select(this).classed("d3plus-Image")?"Image":"Shape";if((t="textBox"==h?t.data:t).__d3plusShape__||t.__d3plus__)for(;t&&(t.__d3plusShape__||t.__d3plus__);)i=t.i,t=t.data;else i=a._data.indexOf(t);var n=!a._hover||"function"!=typeof a._hover||!a._hover(t,i)?s:a._hoverGroup.node();n!==this.parentNode&&(h="textBox"==h?Y(n.childNodes,["d3plus-Image","d3plus-Shape"]):"Image"==h?Y(n.childNodes,["d3plus-Shape"]):0,n.insertBefore(this,n.childNodes[h+e])),this.className.baseVal.includes("d3plus-Shape")&&(s===n?j.select(this).call(a._applyStyle.bind(a)):j.select(this).call(a._updateStyle.bind(a,j.select(this),a._hoverStyle)))}),
|
|
319
319
|
// this._renderImage();
|
|
320
320
|
// this._renderLabels();
|
|
321
321
|
this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-image, g.d3plus-${this._name}-text`).attr("opacity",this._hover?this._hoverOpacity:this._active?this._activeOpacity:1)}
|
|
@@ -323,24 +323,24 @@ this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-imag
|
|
|
323
323
|
@memberof Shape
|
|
324
324
|
@desc Adds background image to each shape group.
|
|
325
325
|
@private
|
|
326
|
-
*/_renderImage(){let o=[];this._update.merge(this._enter).data().forEach((s,h)=>{var n=this._aes(s,h);if(n.r||n.width&&n.height){let e=s;s.nested&&s.key&&s.values&&(e=s.values[0],h=this._data.indexOf(e));var s=n.r?2*n.r:n.height,
|
|
326
|
+
*/_renderImage(){let o=[];this._update.merge(this._enter).data().forEach((s,h)=>{var n=this._aes(s,h);if(n.r||n.width&&n.height){let e=s;s.nested&&s.key&&s.values&&(e=s.values[0],h=this._data.indexOf(e));var s=n.r?2*n.r:n.height,a=this._backgroundImage(e,h),r=n.r?2*n.r:n.width;if(a){let t=e.__d3plusShape__?e.translate?e.translate[0]:this._x(e.data,e.i):this._x(e,h),i=e.__d3plusShape__?e.translate?e.translate[1]:this._y(e.data,e.i):this._y(e,h);n.x&&(t+=n.x),n.y&&(i+=n.y),e.__d3plusShape__&&(h=(e=e.data).i),o.push({__d3plus__:!0,data:e,height:s,i:h,id:this._id(e,h),url:a,width:r,x:t+-r/2,y:i+-s/2})}}}),this._backgroundImageClass.data(o).duration(this._duration).opacity(this._nestWrapper(this._opacity)).pointerEvents("none").select(Pt.elem(`g.d3plus-${this._name}-image`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).node()).render()}
|
|
327
327
|
/**
|
|
328
328
|
@memberof Shape
|
|
329
329
|
@desc Adds labels to each shape group.
|
|
330
330
|
@private
|
|
331
|
-
*/_renderLabels(){let _=[];this._update.merge(this._enter).data().forEach((t,i)=>{let e=t,s=(t.nested&&t.key&&t.values&&(e=t.values[0],i=this._data.indexOf(e)),this._label(e,i));if(this._labelBounds&&!1!==s&&null!=s){var h=this._labelBounds.bind(this)(e,i,this._aes(t,i));if(h){s.constructor!==Array&&(s=[s]);var n=e.__d3plusShape__?e.translate?e.translate[0]:this._x(e.data,e.i):this._x(e,i),
|
|
331
|
+
*/_renderLabels(){let _=[];this._update.merge(this._enter).data().forEach((t,i)=>{let e=t,s=(t.nested&&t.key&&t.values&&(e=t.values[0],i=this._data.indexOf(e)),this._label(e,i));if(this._labelBounds&&!1!==s&&null!=s){var h=this._labelBounds.bind(this)(e,i,this._aes(t,i));if(h){s.constructor!==Array&&(s=[s]);var n=e.__d3plusShape__?e.translate?e.translate[0]:this._x(e.data,e.i):this._x(e,i),a=e.__d3plusShape__?e.translate?e.translate[1]:this._y(e.data,e.i):this._y(e,i);e.__d3plusShape__&&(i=(e=e.data).i);for(let t=0;t<s.length;t++){var r=h.constructor===Array?h[t]:Object.assign({},h),o=this._rotate(e,i),l=e.labelConfig&&e.labelConfig.rotate?e.labelConfig.rotate:void 0!==h.angle?h.angle:0,o=(l+=o,0!==o?[-1*r.x||0,-1*r.y||0]:[r.width/2,r.height/2]);_.push({__d3plus__:!0,data:e,height:r.height,l:t,id:this._id(e,i)+"_"+t,r:l,rotateAnchor:o,text:s[t],width:r.width,x:n+r.x,y:a+r.y})}}}}),this._labelClass.data(_).duration(this._duration).fontOpacity(this._nestWrapper(this._opacity)).pointerEvents("none").rotate(t=>(t.__d3plus__?t:t.data).r).rotateAnchor(t=>(t.__d3plus__?t:t.data).rotateAnchor).select(Pt.elem(`g.d3plus-${this._name}-text`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).node()).config(jt.bind(this)(this._labelConfig)).render()}
|
|
332
332
|
/**
|
|
333
333
|
@memberof Shape
|
|
334
334
|
@desc Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
|
|
335
335
|
@param {Function} [*callback*]
|
|
336
336
|
@chainable
|
|
337
|
-
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").style("display","block").node()),this._transition=I.transition(this._uuid).duration(this._duration);let i=this._data,e=this._id,s=(this._dataFilter&&(i=this._dataFilter(i)).key&&(e=i.key),this._sort&&(i=i.sort((t,i)=>{for(;t.__d3plusShape__||t.__d3plus__;)t=t.data;for(;i.__d3plusShape__||i.__d3plus__;)i=i.data;return this._sort(t,i)})),Lt.unique(i.map(this._getTextureKey.bind(this))).filter(Boolean)),h=Object.keys(this._textureDefs);h.forEach(t=>{s.includes(t)||(j.select(this._select.select("pattern#"+this._textureDefs[t].id()).node().parentNode).remove(),delete this._textureDefs[t])}),s.forEach(t=>{if(!h.includes(t)){let i=JSON.parse(t);var e=i.texture,s=(delete i.texture,
|
|
337
|
+
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").style("display","block").node()),this._transition=I.transition(this._uuid).duration(this._duration);let i=this._data,e=this._id,s=(this._dataFilter&&(i=this._dataFilter(i)).key&&(e=i.key),this._sort&&(i=i.sort((t,i)=>{for(;t.__d3plusShape__||t.__d3plus__;)t=t.data;for(;i.__d3plusShape__||i.__d3plus__;)i=i.data;return this._sort(t,i)})),Lt.unique(i.map(this._getTextureKey.bind(this))).filter(Boolean)),h=Object.keys(this._textureDefs);h.forEach(t=>{s.includes(t)||(j.select(this._select.select("pattern#"+this._textureDefs[t].id()).node().parentNode).remove(),delete this._textureDefs[t])}),s.forEach(t=>{if(!h.includes(t)){let i=JSON.parse(t);var e=i.texture,s=(delete i.texture,c[e]());for(let t in i)({}).hasOwnProperty.call(s,t)&&t in s&&("d"===t&&"function"==typeof t?s[t](()=>i[t]):i[t]instanceof Array?s[t].apply(null,i[t]):s[t](i[t]));this._select.call(s),this._textureDefs[t]=s}}),j.selectAll(`g.d3plus-${this._name}-hover > *, g.d3plus-${this._name}-active > *`).each(function(t){t&&t.parentNode?t.parentNode.appendChild(this):this.parentNode.removeChild(this)}),
|
|
338
338
|
// Makes the update state of the group selection accessible.
|
|
339
339
|
this._group=Pt.elem(`g.d3plus-${this._name}-group`,{parent:this._select});var n=this._update=Pt.elem(`g.d3plus-${this._name}-shape`,{parent:this._group,update:{opacity:this._active?this._activeOpacity:1}}).selectAll(".d3plus-"+this._name).data(i,e);
|
|
340
340
|
// Orders and transforms the updating Shapes.
|
|
341
|
-
n.order(),(this._duration?n.transition(this._transition):n).call(this._applyTransform.bind(this));var
|
|
341
|
+
n.order(),(this._duration?n.transition(this._transition):n).call(this._applyTransform.bind(this));var a=(this._enter=n.enter().append(this._tagName).attr("class",(t,i)=>`d3plus-Shape d3plus-${this._name} d3plus-id-`+H.strip(this._nestWrapper(this._id)(t,i))).call(this._applyTransform.bind(this)).attr("aria-label",this._ariaLabel).attr("role",this._role).attr("opacity",this._nestWrapper(this._opacity))).merge(n);let r=a.attr("shape-rendering",this._nestWrapper(this._shapeRendering));(r=this._duration?r.attr("pointer-events","none").transition(this._transition).transition().delay(100).attr("pointer-events",this._pointerEvents):r).attr("opacity",this._nestWrapper(this._opacity));
|
|
342
342
|
// Makes the exit state of the group selection accessible.
|
|
343
|
-
var n=this._exit=n.exit(),n=((this._duration?n.transition().delay(this._duration):n).remove(),this._renderImage(),this._renderLabels(),this._hoverGroup=Pt.elem(`g.d3plus-${this._name}-hover`,{parent:this._group}),this._activeGroup=Pt.elem(`g.d3plus-${this._name}-active`,{parent:this._group}),this._group.selectAll(".d3plus-HitArea").data(this._hitArea&&Object.keys(this._on).length?i:[],e)),o=(n.order().call(this._applyTransform.bind(this)),"Line"===this._name),l=(o&&(l=this._curve.bind(this)(this.config()),o)&&this._path.curve(Et["curve"+l.charAt(0).toUpperCase()+l.slice(1)]).defined(this._defined).x(this._x).y(this._y),n.enter().append(o?"path":"rect").attr("class",(t,i)=>"d3plus-HitArea d3plus-id-"+H.strip(this._nestWrapper(this._id)(t,i))).attr("fill","black").attr("stroke","black").attr("pointer-events","painted").attr("opacity",0).call(this._applyTransform.bind(this)));let _=this;o=n.merge(l).each(function(t){var i=_._data.indexOf(t),e=_._hitArea(t,i,_._aes(t,i));return!e||"Line"===_._name&&10<parseFloat(_._strokeWidth(t,i))?j.select(this).remove():j.select(this).call(Pt.attrize,e)});return n.exit().remove(),this._applyEvents(this._hitArea?o:
|
|
343
|
+
var n=this._exit=n.exit(),n=((this._duration?n.transition().delay(this._duration):n).remove(),this._renderImage(),this._renderLabels(),this._hoverGroup=Pt.elem(`g.d3plus-${this._name}-hover`,{parent:this._group}),this._activeGroup=Pt.elem(`g.d3plus-${this._name}-active`,{parent:this._group}),this._group.selectAll(".d3plus-HitArea").data(this._hitArea&&Object.keys(this._on).length?i:[],e)),o=(n.order().call(this._applyTransform.bind(this)),"Line"===this._name),l=(o&&(l=this._curve.bind(this)(this.config()),o)&&this._path.curve(Et["curve"+l.charAt(0).toUpperCase()+l.slice(1)]).defined(this._defined).x(this._x).y(this._y),n.enter().append(o?"path":"rect").attr("class",(t,i)=>"d3plus-HitArea d3plus-id-"+H.strip(this._nestWrapper(this._id)(t,i))).attr("fill","black").attr("stroke","black").attr("pointer-events","painted").attr("opacity",0).call(this._applyTransform.bind(this)));let _=this;o=n.merge(l).each(function(t){var i=_._data.indexOf(t),e=_._hitArea(t,i,_._aes(t,i));return!e||"Line"===_._name&&10<parseFloat(_._strokeWidth(t,i))?j.select(this).remove():j.select(this).call(Pt.attrize,e)});return n.exit().remove(),this._applyEvents(this._hitArea?o:a),setTimeout(()=>{this._active?this._renderActive():this._hover&&this._renderHover(),t&&t()},this._duration+100),this}
|
|
344
344
|
/**
|
|
345
345
|
@memberof Shape
|
|
346
346
|
@desc If *value* is specified, sets the highlight accessor to the specified function and returns the current class instance.
|
|
@@ -621,7 +621,7 @@ this._renderHover(),this):this._hover}
|
|
|
621
621
|
@memberof Shape
|
|
622
622
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
623
623
|
@private
|
|
624
|
-
*/constructor(t="g"){super(),this._activeOpacity=.25,this._activeStyle={stroke:(t,i)=>{let e=this._fill(t,i);return["transparent","none"].includes(e)&&(e=this._stroke(t,i)),n.color(e).darker(1)},"stroke-width":(t,i)=>3*(this._strokeWidth(t,i)||1)},this._ariaLabel=Ht(""),this._backgroundImage=Ht(!1),this._backgroundImageClass=new V,this._data=[],this._duration=600,this._fill=Ht("black"),this._fillOpacity=Ht(1),this._hoverOpacity=.5,this._hoverStyle={stroke:(t,i)=>{let e=this._fill(t,i);return["transparent","none"].includes(e)&&(e=this._stroke(t,i)),n.color(e).darker(.5)},"stroke-width":(t,i)=>2*(this._strokeWidth(t,i)||1)},this._id=(t,i)=>void 0!==t.id?t.id:i,this._label=Ht(!1),this._labelClass=new l,this._labelConfig={fontColor:(t,i)=>A.colorContrast(this._fill(t,i)),fontSize:12,padding:5},this._name="Shape",this._opacity=Ht(1),this._pointerEvents=Ht("visiblePainted"),this._role=Ht("presentation"),this._rotate=Ht(0),this._rx=Ht(0),this._ry=Ht(0),this._scale=Ht(1),this._shapeRendering=Ht("geometricPrecision"),this._stroke=(t,i)=>n.color(this._fill(t,i)).darker(1).formatHex(),this._strokeDasharray=Ht("0"),this._strokeLinecap=Ht("butt"),this._strokeOpacity=Ht(1),this._strokeWidth=Ht(0),this._tagName=t,this._textAnchor=Ht("start"),this._texture=Ht(!1),this._textureDefault={},this._textureDefs={},this._vectorEffect=Ht("non-scaling-stroke"),this._verticalAlign=Ht("top"),this._x=s("x",0),this._y=s("y",0)}}class Nt extends
|
|
624
|
+
*/constructor(t="g"){super(),this._activeOpacity=.25,this._activeStyle={stroke:(t,i)=>{let e=this._fill(t,i);return["transparent","none"].includes(e)&&(e=this._stroke(t,i)),n.color(e).darker(1)},"stroke-width":(t,i)=>3*(this._strokeWidth(t,i)||1)},this._ariaLabel=Ht(""),this._backgroundImage=Ht(!1),this._backgroundImageClass=new V,this._data=[],this._duration=600,this._fill=Ht("black"),this._fillOpacity=Ht(1),this._hoverOpacity=.5,this._hoverStyle={stroke:(t,i)=>{let e=this._fill(t,i);return["transparent","none"].includes(e)&&(e=this._stroke(t,i)),n.color(e).darker(.5)},"stroke-width":(t,i)=>2*(this._strokeWidth(t,i)||1)},this._id=(t,i)=>void 0!==t.id?t.id:i,this._label=Ht(!1),this._labelClass=new l,this._labelConfig={fontColor:(t,i)=>A.colorContrast(this._fill(t,i)),fontSize:12,padding:5},this._name="Shape",this._opacity=Ht(1),this._pointerEvents=Ht("visiblePainted"),this._role=Ht("presentation"),this._rotate=Ht(0),this._rx=Ht(0),this._ry=Ht(0),this._scale=Ht(1),this._shapeRendering=Ht("geometricPrecision"),this._stroke=(t,i)=>n.color(this._fill(t,i)).darker(1).formatHex(),this._strokeDasharray=Ht("0"),this._strokeLinecap=Ht("butt"),this._strokeOpacity=Ht(1),this._strokeWidth=Ht(0),this._tagName=t,this._textAnchor=Ht("start"),this._texture=Ht(!1),this._textureDefault={},this._textureDefs={},this._vectorEffect=Ht("non-scaling-stroke"),this._verticalAlign=Ht("top"),this._x=s("x",0),this._y=s("y",0)}}class Nt extends a{
|
|
625
625
|
/**
|
|
626
626
|
@memberof Area
|
|
627
627
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -640,7 +640,7 @@ this._renderHover(),this):this._hover}
|
|
|
640
640
|
@desc Draws the area polygons.
|
|
641
641
|
@param {Function} [*callback*]
|
|
642
642
|
@chainable
|
|
643
|
-
*/render(t){super.render(t);t=this._curve.bind(this)(this.config()),t=Et["curve"+t.charAt(0).toUpperCase()+t.slice(1)];let i=this._path=Et.area().defined(this._defined).curve(t).x(this._x).x0(this._x0).x1(this._x1).y(this._y).y0(this._y0).y1(this._y1),e=Et.area().defined(t=>t).curve(t).x(this._x).y(this._y).x0((t,i)=>this._x1?this._x0(t,i)+(this._x1(t,i)-this._x0(t,i))/2:this._x0(t,i)).x1((t,i)=>this._x1?this._x0(t,i)+(this._x1(t,i)-this._x0(t,i))/2:this._x0(t,i)).y0((t,i)=>this._y1?this._y0(t,i)+(this._y1(t,i)-this._y0(t,i))/2:this._y0(t,i)).y1((t,i)=>this._y1?this._y0(t,i)+(this._y1(t,i)-this._y0(t,i))/2:this._y0(t,i));return this._enter.append("path").attr("transform",t=>`translate(${-t.xR[0]-t.width/2}, ${-t.yR[0]-t.height/2})`).attr("d",t=>e(t.values)).call(this._applyStyle.bind(this)).transition(this._transition).attrTween("d",function(t){return
|
|
643
|
+
*/render(t){super.render(t);t=this._curve.bind(this)(this.config()),t=Et["curve"+t.charAt(0).toUpperCase()+t.slice(1)];let i=this._path=Et.area().defined(this._defined).curve(t).x(this._x).x0(this._x0).x1(this._x1).y(this._y).y0(this._y0).y1(this._y1),e=Et.area().defined(t=>t).curve(t).x(this._x).y(this._y).x0((t,i)=>this._x1?this._x0(t,i)+(this._x1(t,i)-this._x0(t,i))/2:this._x0(t,i)).x1((t,i)=>this._x1?this._x0(t,i)+(this._x1(t,i)-this._x0(t,i))/2:this._x0(t,i)).y0((t,i)=>this._y1?this._y0(t,i)+(this._y1(t,i)-this._y0(t,i))/2:this._y0(t,i)).y1((t,i)=>this._y1?this._y0(t,i)+(this._y1(t,i)-this._y0(t,i))/2:this._y0(t,i));return this._enter.append("path").attr("transform",t=>`translate(${-t.xR[0]-t.width/2}, ${-t.yR[0]-t.height/2})`).attr("d",t=>e(t.values)).call(this._applyStyle.bind(this)).transition(this._transition).attrTween("d",function(t){return u.interpolatePath(j.select(this).attr("d"),i(t.values))}),this._update.select("path").transition(this._transition).attr("transform",t=>`translate(${-t.xR[0]-t.width/2}, ${-t.yR[0]-t.height/2})`).attrTween("d",function(t){return u.interpolatePath(j.select(this).attr("d"),i(t.values))}).call(this._applyStyle.bind(this)),this._exit.select("path").transition(this._transition).attrTween("d",function(t){return u.interpolatePath(j.select(this).attr("d"),e(t.values))}),this}
|
|
644
644
|
/**
|
|
645
645
|
@memberof Area
|
|
646
646
|
@desc If *value* is specified, sets the area curve to the specified string and returns the current class instance. If *value* is not specified, returns the current area curve.
|
|
@@ -693,7 +693,7 @@ this._renderHover(),this):this._hover}
|
|
|
693
693
|
@memberof Area
|
|
694
694
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
695
695
|
@private
|
|
696
|
-
*/constructor(){super(),this._curve=Ht("linear"),this._defined=()=>!0,this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points);return e?{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2-this._x(t,i),y:e.cy-e.height/2-this._y(t,i)}:null},this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Area",this._x=s("x"),this._x0=s("x"),this._x1=null,this._y=Ht(0),this._y0=Ht(0),this._y1=s("y")}}class K extends
|
|
696
|
+
*/constructor(){super(),this._curve=Ht("linear"),this._defined=()=>!0,this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points);return e?{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2-this._x(t,i),y:e.cy-e.height/2-this._y(t,i)}:null},this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Area",this._x=s("x"),this._x0=s("x"),this._x1=null,this._y=Ht(0),this._y0=Ht(0),this._y1=s("y")}}class K extends a{
|
|
697
697
|
/**
|
|
698
698
|
@memberof Bar
|
|
699
699
|
@desc Draws the bars.
|
|
@@ -789,7 +789,7 @@ this._renderHover(),this):this._hover}
|
|
|
789
789
|
@memberof Bar
|
|
790
790
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
791
791
|
@private
|
|
792
|
-
*/constructor(){super("rect"),this._name="Bar",this._height=Ht(10),this._labelBounds=(t,i,e)=>({width:e.width,height:e.height,x:null!==this._x1?this._getX(t,i):-e.width/2,y:null===this._x1?this._getY(t,i):-e.height/2}),this._width=Ht(10),this._x=s("x"),this._x0=s("x"),this._x1=null,this._y=Ht(0),this._y0=Ht(0),this._y1=s("y")}}class Rt extends
|
|
792
|
+
*/constructor(){super("rect"),this._name="Bar",this._height=Ht(10),this._labelBounds=(t,i,e)=>({width:e.width,height:e.height,x:null!==this._x1?this._getX(t,i):-e.width/2,y:null===this._x1?this._getY(t,i):-e.height/2}),this._width=Ht(10),this._x=s("x"),this._x0=s("x"),this._x1=null,this._y=Ht(0),this._y0=Ht(0),this._y1=s("y")}}class Rt extends a{
|
|
793
793
|
/**
|
|
794
794
|
@memberof Circle
|
|
795
795
|
@desc Provides the default positioning to the <rect> elements.
|
|
@@ -822,7 +822,7 @@ this._renderHover(),this):this._hover}
|
|
|
822
822
|
@memberof Circle
|
|
823
823
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
824
824
|
@private
|
|
825
|
-
*/constructor(){super("circle"),this._labelBounds=(t,i,e)=>({width:1.5*e.r,height:1.5*e.r,x:.75*-e.r,y:.75*-e.r}),this._labelConfig=Pt.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Circle",this._r=s("r")}}class Ft extends
|
|
825
|
+
*/constructor(){super("circle"),this._labelBounds=(t,i,e)=>({width:1.5*e.r,height:1.5*e.r,x:.75*-e.r,y:.75*-e.r}),this._labelConfig=Pt.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"}),this._name="Circle",this._r=s("r")}}class Ft extends a{
|
|
826
826
|
/**
|
|
827
827
|
@memberof Rect
|
|
828
828
|
@desc Draws the rectangles.
|
|
@@ -866,7 +866,7 @@ this._renderHover(),this):this._hover}
|
|
|
866
866
|
@memberof Rect
|
|
867
867
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
868
868
|
@private
|
|
869
|
-
*/constructor(){super("rect"),this._height=s("height"),this._labelBounds=(t,i,e)=>({width:e.width,height:e.height,x:-e.width/2,y:-e.height/2}),this._name="Rect",this._width=s("width")}}class It extends
|
|
869
|
+
*/constructor(){super("rect"),this._height=s("height"),this._labelBounds=(t,i,e)=>({width:e.width,height:e.height,x:-e.width/2,y:-e.height/2}),this._name="Rect",this._width=s("width")}}class It extends a{
|
|
870
870
|
/**
|
|
871
871
|
@memberof Line
|
|
872
872
|
@desc Filters/manipulates the data array before binding each point to an SVG group.
|
|
@@ -878,12 +878,12 @@ this._renderHover(),this):this._hover}
|
|
|
878
878
|
@desc Draws the lines.
|
|
879
879
|
@param {Function} [*callback*]
|
|
880
880
|
@chainable
|
|
881
|
-
*/render(t){super.render(t);let
|
|
881
|
+
*/render(t){super.render(t);let a=this;
|
|
882
882
|
/**
|
|
883
883
|
@desc Calculates the stroke-dasharray used for animations
|
|
884
884
|
@param {Object} *d* data point
|
|
885
885
|
@private
|
|
886
|
-
*/function i(i){i.initialLength=this.getTotalLength();let e=
|
|
886
|
+
*/function i(i){i.initialLength=this.getTotalLength();let e=a._strokeDasharray(i.values[0],a._data.indexOf(i.values[0])).split(" ").map(Number);1===e.length&&0===e[0]?e=[i.initialLength]:1===e.length?e.push(e[0]):e.length%2&&(e=e.concat(e));var s=[];let h=0;for(;h<i.initialLength;)for(let t=0;t<e.length;t++){var n=e[t];if(h+=n,s.push(n),h>=i.initialLength)break}1<s.length&&s.length%2&&s.pop(),s[s.length-1]+=i.initialLength-Dt.sum(s),s.length%2==0&&s.push(0),i.initialStrokeArray=s.join(" ")}t=this._curve.bind(this)(this.config()),t=Et["curve"+t.charAt(0).toUpperCase()+t.slice(1)],this._path.curve(t).defined(this._defined).x(this._x).y(this._y),t=this._enter.append("path").attr("transform",t=>`translate(${-t.xR[0]-t.width/2}, ${-t.yR[0]-t.height/2})`).attr("d",t=>this._path(t.values)).call(this._applyStyle.bind(this));let e=this._update.select("path").attr("stroke-dasharray",t=>a._strokeDasharray(t.values[0],a._data.indexOf(t.values[0])));return this._duration?(t.each(i).attr("stroke-dasharray",t=>t.initialStrokeArray+" "+t.initialLength).attr("stroke-dashoffset",t=>t.initialLength).transition(this._transition).attr("stroke-dashoffset",0),e=e.transition(this._transition).attrTween("d",function(t){return u.interpolatePath(j.select(this).attr("d"),a._path(t.values))}),this._exit.selectAll("path").each(i).attr("stroke-dasharray",t=>t.initialStrokeArray+" "+t.initialLength).transition(this._transition).attr("stroke-dashoffset",t=>-t.initialLength)):e=e.attr("d",t=>a._path(t.values)),e.attr("transform",t=>`translate(${-t.xR[0]-t.width/2}, ${-t.yR[0]-t.height/2})`).call(this._applyStyle.bind(this)),this}
|
|
887
887
|
/**
|
|
888
888
|
@memberof Line
|
|
889
889
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -913,9 +913,9 @@ this._renderHover(),this):this._hover}
|
|
|
913
913
|
@desc Draws the whisker.
|
|
914
914
|
@param {Function} [*callback*]
|
|
915
915
|
@chainable
|
|
916
|
-
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").style("display","block").node());let
|
|
916
|
+
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").style("display","block").node());let r=[];this._data.forEach((t,i)=>{var e=this._orient(t,i),s=this._x(t,i),h=this._y(t,i);let n=s,a=("left"===e?n-=this._length(t,i):"right"===e&&(n+=this._length(t,i)),h);"top"===e?a-=this._length(t,i):"bottom"===e&&(a+=this._length(t,i)),r.push({__d3plus__:!0,data:t,i:i,id:i,x:s,y:h}),r.push({__d3plus__:!0,data:t,i:i,id:i,x:n,y:a})}),
|
|
917
917
|
// Draw whisker line.
|
|
918
|
-
this._line=(new It).data(
|
|
918
|
+
this._line=(new It).data(r).select(Pt.elem("g.d3plus-Whisker",{parent:this._select}).node()).config(jt.bind(this)(this._lineConfig,"shape")).render(t);t=this._data.map((t,i)=>{var e={__d3plus__:!0};e.data=t,e.i=i,e.endpoint=this._endpoint(t,i),e.length=this._length(t,i),e.orient=this._orient(t,i);let s=this._x(t,i),h=("left"===e.orient?s-=e.length:"right"===e.orient&&(s+=e.length),this._y(t,i));return"top"===e.orient?h-=e.length:"bottom"===e.orient&&(h+=e.length),e.x=s,e.y=h,e});
|
|
919
919
|
// Draw whisker endpoint.
|
|
920
920
|
return this._whiskerEndpoint=[],Ot.nest().key(t=>t.endpoint).entries(t).forEach(t=>{var i=t.key;this._whiskerEndpoint.push((new U[i]).data(t.values).select(Pt.elem("g.d3plus-Whisker-Endpoint-"+i,{parent:this._select}).node()).config({height:t=>"top"===t.orient||"bottom"===t.orient?5:20,width:t=>"top"===t.orient||"bottom"===t.orient?20:5}).config(jt.bind(this)(this._endpointConfig,"shape",i)).render())}),this}
|
|
921
921
|
/**
|
|
@@ -1015,7 +1015,7 @@ this._box=(new Ft).data(t).x(t=>t.x).y(t=>t.y).select(Pt.elem("g.d3plus-Box",{pa
|
|
|
1015
1015
|
this._median=(new Ft).data(t).x(t=>"vertical"===t.orient?t.x:t.median).y(t=>"vertical"===t.orient?t.median:t.y).height(t=>"vertical"===t.orient?1:t.height).width(t=>"vertical"===t.orient?t.width:1).select(Pt.elem("g.d3plus-Box-Median",{parent:this._select}).node()).config(jt.bind(this)(this._medianConfig,"shape")).render();
|
|
1016
1016
|
// Draw 2 lines using Whisker class.
|
|
1017
1017
|
// Construct coordinates for whisker startpoints and push it to the whiskerData.
|
|
1018
|
-
let o=[];return t.forEach((t,i)=>{var e,s,h=t.x,n=t.y,
|
|
1018
|
+
let o=[];return t.forEach((t,i)=>{var e,s,h=t.x,n=t.y,a=t.first-t.lowerLimit,r=t.upperLimit-t.third;"vertical"===t.orient?(e=n-t.height/2,s=n+t.height/2,o.push({__d3plus__:!0,data:t,i:i,x:h,y:e,length:a,orient:"top"},{__d3plus__:!0,data:t,i:i,x:h,y:s,length:r,orient:"bottom"})):"horizontal"===t.orient&&(e=h+t.width/2,s=h-t.width/2,o.push({__d3plus__:!0,data:t,i:i,x:e,y:n,length:r,orient:"right"},{__d3plus__:!0,data:t,i:i,x:s,y:n,length:a,orient:"left"}))}),
|
|
1019
1019
|
// Draw whiskers.
|
|
1020
1020
|
this._whisker=(new X).data(o).select(Pt.elem("g.d3plus-Box-Whisker",{parent:this._select}).node()).config(jt.bind(this)(this._whiskerConfig,"shape")).render(),
|
|
1021
1021
|
// Draw outliers.
|
|
@@ -1120,7 +1120,7 @@ this._whiskerEndpoint=[],Ot.nest().key(t=>t.outlier).entries(n).forEach(t=>{var
|
|
|
1120
1120
|
@memberof Box
|
|
1121
1121
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from BaseClass.
|
|
1122
1122
|
@private
|
|
1123
|
-
*/constructor(){super(),this._medianConfig={fill:Ht("black")},this._orient=s("orient","vertical"),this._outlier=s("outlier","Circle"),this._outlierConfig={Circle:{r:s("r",5)},Rect:{height:(t,i)=>"vertical"===this._orient(t,i)?5:20,width:(t,i)=>"vertical"===this._orient(t,i)?20:5}},this._rectConfig={fill:Ht("white"),stroke:Ht("black"),strokeWidth:Ht(1)},this._rectWidth=Ht(50),this._whiskerConfig={},this._whiskerMode=["tukey","tukey"],this._x=s("x",250),this._y=s("y",250)}}class B extends
|
|
1123
|
+
*/constructor(){super(),this._medianConfig={fill:Ht("black")},this._orient=s("orient","vertical"),this._outlier=s("outlier","Circle"),this._outlierConfig={Circle:{r:s("r",5)},Rect:{height:(t,i)=>"vertical"===this._orient(t,i)?5:20,width:(t,i)=>"vertical"===this._orient(t,i)?20:5}},this._rectConfig={fill:Ht("white"),stroke:Ht("black"),strokeWidth:Ht(1)},this._rectWidth=Ht(50),this._whiskerConfig={},this._whiskerMode=["tukey","tukey"],this._x=s("x",250),this._y=s("y",250)}}class B extends a{
|
|
1124
1124
|
/**
|
|
1125
1125
|
@memberof Path
|
|
1126
1126
|
@desc Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
@@ -1148,7 +1148,7 @@ this._whiskerEndpoint=[],Ot.nest().key(t=>t.outlier).entries(n).forEach(t=>{var
|
|
|
1148
1148
|
@memberof Path
|
|
1149
1149
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Shape.
|
|
1150
1150
|
@private
|
|
1151
|
-
*/constructor(){super("path"),this._d=s("path"),this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points,{angle:this._labelConfig.rotate?this._labelConfig.rotate(t,i):0});return!!e&&{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2,y:e.cy-e.height/2}},this._name="Path",this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"})}}var Wt=Object.freeze({__proto__:null,Area:Nt,Bar:K,Box:Q,Circle:Rt,Image:V,Line:It,Path:B,Rect:Ft,Shape:
|
|
1151
|
+
*/constructor(){super("path"),this._d=s("path"),this._labelBounds=(t,i,e)=>{e=E.largestRect(e.points,{angle:this._labelConfig.rotate?this._labelConfig.rotate(t,i):0});return!!e&&{angle:e.angle,width:e.width,height:e.height,x:e.cx-e.width/2,y:e.cy-e.height/2}},this._name="Path",this._labelConfig=Object.assign(this._labelConfig,{textAnchor:"middle",verticalAlign:"middle"})}}var Wt=Object.freeze({__proto__:null,Area:Nt,Bar:K,Box:Q,Circle:Rt,Image:V,Line:It,Path:B,Rect:Ft,Shape:a,Whisker:X});let Z=g.theme,R=t=>t<0||Object.is(t,-0),F=t=>Math.pow(10,Math.floor(Math.log10(Math.abs(t))))*Math.pow(-1,R(t)),W=t=>Math.pow(10,Math.ceil(Math.log10(Math.abs(t))))*Math.pow(-1,R(t)),tt=t=>{var i,e=""+t;return e.includes("e-")||"0"===e?0:(i=e.match(/(-*[0-9]+\.[0]*)([0-8]+)9{3,}[0-9]+$/))?+(""+i[1]+(+i[2]+1)):(i=e.match(/(-*[0-9]+\.[0]*)([1-9]+)0*[0-9]*0{3,}[0-9]+$/))?+(""+i[1]+ +i[2]):t};
|
|
1152
1152
|
/* catches for -0 and less */
|
|
1153
1153
|
/**
|
|
1154
1154
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
@@ -1159,16 +1159,16 @@ this._whiskerEndpoint=[],Ot.nest().key(t=>t.outlier).entries(n).forEach(t=>{var
|
|
|
1159
1159
|
* Calculates ticks from a given scale (negative and/or positive)
|
|
1160
1160
|
* @param {scale} scale A d3-scale object
|
|
1161
1161
|
* @private
|
|
1162
|
-
*/function(t,i=!1){var e=$t.scaleLinear().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let s=Math.floor(e(t));return"time"===this._scale&&(s=this._data&&this._data.length?(e=Dt.extent(this._data),t=this._data.reduce((t,i,e,s)=>t=e&&(i=Math.abs(i-s[e-1]))<t?i:t,1/0),e=Math.round((e[1]-e[0])/t),Dt.min([s*(i?2:.5),e])):i?2*s:s/2),Math.floor(s)}.bind(this)(t,e),n=t.domain();let
|
|
1162
|
+
*/function(t,i=!1){var e=$t.scaleLinear().domain([200,1200]).range([8,28]),t=t.range(),t=Math.abs(t[1]-t[0]);let s=Math.floor(e(t));return"time"===this._scale&&(s=this._data&&this._data.length?(e=Dt.extent(this._data),t=this._data.reduce((t,i,e,s)=>t=e&&(i=Math.abs(i-s[e-1]))<t?i:t,1/0),e=Math.round((e[1]-e[0])/t),Dt.min([s*(i?2:.5),e])):i?2*s:s/2),Math.floor(s)}.bind(this)(t,e),n=t.domain();let a=n[1]<n[0];if(e||"log"!==this._scale){if(s=t.ticks(h),!e&&!["log","time"].includes(this._scale)&&1<s.length){let e=Math.abs(2*tt(s[1]-s[0]));s=s.filter(t=>{var t=Math.abs(t)%e,i=tt(t);return i!==t?!i||i===e:0==t})}}else{var e=n.map(t=>Math.log10(t)%1==0?t:(a?W:F)(t)),r=e[1]<e[0],e=e.map(t=>(R(t)?-1:1)*([-1,1].includes(t)||Math.abs(t)<1?1:Math.log10(Math.abs(t))));let i=Math.ceil((Math.abs(e[1]-e[0])+1)/(.65*h));s=i<=1&&e[0]===e[1]||r!=a?t.ticks(h).filter(t=>+(""+t).replace("0.","")%2==0):Dt.range(e[0],e[1],e[1]<e[0]?-1:1).concat([e[1]]).filter(t=>Math.abs(t)%i==0).map(t=>+(""+(R(t)?-1:1)*(t?Math.pow(10,Math.abs(t)):0<Math.sign(1/t)?1:-1)).replace(/9+/g,"1"))}
|
|
1163
1163
|
// forces min/max into ticks, if not present
|
|
1164
1164
|
// for time scale, if data array has been provided, filter out ticks that are not in the array
|
|
1165
|
-
if(this._d3ScaleNegative&&R(n[
|
|
1165
|
+
if(this._d3ScaleNegative&&R(n[a?1:0])!==s.some(t=>R(t))||s.map(Number).includes(+n[0])||s.unshift(n[0]),this._d3ScaleNegative&&R(n[a?0:1])!==s.some(t=>R(t))||s.map(Number).includes(+n[1])||s.push(n[1]),"time"===this._scale&&this._data.length){let i=this._data.map(Number);s=s.filter(t=>i.includes(+t))}return s}class o extends h{
|
|
1166
1166
|
/**
|
|
1167
1167
|
@memberof Axis
|
|
1168
1168
|
@desc Sets positioning for the axis bar.
|
|
1169
1169
|
@param {D3Selection} *bar*
|
|
1170
1170
|
@private
|
|
1171
|
-
*/_barPosition(t){var{height:i,x:e,y:s,opposite:h}=this._position,h=this._margin[h],i=["top","left"].includes(this._orient)?this._outerBounds[s]+this._outerBounds[i]-h:this._outerBounds[s]+h,h="band"===this._scale?this._d3Scale.step()-this._d3Scale.bandwidth():"point"===this._scale?this._d3Scale.step()*this._d3Scale.padding():0,n="band"===this._scale?this._d3Scale.step():"point"===this._scale?this._d3Scale.step()*this._d3Scale.padding():0,
|
|
1171
|
+
*/_barPosition(t){var{height:i,x:e,y:s,opposite:h}=this._position,h=this._margin[h],i=["top","left"].includes(this._orient)?this._outerBounds[s]+this._outerBounds[i]-h:this._outerBounds[s]+h,h="band"===this._scale?this._d3Scale.step()-this._d3Scale.bandwidth():"point"===this._scale?this._d3Scale.step()*this._d3Scale.padding():0,n="band"===this._scale?this._d3Scale.step():"point"===this._scale?this._d3Scale.step()*this._d3Scale.padding():0,a=(this._d3ScaleNegative?this._d3ScaleNegative.domain():[]).concat(this._d3Scale?this._d3Scale.domain():[]).sort((t,i)=>t-i);t.call(Pt.attrize,this._barConfig).attr(e+"1",this._getPosition(a[0])-h).attr(e+"2",this._getPosition(a[a.length-1])+n).attr(s+"1",i).attr(s+"2",i)}
|
|
1172
1172
|
/**
|
|
1173
1173
|
@memberof Axis
|
|
1174
1174
|
@desc Returns the scale's domain, taking into account negative and positive log scales.
|
|
@@ -1204,7 +1204,7 @@ t.includes(-i)&&t.includes(i)&&t.splice(t.indexOf(-i),1)}return t}
|
|
|
1204
1204
|
@desc Sets positioning for the grid lines.
|
|
1205
1205
|
@param {D3Selection} *lines*
|
|
1206
1206
|
@private
|
|
1207
|
-
*/_gridPosition(t,i=!1){let{height:e,x:s,y:h,opposite:n}=this._position,
|
|
1207
|
+
*/_gridPosition(t,i=!1){let{height:e,x:s,y:h,opposite:n}=this._position,a=this._margin[n],r=["top","left"].includes(this._orient)?this._outerBounds[h]+this._outerBounds[e]-a:this._outerBounds[h]+a,o=i&&this._lastScale||this._getPosition.bind(this),l=["top","left"].includes(this._orient)?a:-a,_="band"===this._scale?this._d3Scale.bandwidth()/2:0,d=t=>o(t.id)+_;t.call(Pt.attrize,this._gridConfig).attr(s+"1",d).attr(s+"2",d).attr(h+"1",r).attr(h+"2",i?r:r+l)}
|
|
1208
1208
|
/**
|
|
1209
1209
|
@memberof Axis
|
|
1210
1210
|
@desc Renders the current Axis to the page. If a *callback* is specified, it will be called once the legend is done drawing.
|
|
@@ -1214,11 +1214,11 @@ t.includes(-i)&&t.includes(i)&&t.splice(t.indexOf(-i),1)}return t}
|
|
|
1214
1214
|
/**
|
|
1215
1215
|
* Creates an SVG element to contain the axis if none
|
|
1216
1216
|
* has been specified using the "select" method.
|
|
1217
|
-
*/void 0===this._select&&this.select(j.select("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node());let n=this._timeLocale||$.locale[this._locale]||$.locale["en-US"],{width:i,height:_,x:d,y:g,horizontal:c,opposite:u}=(N.timeFormatDefaultLocale(n).format(),this._position),e="d3plus-Axis-clip-"+this._uuid,p=["top","left"].includes(this._orient),f=this._padding,s=this._select,m=[f,this["_"+i]-f],h=I.transition().duration(this._duration),
|
|
1217
|
+
*/void 0===this._select&&this.select(j.select("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node());let n=this._timeLocale||$.locale[this._locale]||$.locale["en-US"],{width:i,height:_,x:d,y:g,horizontal:c,opposite:u}=(N.timeFormatDefaultLocale(n).format(),this._position),e="d3plus-Axis-clip-"+this._uuid,p=["top","left"].includes(this._orient),f=this._padding,s=this._select,m=[f,this["_"+i]-f],h=I.transition().duration(this._duration),a="Circle"===this._shape?this._shapeConfig.r:"Rect"===this._shape?this._shapeConfig[i]:this._shapeConfig.strokeWidth,y="function"!=typeof a?()=>a:a,x=this._margin={top:0,right:0,bottom:0,left:0},b,v,C,w=this._tickFormat||(t=>{var i,e,s,h;return isNaN(t)||["band","ordinal","point"].includes(this._scale)?t:"time"===this._scale?(h=(this._data.length?this._data:this._domain).map(Pt.date).sort((t,i)=>+t-+i),Tt.formatDate(t,h,N.timeFormat).replace(/^Q/g,n.quarter)):"linear"===this._scale&&"smallest"===this._tickSuffix?({separator:e,suffixes:s}=h="object"==typeof this._locale?this._locale:$.formatLocale[this._locale],s=1e3<=t?s[this._tickUnit+8]:"",i=t/Math.pow(10,3*this._tickUnit),""+Tt.formatAbbreviate(i,h,`,.${i.toString().length}r`)+e+s):(i=(h=C[1]<C[0])?C.length-1:0,e=h?0:C.length-1,s="inside"===this._rounding?C.indexOf(t)===i?this._roundingInsideMinPrefix:C.indexOf(t)===e?this._roundingInsideMaxPrefix:"":"",h="inside"===this._rounding?C.indexOf(t)===i?this._roundingInsideMinSuffix:C.indexOf(t)===e?this._roundingInsideMaxSuffix:"":"",""+s+Tt.formatAbbreviate(t,this._locale)+h)});
|
|
1218
1218
|
/**
|
|
1219
1219
|
* (Re)calculates the internal d3 scale
|
|
1220
1220
|
* @param {} newRange
|
|
1221
|
-
*/function
|
|
1221
|
+
*/function r(s=this._range){
|
|
1222
1222
|
/**
|
|
1223
1223
|
* Calculates the internal "range" array to use, including
|
|
1224
1224
|
* fallbacks if not specified with the "range" method.
|
|
@@ -1239,13 +1239,13 @@ t.includes(-i)&&t.includes(i)&&t.splice(t.indexOf(-i),1)}return t}
|
|
|
1239
1239
|
/**
|
|
1240
1240
|
* Sets up the initial d3 scale, using this._domain and the
|
|
1241
1241
|
* previously defined range variable.
|
|
1242
|
-
*/var s="scale"+this._scale.charAt(0).toUpperCase()+this._scale.slice(1);let h=this._domain.slice();if(this._d3Scale=$t[s]().domain("time"===this._scale?h.map(Pt.date):h).range(v),"none"!==this._rounding&&(s=()=>{var t=t=>{if(e){if(!t)return 0;var i=(""+t).match(/0\.(0*)/);if(i)return+`0.${Array(i[1].length+1).fill(0).join("")}1`}return(""+Math.round(Math.abs(t))).length};let e=h.every(t=>Math.abs(t)<1);var t=[t(h[0]),t(h[1])].filter(Boolean).sort(),i=h.some(t=>R(t))&&h.some(t=>0<t),i=1===t.length?t[0]:1<t[0]&&t[0]===t[1]?t[0]-1:"outside"!==this._rounding&&i?Dt.max(t):t[0]+(t[1]-t[0])/2;let s=i<1?tt(i):+("1"+Array(Math.floor(tt(i))-1).fill(0).join(""));s>=Math.abs(h[1]-h[0])&&(s/=2);t=h[1]<h[0],i=[Math["outside"===this._rounding?t?"ceil":"floor":t?"floor":"ceil"](h[0]/s)*s,Math["outside"===this._rounding?t?"floor":"ceil":t?"ceil":"floor"](h[1]/s)*s];"log"===this._scale&&(0===i[0]&&(i[0]=h[0]),0===i[1])&&(i[1]=h[1]),this._d3Scale.domain(i.map(tt))},"linear"===this._scale?s.bind(this)():"log"===this._scale&&(
|
|
1242
|
+
*/var s="scale"+this._scale.charAt(0).toUpperCase()+this._scale.slice(1);let h=this._domain.slice();if(this._d3Scale=$t[s]().domain("time"===this._scale?h.map(Pt.date):h).range(v),"none"!==this._rounding&&(s=()=>{var t=t=>{if(e){if(!t)return 0;var i=(""+t).match(/0\.(0*)/);if(i)return+`0.${Array(i[1].length+1).fill(0).join("")}1`}return(""+Math.round(Math.abs(t))).length};let e=h.every(t=>Math.abs(t)<1);var t=[t(h[0]),t(h[1])].filter(Boolean).sort(),i=h.some(t=>R(t))&&h.some(t=>0<t),i=1===t.length?t[0]:1<t[0]&&t[0]===t[1]?t[0]-1:"outside"!==this._rounding&&i?Dt.max(t):t[0]+(t[1]-t[0])/2;let s=i<1?tt(i):+("1"+Array(Math.floor(tt(i))-1).fill(0).join(""));s>=Math.abs(h[1]-h[0])&&(s/=2);t=h[1]<h[0],i=[Math["outside"===this._rounding?t?"ceil":"floor":t?"floor":"ceil"](h[0]/s)*s,Math["outside"===this._rounding?t?"floor":"ceil":t?"ceil":"floor"](h[1]/s)*s];"log"===this._scale&&(0===i[0]&&(i[0]=h[0]),0===i[1])&&(i[1]=h[1]),this._d3Scale.domain(i.map(tt))},"linear"===this._scale?s.bind(this)():"log"===this._scale&&(r=[],a=h[1]<h[0],r[0]=("outside"===this._rounding?R(h[0])?a?F:W:a?W:F:R(h[0])?a?W:F:a?F:W)(h[0]),r[1]=("inside"===this._rounding?R(h[1])?a?F:W:a?W:F:R(h[1])?a?W:F:a?F:W)(h[1]),n=r[1]<r[0],r[0]!==r[1]&&r.some(t=>10<Math.abs(t))&&n==a?this._d3Scale.domain(r):s.bind(this)())),this._d3Scale.padding&&this._d3Scale.padding(this._scalePadding),this._d3Scale.paddingInner&&this._d3Scale.paddingInner(this._paddingInner),this._d3Scale.paddingOuter&&this._d3Scale.paddingOuter(this._paddingOuter)
|
|
1243
1243
|
/**
|
|
1244
1244
|
* Constructs a separate "negative only" scale for logarithmic
|
|
1245
1245
|
* domains, as they cannot pass zero.
|
|
1246
|
-
*/,this._d3ScaleNegative=null,"log"===this._scale){var n=this._d3Scale.domain();0===n[0]?(
|
|
1246
|
+
*/,this._d3ScaleNegative=null,"log"===this._scale){var n=this._d3Scale.domain();0===n[0]?(a=Dt.min([Dt.min(this._data),Math.abs(n[1])]),n[0]=0===a||1===a?1e-6:a<=1?F(a):1,R(n[1])&&(n[0]*=-1)):0===n[n.length-1]&&(r=Dt.min([Dt.min(this._data),Math.abs(n[0])]),n[n.length-1]=0===r||1===r?1e-6:r<=1?F(r):1,R(n[0]))&&(n[n.length-1]*=-1);let e=this._d3Scale.range();
|
|
1247
1247
|
// all negatives
|
|
1248
|
-
if(R(n[0])&&R(n[n.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(n).range(e),this._d3Scale=null;else if(0<n[0]&&0<n[n.length-1])this._d3Scale.domain(n).range(e);else{var s=n.map(t=>Math.log10(Math.abs(t))).map(t=>t||-1e-6),
|
|
1248
|
+
if(R(n[0])&&R(n[n.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(n).range(e),this._d3Scale=null;else if(0<n[0]&&0<n[n.length-1])this._d3Scale.domain(n).range(e);else{var s=n.map(t=>Math.log10(Math.abs(t))).map(t=>t||-1e-6),a=s[0]/Dt.sum(s)*(e[1]-e[0]);let t=Dt.min([Dt.min(this._data.filter(t=>0<=t)),Math.abs(n[1])]),i=(1===t&&(t=1e-6),Dt.min([Dt.min(this._data.filter(R)),Math.abs(n[0])]));1===i&&(i=1e-6);var r=0===t?1e-6:t<=1?F(t):1,s=0===i?-1e-6:i<=1?F(i):1,r=Dt.min([Math.abs(r),Math.abs(s)]);this._d3ScaleNegative=this._d3Scale.copy(),(R(n[0])?this._d3Scale:this._d3ScaleNegative).domain([R(n[0])?r:-r,n[1]]).range([e[0]+a,e[1]]),(R(n[0])?this._d3ScaleNegative:this._d3Scale).domain([n[0],R(n[0])?-r:r]).range([e[0],e[0]+a])}}
|
|
1249
1249
|
/**
|
|
1250
1250
|
* Determines the of values array to use
|
|
1251
1251
|
* for the "ticks" and the "labels"
|
|
@@ -1255,7 +1255,7 @@ if(R(n[0])&&R(n[n.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(n
|
|
|
1255
1255
|
*/if(C=(this._ticks?"time"===this._scale?this._ticks.map(Pt.date):this._ticks:(this._d3Scale||this._d3ScaleNegative).ticks?this._getTicks():this._domain).slice(),b=(this._labels?"time"===this._scale?this._labels.map(Pt.date):this._labels:(this._d3Scale||this._d3ScaleNegative).ticks?this._getLabels():C).slice(),"time"===this._scale&&(C=C.map(Number),b=b.map(Number)),C=C.sort((t,i)=>this._getPosition(t)-this._getPosition(i)),b=b.sort((t,i)=>this._getPosition(t)-this._getPosition(i)),"linear"===this._scale&&"smallest"===this._tickSuffix){s=b.filter(t=>1e3<=t);if(0<s.length){var o=Math.min(...s);let t=1;for(;t&&t<7;){if(!(1<=o/Math.pow(10,3*t)))break;this._tickUnit=t,t+=1}}}
|
|
1256
1256
|
/**
|
|
1257
1257
|
* Removes ticks when they overlap other ticks.
|
|
1258
|
-
*/let l=[];(this._availableTicks=C).forEach((t,i)=>{let e=y({id:t,tick:!0},i);"Circle"===this._shape&&(e*=2);i=this._getPosition(t);!l.length||Math.abs(E.closest(i,l)-i)>2*e?l.push(i):l.push(!1)}),C=C.filter((t,i)=>!1!==l[i]),this._visibleTicks=C}
|
|
1258
|
+
*/let l=[];(this._availableTicks=C).forEach((t,i)=>{let e=y({id:t,tick:!0},i);"Circle"===this._shape&&(e*=2);i=this._getPosition(t);!l.length||Math.abs(E.closest(i,l)-i)>2*e?l.push(i):l.push(!1)}),C=C.filter((t,i)=>!1!==l[i]),this._visibleTicks=C}r.bind(this)(),
|
|
1259
1259
|
/**
|
|
1260
1260
|
* Pre-calculates the size of the title, if defined, in order
|
|
1261
1261
|
* to adjust the internal margins.
|
|
@@ -1263,16 +1263,16 @@ if(R(n[0])&&R(n[n.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(n
|
|
|
1263
1263
|
/**
|
|
1264
1264
|
* Calculates the text wrapping and size of a given textData object.
|
|
1265
1265
|
* @param {Object} datum
|
|
1266
|
-
*/;let S=[];function l(t=1){let
|
|
1266
|
+
*/;let S=[];function l(t=1){let a=this._shapeConfig.labelConfig.fontSize,r=this._shapeConfig.labelConfig.fontFamily||H.fontFamily,o=this._shapeConfig.labelConfig.padding,e=(
|
|
1267
1267
|
/**
|
|
1268
1268
|
* Calculates the space each label would take up, given
|
|
1269
1269
|
* the provided this._space size.
|
|
1270
|
-
*/S=b.map((t,i)=>{var e="function"==typeof
|
|
1270
|
+
*/S=b.map((t,i)=>{var e="function"==typeof r?r(t,i):r,s="function"==typeof o?o(t,i):o,h="function"==typeof a?a(t,i):a,n=this._getPosition(t);return{d:t,i:i,fF:e,fP:s,fS:h,lineHeight:this._shapeConfig.lineHeight?this._shapeConfig.lineHeight(t,i):1.4*h,position:n,rotate:this._labelRotation}}),"band"===this._scale?this._d3Scale.bandwidth():S.reduce((t,i,e)=>{var i=i.position,s=e?i-(i-S[e-1].position):1===S.length?m[0]:i-(S[e+1].position-i),s=Math.abs(i-s),e=e==S.length-1?1===S.length?m[1]:i+(i-S[e-1].position):i-(i-S[e+1].position),i=Math.abs(i-e),e="point"===this._scale?1:2;return Dt.max([Dt.max([s,i])*e,t])},0)),l=(S=S.map(t=>{t.space=e-2*t.fP;var i=function(t){var{d:t,i,fF:e,fP:s,fS:h,rotate:n,space:a}=t,r=n?"width":"height",n=n?"height":"width",o=Dt.min([this._maxSize,this._width]),l=Dt.min([this._maxSize,this._height]);return(e=H.textWrap().fontFamily(e).fontSize(h).lineHeight(this._shapeConfig.lineHeight?this._shapeConfig.lineHeight(t,i):void 0))[n](c?a:o-k-f-this._margin.left-this._margin.right),e[r](c?l-k-f-this._margin.top-this._margin.bottom:a),(h=e(w(t))).lines=h.lines.filter(t=>""!==t),h.width=h.lines.length?Math.ceil(Dt.max(h.widths)):0,h.height=h.lines.length?Math.ceil(h.lines.length*e.lineHeight())+s:0,h}
|
|
1271
1271
|
/** Calculates label offsets */.bind(this)(t);return Object.assign(i,t)})).slice().reverse();S.forEach(t=>{let{fP:i,i:e,position:s}=t;var h=c?"width":"height";let n=!!e&&l.find(t=>t.i<e&&!t.truncated);if(e===S.length-1)for(;n&&s-t[h]/2-i<n.position+n[h]/2;)n.truncated=!0,n=l.find(t=>t.i<e&&!t.truncated);t.truncated=!!n&&s-t[h]/2-i<n.position+n[h]/2}),1<t&&function(h=[]){let n=0;h.forEach(t=>{var i=h[t.i-1],e=t.rotate&&c||!t.rotate&&!c?"width":"height",s=t.rotate&&c||!t.rotate&&!c?"height":"width";i?i.position+i[s]/2>t.position-t[s]/2&&(n=n?(t.offset=i[e],0):1):n=1})}.bind(this)(S)}l.bind(this)();var z=this._labelOffset&&S.some(t=>t.truncated),M=(z&&l.bind(this)(2)
|
|
1272
1272
|
/**
|
|
1273
1273
|
* "spillover" will contain the pixel spillover of the first and last label,
|
|
1274
1274
|
* and then adjust the scale range accordingly.
|
|
1275
|
-
*/,[0,1].map(t=>{var i,e,s,h=S[t?S.length-1:0];return!h||({height:h,position:i,rotate:s,width:e}=h,t=t?m[1]:m[0],s=(s||!c?h:e)/2,Math.abs(i-t)>=s)?0:Math.abs(s-(i-t))})),[A,B]=v,M=[A+M[0],B-M[1]];this._range&&(void 0!==this._range[0]&&(M[0]=this._range[0]),void 0!==this._range[this._range.length-1])&&(M[1]=this._range[this._range.length-1]),M[0]===A&&M[1]===B||(
|
|
1275
|
+
*/,[0,1].map(t=>{var i,e,s,h=S[t?S.length-1:0];return!h||({height:h,position:i,rotate:s,width:e}=h,t=t?m[1]:m[0],s=(s||!c?h:e)/2,Math.abs(i-t)>=s)?0:Math.abs(s-(i-t))})),[A,B]=v,M=[A+M[0],B-M[1]];this._range&&(void 0!==this._range[0]&&(M[0]=this._range[0]),void 0!==this._range[this._range.length-1])&&(M[1]=this._range[this._range.length-1]),M[0]===A&&M[1]===B||(r.bind(this)(M),l.bind(this)(z?2:1));let P=Dt.max(S,t=>t.height)||0,D=(this._labelRotation=c&&void 0===this._labelRotation?S.some(t=>{var{i:t,height:i,position:e,truncated:s}=t,h=S[t-1];return s||t&&h.position+h.height/2>e-i/2}):this._labelRotation,this._labelOffset?Dt.max(S,t=>t.offset||0):0);S.forEach(t=>t.offset=t.offset?D:0);A="Line"===this._shape?0:k;let O=this._outerBounds={[_]:(Dt.max(S,t=>Math.ceil(t[t.rotate||!c?"width":"height"]+t.offset))||0)+(S.length?f:0),[i]:m[m.length-1]-m[0],[d]:m[0]};O[_]=Dt.max([this._minSize,O[_]]),x[this._orient]+=k,x[u]=void 0!==this._gridSize?Dt.max([this._gridSize,A]):this["_"+_]-x[this._orient]-O[_]-f,O[_]+=x[u]+x[this._orient],O[g]="start"===this._align?this._padding:"end"===this._align?this["_"+_]-O[_]-this._padding:this["_"+_]/2-O[_]/2;B=Pt.elem("g#d3plus-Axis-"+this._uuid,{parent:s}),this._group=B,M=Pt.elem("g.grid",{parent:B}).selectAll("line").data((0!==this._gridSize?this._grid||"log"===this._scale&&!this._gridLog?b:C:[]).map(t=>({id:t})),t=>t.id),M.exit().transition(h).attr("opacity",0).call(this._gridPosition.bind(this)).remove(),M.enter().append("line").attr("opacity",0).attr("clip-path",`url(#${e})`).call(this._gridPosition.bind(this),!0).merge(M).transition(h).attr("opacity",1).call(this._gridPosition.bind(this)),z=b.filter((t,i)=>S[i].lines.length&&!C.includes(t));let L=S.some(t=>t.rotate),T=C.concat(z).map(i=>{var t=S.find(t=>t.d===i),e=this._getPosition(i),s=t?t.space:0,h=t?t.lines.length:1,n=t?t.lineHeight:1,a=t?t.fP:0,r=t&&this._labelOffset?t.offset:0,o=c?s:O.width-x[this._position.opposite]-k-x[this._orient]+f,l=x[u],r=(k+r)*(p?-1:1),l=p?O[g]+O[_]-l:O[g]+l;return{id:i,labelBounds:L&&t?{x:-t.width/2+t.fS/4,y:"bottom"===this._orient?r+(t.width-n*h)/2+a:2*r-(t.width+n*h)/2+a,width:t.width,height:t.height}:{x:c?-s/2:"left"===this._orient?-o-f+r:r+f,y:c?"bottom"===this._orient?r+a:r-P-a:-s/2,width:c?s:o,height:c?P:s},rotate:!!t&&t.rotate,size:b.includes(i)||"log"===this._scale&&Math.log10(Math.abs(i))%1==0?r:C.includes(i)?Math.ceil(r/2):this._data.find(t=>+t===i)?Math.ceil(r/4):0,text:!((t||{}).truncated||!b.includes(i))&&w(i),tick:C.includes(i),[d]:e+("band"===this._scale?this._d3Scale.bandwidth()/2:0),[g]:l}});"Line"===this._shape&&(T=T.concat(T.map(t=>{var i=Object.assign({},t);return i[g]+=t.size,i}))),(new Wt[this._shape]).data(T).duration(this._duration).labelConfig({ellipsis:t=>t&&t.length?t+"...":"",rotate:t=>t.rotate?-90:0}).select(Pt.elem("g.ticks",{parent:B}).node()).config(jt.bind(this)(this._shapeConfig)).labelConfig({padding:0}).render();A=B.selectAll("line.bar").data([null]);return A.enter().append("line").attr("class","bar").attr("opacity",0).call(this._barPosition.bind(this)).merge(A).transition(h).attr("opacity",1).call(this._barPosition.bind(this)),this._titleClass.data(this._title?[{text:this._title}]:[]).duration(this._duration).height(x[this._orient]).rotate("left"===this._orient?-90:"right"===this._orient?90:0).select(Pt.elem("g.d3plus-Axis-title",{parent:B}).node()).text(t=>t.text).verticalAlign("middle").width(v[v.length-1]-v[0]).x(c?v[0]:"left"===this._orient?O.x+x.left/2-(v[v.length-1]-v[0])/2:O.x+O.width-x.right/2-(v[v.length-1]-v[0])/2).y(c?"bottom"===this._orient?O.y+O.height-x.bottom:O.y:v[0]+(v[v.length-1]-v[0])/2-x[this._orient]/2).config(jt.bind(this)(this._titleConfig)).render(),this._lastScale=this._getPosition.bind(this),t&&setTimeout(t,this._duration+100),this}
|
|
1276
1276
|
/**
|
|
1277
1277
|
@memberof Axis
|
|
1278
1278
|
@desc If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance.
|
|
@@ -1531,7 +1531,7 @@ if(R(n[0])&&R(n[n.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(n
|
|
|
1531
1531
|
@memberof AxisTop
|
|
1532
1532
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
1533
1533
|
@private
|
|
1534
|
-
*/constructor(){super(),this.orient("top")}}class
|
|
1534
|
+
*/constructor(){super(),this.orient("top")}}class at extends h{_fetchConfig(t,i,e){var s=(void 0!==this._shapeConfig[t]?this._shapeConfig:this._shapeConfig.labelConfig)[t];return s||"lineHeight"!==t?"function"==typeof s?s(i,e):s:1.4*this._fetchConfig("fontSize",i,e)}_rowHeight(t){return Dt.max(t.map(t=>t.height).concat(t.map(t=>t.shapeHeight)))+this._padding}_rowWidth(e){return Dt.sum(e.map((t,i)=>{i=this._padding*(i===e.length-1?0:t.width?2:1);return t.shapeWidth+t.width+i}))}
|
|
1535
1535
|
/**
|
|
1536
1536
|
@memberof Legend
|
|
1537
1537
|
@desc Renders the current Legend to the page. If a *callback* is specified, it will be called once the legend is done drawing.
|
|
@@ -1541,9 +1541,9 @@ if(R(n[0])&&R(n[n.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain(n
|
|
|
1541
1541
|
// Legend Container <g> Groups
|
|
1542
1542
|
this._group=Pt.elem("g.d3plus-Legend",{parent:this._select}),this._titleGroup=Pt.elem("g.d3plus-Legend-title",{parent:this._group}),this._shapeGroup=Pt.elem("g.d3plus-Legend-shape",{parent:this._group});let l=this._height;if(this._titleHeight=0,this._titleWidth=0,this._title){var i=this._titleConfig.fontFamily||this._titleClass.fontFamily()(),e=this._titleConfig.fontSize||this._titleClass.fontSize()();let t=this._titleConfig.lineHeight||this._titleClass.lineHeight();t=t?t():1.4*e;i=H.textWrap().fontFamily(i).fontSize(e).lineHeight(t).width(this._width).height(this._height)(this._title);this._titleHeight=t+i.lines.length+this._padding,this._titleWidth=Dt.max(i.widths),l-=this._titleHeight}
|
|
1543
1543
|
// Calculate Text Sizes
|
|
1544
|
-
this._lineData=this._data.map((s,h)=>{var n=this._label(s,h),
|
|
1544
|
+
this._lineData=this._data.map((s,h)=>{var n=this._label(s,h),a=this._shape(s,h),r=this._fetchConfig("r",s,h);let o={data:s,i:h,id:this._id(s,h),shape:a,shapeR:r,shapeWidth:"Circle"===a?2*r:this._fetchConfig("width",s,h),shapeHeight:"Circle"===a?2*r:this._fetchConfig("height",s,h),y:0};if(n){let i=this._fetchConfig("fontFamily",s,h),t=this._fetchConfig("lineHeight",s,h),e=this._fetchConfig("fontSize",s,h);a=l-(this._data.length+1)*this._padding,r=this._width,s=H.textWrap().fontFamily(i).fontSize(e).lineHeight(t).width(r).height(a)(n);(o=Object.assign(o,s)).width=Math.ceil(Dt.max(o.lines.map(t=>Pt.textWidth(t,{"font-family":i,"font-size":e}))))+10,o.height=Math.ceil(o.lines.length*(t+1)),o.og={height:o.height,width:o.width},o.f=i,o.s=e,o.lh=t}else o.sentence=!1,o.words=[],o.height=0,o.width=0;return o});let s,o=this._width-2*this._padding;if(s=this._rowWidth(this._lineData),"column"===this._direction||s>o){let a=1,r=[],t=Dt.max(this._lineData.map(t=>t.words.length));if(this._wrapLines=function(){if(!(++a>t)){var s=1===a?this._lineData.slice():this._lineData.filter(t=>t.width+t.shapeWidth+this._padding*(t.width?2:1)>o&&t.words.length>=a).sort((t,i)=>i.sentence.length-t.sentence.length);if(s.length&&l>s[0].height*a){let e=!1;for(let t=0;t<s.length;t++){let i=s[t];var h=i.og.height*a,n=i.og.width*(1/a*1.5),n=H.textWrap().fontFamily(i.f).fontSize(i.s).lineHeight(i.lh).width(n).height(h)(i.sentence);if(n.truncated){e=!0;break}i.width=Math.ceil(Dt.max(n.lines.map(t=>Pt.textWidth(t,{"font-family":i.f,"font-size":i.s}))))+i.s,i.height=n.lines.length*(i.lh+1)}e||this._wrapRows()}else r=[]}},this._wrapRows=function(){r=[];let i=1,e=0;for(let t=0;t<this._lineData.length;t++){var s=this._lineData[t],h=s.width+this._padding*(s.width?2:1)+s.shapeWidth;if(Dt.sum(r.map(t=>Dt.max(t,t=>Dt.max([t.height,t.shapeHeight]))))>l){r=[];break}if(h>o){r=[],this._wrapLines();break}e+h<o?e+=h:"column"!==this._direction&&(e=h,i++),r[i-1]||(r[i-1]=[]),r[i-1].push(s),"column"===this._direction&&(e=0,i++)}},this._wrapRows(),!r.length||Dt.sum(r,this._rowHeight.bind(this))+this._padding>l){s=Dt.sum(this._lineData.map(t=>t.shapeWidth+this._padding))-this._padding;for(let t=0;t<this._lineData.length;t++)this._lineData[t].width=0,this._lineData[t].height=0;this._wrapRows()}r.length&&Dt.sum(r,this._rowHeight.bind(this))+this._padding<l&&(r.forEach((t,i)=>{t.forEach(t=>{i&&(t.y=Dt.sum(r.slice(0,i),this._rowHeight.bind(this)))})}),s=Dt.max(r,this._rowWidth.bind(this)))}e=Dt.max(this._lineData,(t,i)=>Dt.max([t.height,this._fetchConfig("height",t.data,i)])+t.y)+this._titleHeight,i=Dt.max([s,this._titleWidth]);this._outerBounds.width=i,this._outerBounds.height=e;let h=this._padding,n=this._padding,a=("center"===this._align?h=(this._width-i)/2:"right"===this._align&&(h=this._width-this._padding-i),"middle"===this._verticalAlign?n=(this._height-e)/2:"bottom"===this._verticalAlign&&(n=this._height-this._padding-e),this._outerBounds.x=h,this._outerBounds.y=n,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-2*this._padding).x(this._padding).y(this._outerBounds.y).config(this._titleConfig).render(),this._shapes=[],jt.bind(this)(this._shapeConfig,"legend")),r={id:t=>t.id,label:t=>t.label,lineHeight:t=>t.lH},_=this._data.map((t,i)=>({__d3plus__:!0,data:t,i:i,id:this._id(t,i),label:!!this._lineData[i].width&&this._label(t,i),lH:this._fetchConfig("lineHeight",t,i),shape:this._shape(t,i)}));
|
|
1545
1545
|
// Legend Shapes
|
|
1546
|
-
return this._shapes=[],["Circle","Rect"].forEach(i=>{this._shapes.push((new Wt[i]).parent(this).data(_.filter(t=>t.shape===i)).duration(this._duration).labelConfig({padding:0}).select(this._shapeGroup.node()).verticalAlign("top").config(Pt.assign({},r
|
|
1546
|
+
return this._shapes=[],["Circle","Rect"].forEach(i=>{this._shapes.push((new Wt[i]).parent(this).data(_.filter(t=>t.shape===i)).duration(this._duration).labelConfig({padding:0}).select(this._shapeGroup.node()).verticalAlign("top").config(Pt.assign({},a,r)).render())}),t&&setTimeout(t,this._duration+100),this}
|
|
1547
1547
|
/**
|
|
1548
1548
|
@memberof Legend
|
|
1549
1549
|
@desc 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.
|
|
@@ -1660,15 +1660,15 @@ return this._shapes=[],["Circle","Rect"].forEach(i=>{this._shapes.push((new Wt[i
|
|
|
1660
1660
|
@memberof Legend
|
|
1661
1661
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
1662
1662
|
@private
|
|
1663
|
-
*/constructor(){super(),this._titleClass=new l,this._align="center",this._data=[],this._direction="row",this._duration=600,this._height=200,this._id=s("id"),this._label=s("id"),this._lineData=[],this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._shape=Ht("Rect"),this._shapes=[],this._shapeConfig={fill:s("color"),height:Ht(12),hitArea:(t,i)=>{var i=this._lineData[i],e=Dt.max([i.height,i.shapeHeight]);return{width:i.width+i.shapeWidth,height:e,x:-i.shapeWidth/2,y:-e/2}},labelBounds:(t,i)=>{i=this._lineData[i];let e=i.shapeWidth/2;"Circle"===i.shape&&(e-=i.shapeR/2);var s=Dt.max([i.shapeHeight,i.height]),h=this._rtl?i.shapeWidth+i.width+2*this._padding:0;return{width:i.width,height:s,x:e+5-h,y:-s/2}},labelConfig:{fontColor:Ht(A.colorDefaults.dark),fontFamily:this._titleClass.fontFamily(),fontResize:!1,fontSize:Ht(10),verticalAlign:"middle"},opacity:1,r:Ht(6),width:Ht(12),x:(t,i)=>{var e=this._lineData[i];let s=e.y;var h="left"===this._align||"right"===this._align&&"column"===this._direction?0:"center"===this._align?(this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)))/2:this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)),i=this._lineData.slice(0,i).filter(t=>s===t.y),n=this._rtl?e.width+this._padding:0;return this._rowWidth(i)+this._padding*(i.length?e.sentence?2:1:0)+this._outerBounds.x+e.shapeWidth/2+h+n},y:(t,i)=>{let e=this._lineData[i];return e.y+this._titleHeight+this._outerBounds.y+Dt.max(this._lineData.filter(t=>e.y===t.y).map(t=>t.height).concat(this._data.map((t,i)=>this._fetchConfig("height",t,i))))/2}},this._titleConfig={fontSize:12},this._verticalAlign="middle",this._width=400}}class
|
|
1663
|
+
*/constructor(){super(),this._titleClass=new l,this._align="center",this._data=[],this._direction="row",this._duration=600,this._height=200,this._id=s("id"),this._label=s("id"),this._lineData=[],this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._shape=Ht("Rect"),this._shapes=[],this._shapeConfig={fill:s("color"),height:Ht(12),hitArea:(t,i)=>{var i=this._lineData[i],e=Dt.max([i.height,i.shapeHeight]);return{width:i.width+i.shapeWidth,height:e,x:-i.shapeWidth/2,y:-e/2}},labelBounds:(t,i)=>{i=this._lineData[i];let e=i.shapeWidth/2;"Circle"===i.shape&&(e-=i.shapeR/2);var s=Dt.max([i.shapeHeight,i.height]),h=this._rtl?i.shapeWidth+i.width+2*this._padding:0;return{width:i.width,height:s,x:e+5-h,y:-s/2}},labelConfig:{fontColor:Ht(A.colorDefaults.dark),fontFamily:this._titleClass.fontFamily(),fontResize:!1,fontSize:Ht(10),verticalAlign:"middle"},opacity:1,r:Ht(6),width:Ht(12),x:(t,i)=>{var e=this._lineData[i];let s=e.y;var h="left"===this._align||"right"===this._align&&"column"===this._direction?0:"center"===this._align?(this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)))/2:this._outerBounds.width-this._rowWidth(this._lineData.filter(t=>s===t.y)),i=this._lineData.slice(0,i).filter(t=>s===t.y),n=this._rtl?e.width+this._padding:0;return this._rowWidth(i)+this._padding*(i.length?e.sentence?2:1:0)+this._outerBounds.x+e.shapeWidth/2+h+n},y:(t,i)=>{let e=this._lineData[i];return e.y+this._titleHeight+this._outerBounds.y+Dt.max(this._lineData.filter(t=>e.y===t.y).map(t=>t.height).concat(this._data.map((t,i)=>this._fetchConfig("height",t,i))))/2}},this._titleConfig={fontSize:12},this._verticalAlign="middle",this._width=400}}class rt extends h{
|
|
1664
1664
|
/**
|
|
1665
1665
|
@memberof ColorScale
|
|
1666
1666
|
@desc Renders the current ColorScale to the page. If a *callback* is specified, it will be called once the ColorScale is done drawing.
|
|
1667
1667
|
@param {Function} [*callback* = undefined]
|
|
1668
1668
|
@chainable
|
|
1669
|
-
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node());var
|
|
1669
|
+
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").attr("width",this._width+"px").attr("height",this._height+"px").node());var r=["bottom","top"].includes(this._orient),o=r?"height":"width",l=r?"width":"height",_=r?"x":"y",d=r?"y":"x";
|
|
1670
1670
|
// Shape <g> Group
|
|
1671
|
-
this._group=Pt.elem("g.d3plus-ColorScale",{parent:this._select});let s=this._data.map(this._value).filter(t=>null!==t&&"number"==typeof t).sort((t,i)=>t-i);var g=this._domain||Dt.extent(s);let i=g[0]<this._midpoint;var c=g[1]>this._midpoint,u=i&&c;let n=Dt.min([this._buckets instanceof Array?this._buckets.length:this._buckets,u&&"jenks"!==this._scale?2*Math.floor(Lt.unique(s).length/2)-1:Lt.unique(s).length]),p=u&&(!this._color||this._color instanceof Array&&!this._color.includes(this._colorMid))?void 0:this._color,f,m;if(!p||p instanceof Array||(p=Dt.range(0,n,1).map(t=>A.colorLighter(p,(t+1)/n)).reverse()),"jenks"===this._scale){var y=Dt.min([p?p.length:n,n,s.length]);let t=[];m=this._buckets instanceof Array?this._buckets:(t=u&&this._centered?(b=Math.floor(y/2),
|
|
1671
|
+
this._group=Pt.elem("g.d3plus-ColorScale",{parent:this._select});let s=this._data.map(this._value).filter(t=>null!==t&&"number"==typeof t).sort((t,i)=>t-i);var g=this._domain||Dt.extent(s);let i=g[0]<this._midpoint;var c=g[1]>this._midpoint,u=i&&c;let n=Dt.min([this._buckets instanceof Array?this._buckets.length:this._buckets,u&&"jenks"!==this._scale?2*Math.floor(Lt.unique(s).length/2)-1:Lt.unique(s).length]),p=u&&(!this._color||this._color instanceof Array&&!this._color.includes(this._colorMid))?void 0:this._color,f,m;if(!p||p instanceof Array||(p=Dt.range(0,n,1).map(t=>A.colorLighter(p,(t+1)/n)).reverse()),"jenks"===this._scale){var y=Dt.min([p?p.length:n,n,s.length]);let t=[];m=this._buckets instanceof Array?this._buckets:(t=u&&this._centered?(b=Math.floor(y/2),a=y%2,x=s.filter(t=>t<this._midpoint),k=Dt.deviation(x),C=s.concat(this._midpoint).filter(t=>t>=this._midpoint),v=k<(w=Dt.deviation(C))?1:0,w=E.ckmeans(x,Dt.min([b+a*(w<k?1:0),x.length])),k=E.ckmeans(C,Dt.min([b+a*v,C.length])),w.concat(k)):E.ckmeans(s,y)).map(t=>t[0]);var x=new Set(m);if(m.length!==x.size&&(f=Array.from(x)),!p)if(u){p=[this._colorMin,this._colorMid,this._colorMax];let e=m.slice(0,y).filter((t,i)=>t<this._midpoint&&m[i+1]<=this._midpoint);var b=m.slice(0,y).filter((t,i)=>t<=this._midpoint&&m[i+1]>this._midpoint);let s=m.slice(0,y).filter(t=>t>this._midpoint);var a=e.map((t,i)=>i?A.colorLighter(p[0],i/e.length):p[0]),v=b.map(()=>p[1]),C=s.map((t,i)=>i===s.length-1?p[2]:A.colorLighter(p[2],1-(i+1)/s.length));p=a.concat(v).concat(C)}else p=Dt.range(0,n,1).map(t=>A.colorLighter(this._colorMax,t/n)).reverse();p=[(p=m.length<=y?p.slice(-m.length):p)[0]].concat(p),this._colorScale=S.scaleThreshold().domain(m).range(p)}else{let h=this._buckets instanceof Array?this._buckets:void 0;if(u&&!p){let i=Math.floor(n/2),e=z.interpolateRgb.gamma(2.2)(this._colorMin,this._colorMid);var w=Dt.range(0,i,1).map(t=>e(t/i)),k=(n%2?[0]:[]).map(()=>this._colorMid);let s=z.interpolateRgb.gamma(2.2)(this._colorMax,this._colorMid);var x=Dt.range(0,i,1).map(t=>s(t/i)).reverse();p=w.concat(k).concat(x),h||(b=(p.length-1)/2,h=[g[0],this._midpoint,g[1]],h=Dt.range(g[0],this._midpoint,-(g[0]-this._midpoint)/b).concat(Dt.range(this._midpoint,g[1],(g[1]-this._midpoint)/b)).concat([g[1]]))}else p||("buckets"===this._scale||"quantile"===this._scale?(p=Dt.range(0,n,1).map(t=>A.colorLighter(i?this._colorMin:this._colorMax,t/n)),c&&(p=p.reverse())):p=i?[this._colorMin,A.colorLighter(this._colorMin,.8)]:[A.colorLighter(this._colorMax,.8),this._colorMax]),h=h||("quantile"===this._scale?(a=1/(p.length-1),Dt.range(0,1+a/2,a).map(t=>Dt.quantile(s,t))):u&&this._color&&this._centered?(v=p.indexOf(this._colorMid),C=(this._midpoint-g[0])/v,y=(g[1]-this._midpoint)/(p.length-v),w=Dt.range(g[0],this._midpoint,C),k=Dt.range(this._midpoint,g[1]+y/2,y),w.concat(k)):(x=(g[1]-g[0])/(p.length-1),Dt.range(g[0],g[1]+x/2,x)));if("buckets"===this._scale||"quantile"===this._scale)m=h,p=[p[0]].concat(p);else if("log"===this._scale){b=h.filter(t=>t<0);if(b.length){let i=b[0],e=b.map(t=>-Math.pow(Math.abs(i),t/i));b.forEach((t,i)=>{h[h.indexOf(t)]=e[i]})}c=h.filter(t=>0<t);if(c.length){let i=c[c.length-1],e=c.map(t=>Math.pow(i,t/i));c.forEach((t,i)=>{h[h.indexOf(t)]=e[i]})}h.includes(0)&&(h[h.indexOf(0)]=1)}this._colorScale=("buckets"===this._scale||"quantile"===this._scale?S.scaleThreshold:S.scaleLinear)().domain(h).range(p)}this._colorScale.clamp&&this._colorScale.clamp(!0);a=this._bucketAxis||!["buckets","jenks","quantile"].includes(this._scale),u=I.transition().duration(this._duration),v={enter:{opacity:0},exit:{opacity:0},parent:this._group,transition:u,update:{opacity:1}},C=Pt.elem("g.d3plus-ColorScale-labels",Object.assign({condition:a},v)),y=Pt.elem("g.d3plus-ColorScale-Rect",Object.assign({condition:a},v)),w=Pt.elem("g.d3plus-ColorScale-legend",Object.assign({condition:!a},v));if(a){k={x:0,y:0};let e=g.slice();this._bucketAxis&&(x=e[e.length-1],b=e[e.length-2],u=1<=(c=x?x/10:b/10)||c<=-1?Math.round(c).toString().length-1:-1*c.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,g=Math.pow(10,u),e[e.length-1]=x+g);b=Pt.assign({domain:r?e:e.slice().reverse(),duration:this._duration,height:this._height,labels:f||m,orient:this._orient,padding:this._padding,scale:"log"===this._scale?"log":"linear",ticks:m,width:this._width},this._axisConfig),c=Pt.assign({height:this["_"+o]/2,width:this["_"+l]/2},this._labelConfig),u=(this._labelClass.config(c),[]),x=(r&&this._labelMin&&((x={"font-family":this._labelClass.fontFamily()(this._labelMin),"font-size":this._labelClass.fontSize()(this._labelMin),"font-weight":this._labelClass.fontWeight()(this._labelMin)})["font-family"]instanceof Array&&(x["font-family"]=x["font-family"][0]),g=Pt.textWidth(this._labelMin,x))&&g<this["_"+l]/2&&(u.push(this._labelMin),g+=this._padding,r&&(k.x+=g),b[l]-=g),r&&this._labelMax&&((x={"font-family":this._labelClass.fontFamily()(this._labelMax),"font-size":this._labelClass.fontSize()(this._labelMax),"font-weight":this._labelClass.fontWeight()(this._labelMax)})["font-family"]instanceof Array&&(x["font-family"]=x["font-family"][0]),g=Pt.textWidth(this._labelMax,x))&&g<this["_"+l]/2&&(u.push(this._labelMax),g+=this._padding,r||(k.y+=g),b[l]-=g),this._axisTest.select(Pt.elem("g.d3plus-ColorScale-axisTest",{enter:{opacity:0},parent:this._group}).node()).config(b).duration(0).render(),this._axisTest.outerBounds()),g=(this._outerBounds[l]=this["_"+l]-2*this._padding,this._outerBounds[o]=x[o]+this._size,this._outerBounds[_]=this._padding,this._outerBounds[d]=this._padding,"middle"===this._align?this._outerBounds[d]=(this["_"+o]-this._outerBounds[o])/2:"end"===this._align&&(this._outerBounds[d]=this["_"+o]-this._padding-this._outerBounds[o]),this._outerBounds[d]+(["bottom","right"].includes(this._orient)?this._size:0)-(b.padding||this._axisClass.padding())),g=`translate(${k.x+(r?0:g)}, ${k.y+(r?g:0)})`;this._axisClass.select(Pt.elem("g.d3plus-ColorScale-axis",Pt.assign(v,{condition:!0,enter:{transform:g},update:{transform:g}})).node()).config(b).align("start").render();let s=this._axisTest._getPosition.bind(this._axisTest);g=this._axisTest._getRange();let t=this._group.selectAll("defs").data([0]);b=t.enter().append("defs"),b=(b.append("linearGradient").attr("id","gradient-"+this._uuid),(t=b.merge(t)).select("linearGradient").attr(_+"1",r?"0%":"100%").attr(_+"2",r?"100%":"0%").attr(d+"1","0%").attr(d+"2","0%"),t.select("linearGradient").selectAll("stop").data(p));let h=this._colorScale.domain(),n=S.scaleLinear().domain(g).range(r?[0,100]:[100,0]),a=(b.enter().append("stop").merge(b).attr("offset",(t,i)=>`${i<=h.length-1?n(s(h[i])):100}%`).attr("stop-color",String),(t,i)=>{i=m[i+1]||e[e.length-1];return Math.abs(s(i)-s(t))}),i=Pt.assign({duration:this._duration,fill:m?t=>this._colorScale(t):`url(#gradient-${this._uuid})`,[_]:m?(t,i)=>s(t)+a(t,i)/2-(["left","right"].includes(this._orient)?a(t,i):0):g[0]+(g[1]-g[0])/2+k[_],[d]:this._outerBounds[d]+(["top","left"].includes(this._orient)?x[o]:0)+this._size/2+k[d],[l]:m?a:g[1]-g[0],[o]:this._size},this._rectConfig);this._rectClass.data(m||[0]).id((t,i)=>i).select(y.node()).config(i).render(),c.height=this._outerBounds[o],c.width=this._outerBounds[l],this._labelClass.config(c).data(u).select(C.node()).x(t=>t===this._labelMax?i.x+i.width/2+this._padding:this._outerBounds.x).y(t=>i.y-this._labelClass.fontSize()(t)/2).text(t=>t).rotate(r?0:"right"===this._orient?90:-90).render()}else{Pt.elem("g.d3plus-ColorScale-axis",Object.assign({condition:a},v));let t=m.reduce((t,i,e)=>{i=this._bucketFormat.bind(this)(i,e,m,s);return t.push({color:p[e+1],id:i}),t},[]);r||(t=t.reverse());b=Pt.assign({align:r?"center":{start:"left",middle:"center",end:"right"}[this._align],direction:r?"row":"column",duration:this._duration,height:this._height,padding:this._padding,shapeConfig:Pt.assign({duration:this._duration},this._axisConfig.shapeConfig||{}),title:this._axisConfig.title,titleConfig:this._axisConfig.titleConfig||{},width:this._width,verticalAlign:r?{start:"top",middle:"middle",end:"bottom"}[this._align]:"middle"},this._legendConfig);this._legendClass.data(t).select(w.node()).config(b).render(),this._outerBounds=this._legendClass.outerBounds()}return t&&setTimeout(t,this._duration+100),this}
|
|
1672
1672
|
/**
|
|
1673
1673
|
@memberof ColorScale
|
|
1674
1674
|
@desc 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/).
|
|
@@ -1851,7 +1851,7 @@ this._group=Pt.elem("g.d3plus-ColorScale",{parent:this._select});let s=this._dat
|
|
|
1851
1851
|
@memberof ColorScale
|
|
1852
1852
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
1853
1853
|
@private
|
|
1854
|
-
*/constructor(){super(),this._axisClass=new o,this._axisConfig={gridSize:0},this._axisTest=new o,this._align="middle",this._buckets=5,this._bucketAxis=!1,this._bucketFormat=(i,t,e,s)=>{var h=this._axisConfig.tickFormat||Tt.formatAbbreviate;let n=e[t+1];var
|
|
1854
|
+
*/constructor(){super(),this._axisClass=new o,this._axisConfig={gridSize:0},this._axisTest=new o,this._align="middle",this._buckets=5,this._bucketAxis=!1,this._bucketFormat=(i,t,e,s)=>{var h=this._axisConfig.tickFormat||Tt.formatAbbreviate;let n=e[t+1];var a=!!t&&e[t-1],e=t===e.length-1;return i===n||e?(e=e&&i<Dt.max(s)?"+":"",h(i)+e):(e=1<=(e=n?n/100:i/100)||e<=-1?Math.round(e).toString().length-1:-1*e.toString().split(".")[1].replace(/([1-9])[1-9].*$/,"$1").length,e=Math.pow(10,e),a=h(a===i&&1===t?Dt.min([i+e,s.find(t=>i<t&&t<n)]):i),h=h(i&&1===t?n:Dt.max([n-e,s.reverse().find(t=>i<t&&t<n)])),this._bucketJoiner(a,h))},this._bucketJoiner=(t,i)=>t!==i?t+" - "+i:""+t,this._centered=!0,this._color=["#54478C","#2C699A","#0DB39E","#83E377","#EFEA5A"],this._colorMax=A.colorDefaults.on,this._colorMid=A.colorDefaults.light,this._colorMin=A.colorDefaults.off,this._data=[],this._duration=600,this._height=200,this._labelClass=new l,this._labelConfig={fontColor:A.colorDefaults.dark,fontSize:12},this._legendClass=new at,this._legendConfig={shapeConfig:{stroke:A.colorDefaults.dark,strokeWidth:1}},this._midpoint=0,this._orient="bottom",this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._rectClass=(new Ft).parent(this),this._rectConfig={stroke:"#999",strokeWidth:1},this._scale="linear",this._size=10,this._value=s("value"),this._width=400}}class ot{
|
|
1855
1855
|
/**
|
|
1856
1856
|
@memberof Message
|
|
1857
1857
|
@desc Removes the message from the page.
|
|
@@ -1877,13 +1877,13 @@ this._group=Pt.elem("g.d3plus-ColorScale",{parent:this._select});let s=this._dat
|
|
|
1877
1877
|
@memberof TextBox
|
|
1878
1878
|
@desc Renders the text boxes. If a *callback* is specified, it will be called once the shapes are done drawing.
|
|
1879
1879
|
@param {Function} [*callback* = undefined]
|
|
1880
|
-
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node());let k=this;var i=this._select.selectAll(".d3plus-textBox").data(this._data.reduce((u,p,f)=>{let m=this._text(p,f);if(void 0!==m){m=H.trim(m);let e=this._fontResize(p,f),s=this._lineHeight(p,f)/this._fontSize(p,f),h=e?this._fontMax(p,f):this._fontSize(p,f),n=e?h*s:this._lineHeight(p,f),
|
|
1880
|
+
*/render(t){void 0===this._select&&this.select(j.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node());let k=this;var i=this._select.selectAll(".d3plus-textBox").data(this._data.reduce((u,p,f)=>{let m=this._text(p,f);if(void 0!==m){m=H.trim(m);let e=this._fontResize(p,f),s=this._lineHeight(p,f)/this._fontSize(p,f),h=e?this._fontMax(p,f):this._fontSize(p,f),n=e?h*s:this._lineHeight(p,f),a=1,r=[],t,o,l={"font-family":Pt.fontExists(this._fontFamily(p,f)),"font-size":h,"font-weight":this._fontWeight(p,f),"line-height":n};var y,x,b,v=Pt.parseSides(this._padding(p,f)),C=this._height(p,f)-(v.top+v.bottom),w=this._width(p,f)-(v.left+v.right);let _=H.textWrap().fontFamily(l["font-family"]).fontSize(h).fontWeight(l["font-weight"]).lineHeight(n).maxLines(this._maxLines(p,f)).height(C).overflow(this._overflow(p,f)).width(w).split(this._split),d=this._fontMax(p,f),g=this._fontMin(p,f),i=this._verticalAlign(p,f),c=this._split(m,f);w>g&&(C>n||e&&C>g*s)&&(e&&(t=Pt.textWidth(c,l),x=1.165+w/C*.1,b=w*C,y=Dt.max(t),x=Dt.sum(t,t=>t*n)*x,(w<y||b<x)&&(b=Math.sqrt(b/x),x=Dt.min([b,w/y]),h=Math.floor(h*x)),b=Math.floor(.8*C),h>b)&&(h=b),
|
|
1881
1881
|
/**
|
|
1882
1882
|
Figures out the lineData to be used for wrapping.
|
|
1883
1883
|
@private
|
|
1884
|
-
*/function t(){var i=()=>{
|
|
1884
|
+
*/function t(){var i=()=>{a<1?r=[k._ellipsis("",a)]:r[a-1]=k._ellipsis(r[a-1],a)};
|
|
1885
1885
|
// Constraint the font size
|
|
1886
|
-
h=Dt.max([h,g]),h=Dt.min([h,d]),e&&(n=h*s,_.fontSize(h).lineHeight(n),l["font-size"]=h,l["line-height"]=n),o=_(m),
|
|
1886
|
+
h=Dt.max([h,g]),h=Dt.min([h,d]),e&&(n=h*s,_.fontSize(h).lineHeight(n),l["font-size"]=h,l["line-height"]=n),o=_(m),r=o.lines.filter(t=>""!==t),a=r.length,o.truncated&&(e?--h<g?(h=g,i):t:i)()}()),r.length&&(y=a*n,b=0!==(x=this._rotate(p,f))||"top"===i?0:"middle"===i?C/2-y/2:C-y,b-=.1*n,u.push({aH:this._ariaHidden(p,f),data:p,i:f,lines:r,fC:this._fontColor(p,f),fStroke:this._fontStroke(p,f),fSW:this._fontStrokeWidth(p,f),fF:l["font-family"],fO:this._fontOpacity(p,f),fW:l["font-weight"],id:this._id(p,f),tA:this._textAnchor(p,f),vA:this._verticalAlign(p,f),widths:o.widths,fS:h,lH:n,w:w,h:C,r:x,x:this._x(p,f)+v.left,y:this._y(p,f)+b+v.top}))}return u},[]),t=>this._id(t.data,t.i));let h=this._select.transition().duration(this._duration);
|
|
1887
1887
|
/**
|
|
1888
1888
|
* Applies translate and rotate to a text element.
|
|
1889
1889
|
* @param {D3Selection} text
|
|
@@ -1897,7 +1897,7 @@ var i=new RegExp(/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g);return t.match(i)?t=t.rep
|
|
|
1897
1897
|
/**
|
|
1898
1898
|
Styles to apply to each <text> element.
|
|
1899
1899
|
@private
|
|
1900
|
-
*/function i(t){t.attr("aria-hidden",e.aH).attr("dir",n?"rtl":"ltr").attr("fill",e.fC).attr("stroke",e.fStroke).attr("stroke-width",e.fSW).attr("text-anchor",e.tA).attr("font-family",e.fF).style("font-family",e.fF).attr("font-size",e.fS+"px").style("font-size",e.fS+"px").attr("font-weight",e.fW).style("font-weight",e.fW).attr("x",`${"middle"===e.tA?e.w/2:n?"start"===e.tA?e.w:0:"end"===e.tA?e.w:2*Math.sin(Math.PI*e.r/180)}px`).attr("y",(t,i)=>0===e.r||"top"===e.vA?(i+1)*e.lH-(e.lH-e.fS)+"px":"middle"===e.vA?(e.h+e.fS)/2-(e.lH-e.fS)+(i-e.lines.length/2+.5)*e.lH+"px":e.h-2*(e.lH-e.fS)-(e.lines.length-(i+1))*e.lH+2*Math.cos(Math.PI*e.r/180)+"px")}var s=j.select(this).selectAll("text").data(e.lines);(0===k._duration?(s.call(t).call(i),s.exit().remove(),s.enter().append("text").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("unicode-bidi","bidi-override").call(t)):(s.call(t).transition(h).call(i),s.exit().transition(h).attr("opacity",0).remove(),s.enter().append("text").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).style("opacity",0).call(t).call(i).merge(s).transition(h).delay(k._delay))).call(i).attr("opacity",e.fO).style("opacity",e.fO)}).transition(h).call(e);var
|
|
1900
|
+
*/function i(t){t.attr("aria-hidden",e.aH).attr("dir",n?"rtl":"ltr").attr("fill",e.fC).attr("stroke",e.fStroke).attr("stroke-width",e.fSW).attr("text-anchor",e.tA).attr("font-family",e.fF).style("font-family",e.fF).attr("font-size",e.fS+"px").style("font-size",e.fS+"px").attr("font-weight",e.fW).style("font-weight",e.fW).attr("x",`${"middle"===e.tA?e.w/2:n?"start"===e.tA?e.w:0:"end"===e.tA?e.w:2*Math.sin(Math.PI*e.r/180)}px`).attr("y",(t,i)=>0===e.r||"top"===e.vA?(i+1)*e.lH-(e.lH-e.fS)+"px":"middle"===e.vA?(e.h+e.fS)/2-(e.lH-e.fS)+(i-e.lines.length/2+.5)*e.lH+"px":e.h-2*(e.lH-e.fS)-(e.lines.length-(i+1))*e.lH+2*Math.cos(Math.PI*e.r/180)+"px")}var s=j.select(this).selectAll("text").data(e.lines);(0===k._duration?(s.call(t).call(i),s.exit().remove(),s.enter().append("text").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("unicode-bidi","bidi-override").call(t)):(s.call(t).transition(h).call(i),s.exit().transition(h).attr("opacity",0).remove(),s.enter().append("text").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).style("opacity",0).call(t).call(i).merge(s).transition(h).delay(k._delay))).call(i).attr("opacity",e.fO).style("opacity",e.fO)}).transition(h).call(e);var a=Object.keys(this._on),r=a.reduce((t,e)=>(t[e]=(t,i)=>this._on[e](t.data,i),t),{});for(let t=0;t<a.length;t++)s.on(a[t],r[a[t]]);return t&&setTimeout(t,this._duration+100),this}
|
|
1901
1901
|
/**
|
|
1902
1902
|
@memberof TextBox
|
|
1903
1903
|
@desc If *value* is specified, sets the aria-hidden attribute to the specified function or string and returns the current class instance.
|
|
@@ -2162,7 +2162,7 @@ var i=new RegExp(/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g);return t.match(i)?t=t.rep
|
|
|
2162
2162
|
*/_updateDomain(i){var e=j.pointers(i,this._select.node());let s=i.selection&&this._brushing||!e.length?i.selection:[e[0][0],e[0][0]];s=(s="ticks"===this._buttonBehaviorCurrent?s.map(this._d3Scale.invert):s).map(Number),"brush"===i.type&&this._brushing&&"buttons"===this._buttonBehaviorCurrent&&(e=i.selection.map(t=>Math.abs(t-i.sourceEvent.offsetX)),s=e[1]<=e[0]?[i.selection[0],i.sourceEvent.offsetX].sort((t,i)=>t-i):[i.sourceEvent.offsetX,i.selection[1]].sort((t,i)=>t-i));e="ticks"===this._buttonBehaviorCurrent?this._availableTicks.map(Number):this._d3Scale.range();if("ticks"===this._buttonBehaviorCurrent){
|
|
2163
2163
|
// find closest min and max ticks from data
|
|
2164
2164
|
// and their indices in the ticks Array
|
|
2165
|
-
let t=Pt.date(E.closest(s[0],e));var h=e.indexOf(+t);let i=Pt.date(E.closest(s[1],e));var n=e.indexOf(+i),
|
|
2165
|
+
let t=Pt.date(E.closest(s[0],e));var h=e.indexOf(+t);let i=Pt.date(E.closest(s[1],e));var n=e.indexOf(+i),a=Math.abs(n-h),r=this._brushMin()-1;
|
|
2166
2166
|
// using the indices, determine if the 2 ends of the brush
|
|
2167
2167
|
// are too close to each other. "ticksApart" always needs to
|
|
2168
2168
|
// be less than the current current brushMin minus 1. For
|
|
@@ -2170,9 +2170,9 @@ let t=Pt.date(E.closest(s[0],e));var h=e.indexOf(+t);let i=Pt.date(E.closest(s[1
|
|
|
2170
2170
|
// values need to be "1" space apart from eachother.
|
|
2171
2171
|
// if the min and max are not far enough apart to satisfy
|
|
2172
2172
|
// brushMin, then forcibly extend the domain.
|
|
2173
|
-
r
|
|
2173
|
+
a<r&&(
|
|
2174
2174
|
// push the maxDomain out as far as possible to account for brushMin
|
|
2175
|
-
n=Dt.min([e.length-1,n+(a
|
|
2175
|
+
n=Dt.min([e.length-1,n+(r-a)]),i=e[n],(a=Math.abs(n-h))<r)&&(h=Dt.max([0,h-(r-a)]),t=e[h]),s[0]=t,s[1]=i}else s[0]=E.closest(s[0],e),s[1]=E.closest(s[1],e);
|
|
2176
2176
|
// if the brush event has finished, update the current "selection" value
|
|
2177
2177
|
n=+s[0]==+s[1];return"brush"!==i.type&&"end"!==i.type||(this._selection="ticks"===this._buttonBehaviorCurrent?n?s[0]:s:n?Pt.date(this._availableTicks[e.indexOf(s[0])]):[Pt.date(this._availableTicks[e.indexOf(s[0])]),Pt.date(this._availableTicks[e.indexOf(s[1])])]),s}
|
|
2178
2178
|
/**
|
|
@@ -2187,9 +2187,9 @@ n=+s[0]==+s[1];return"brush"!==i.type&&"end"!==i.type||(this._selection="ticks"=
|
|
|
2187
2187
|
@chainable
|
|
2188
2188
|
*/render(t){var{height:i,y:e}=this._position;this._ticks&&(this._ticks=this._ticks.map(Pt.date)),this._data&&(this._data=this._data.map(Pt.date));let s=this._ticks||this._domain.map(Pt.date),h=(this._ticks||(n=S.scaleTime().domain(s).range([0,this._width]),s=n.ticks()),this._timeLocale||$.locale[this._locale]||$.locale["en-US"]),o=(void 0===this._userFormat&&(this._userFormat=this._tickFormat||!1),this._tickFormat=this._userFormat||(t=>Tt.formatDate(t,s).replace(/^Q/g,h.quarter)));if(
|
|
2189
2189
|
// Measures size of ticks
|
|
2190
|
-
this._ticksWidth=this._width,["auto","buttons"].includes(this._buttonBehavior)){let
|
|
2190
|
+
this._ticksWidth=this._width,["auto","buttons"].includes(this._buttonBehavior)){let r=0;s.forEach((t,i)=>{var{fontFamily:e,fontSize:s}=this._shapeConfig.labelConfig;let h="function"==typeof e?e(t,i):e,n="function"==typeof s?s(t,i):s;e=H.textWrap().fontFamily(h).fontSize(n).lineHeight(this._shapeConfig.lineHeight?this._shapeConfig.lineHeight(t,i):void 0)(o(t));let a=e.lines.length?Math.ceil(Dt.max(e.lines.map(t=>Pt.textWidth(t,{"font-family":h,"font-size":n}))))+n/4:0;a%2&&a++,r<a&&(r=a+2*this._buttonPadding)}),this._ticksWidth=r*s.length}var n=this._playButton?this._playButtonConfig.width||this._buttonHeight:0,a=this._width-n,a=(this._buttonBehaviorCurrent="auto"===this._buttonBehavior?this._ticksWidth<a?"buttons":"ticks":this._buttonBehavior,this._hiddenHandles="buttons"===this._buttonBehaviorCurrent&&!this._brushing);if("buttons"===this._buttonBehaviorCurrent){this._scale="ordinal";let e=S.scaleTime().domain(this._domain.map(Pt.date)).ticks().map(Number);this._domain=this._ticks||Array.from(Array(e[e.length-1]-e[0]+1),(t,i)=>e[0]+i).map(Pt.date),this._ticks=this._domain;var r=.5*this._ticksWidth/this._ticks.length,l=this._width-this._ticksWidth-n;this._paddingLeft="middle"===this._buttonAlign?l/2+n:"end"===this._buttonAlign?l+n:n,this._range=[this._paddingLeft+r,this._paddingLeft+this._ticksWidth-r]}else this._scale="time",this._domain=Dt.extent(s),this._range=[n?1.5*n:void 0,void 0],this._paddingLeft=n;super.render(t);let _=this._outerBounds[e],d=this._d3Scale.range();l=this._brush=y.brushX().extent([[d[0],_],[d[d.length-1],_+this._outerBounds[i]]]).filter(this._brushFilter).handleSize(a?0:this._handleSize).on("start",this._brushStart.bind(this)).on("brush",this._brushBrush.bind(this)).on("end",this._brushEnd.bind(this)),r="ticks"===this._buttonBehaviorCurrent?this._availableTicks:d,t=[this._brushMin()>r.length?r[0]:r[r.length-this._brushMin()],r[r.length-1]],e=void 0===this._selection?t:this._selection instanceof Array?"buttons"===this._buttonBehaviorCurrent?this._selection.map(Pt.date).map(t=>d[this._ticks.map(Number).indexOf(+t)]):this._selection.map(Pt.date):"buttons"===this._buttonBehaviorCurrent?[d[this._ticks.map(Number).indexOf(+this._selection)]]:[this._selection],1===e.length&&e.push(e[0]),this._updateBrushLimit(e),this._brushGroup=Pt.elem("g.brushGroup",{parent:this._group}),this._brushGroup.call(l).transition(this._transition).call(l.move,"ticks"===this._buttonBehaviorCurrent?this._updateBrushLimit(e):e),this._outerBounds.y-=this._handleSize/2,this._outerBounds.height+=this._handleSize/2,i=Pt.elem("g.d3plus-Timeline-play",{parent:this._group});
|
|
2191
2191
|
// data Array to be used when detecting the default value
|
|
2192
|
-
return this._playButtonClass.data(this._playButton?[{x:this._paddingLeft-n,y:"buttons"===this._buttonBehaviorCurrent?"middle"===this._align?this._height/2-this._buttonHeight/2:"start"===this._align?this._margin.top:this._height-this._buttonHeight-this._margin.bottom:this._outerBounds.y,width:n,height:
|
|
2192
|
+
return this._playButtonClass.data(this._playButton?[{x:this._paddingLeft-n,y:"buttons"===this._buttonBehaviorCurrent?"middle"===this._align?this._height/2-this._buttonHeight/2:"start"===this._align?this._margin.top:this._height-this._buttonHeight-this._margin.bottom:this._outerBounds.y,width:n,height:this._buttonHeight}]:[]).select(i.node()).config(jt.bind(this)(this._playButtonConfig)).render(),this}
|
|
2193
2193
|
/**
|
|
2194
2194
|
@memberof Timeline
|
|
2195
2195
|
@desc If *value* is specified, sets the button padding and returns the current class instance. If *value* is not specified, returns the current button padding.
|
|
@@ -2297,7 +2297,7 @@ return this._playButtonClass.data(this._playButton?[{x:this._paddingLeft-n,y:"bu
|
|
|
2297
2297
|
@private
|
|
2298
2298
|
*/constructor(){super(),this._barConfig=Pt.assign({},this._barConfig,{stroke:()=>"buttons"===this._buttonBehaviorCurrent?"transparent":_t,"stroke-width":()=>"buttons"===this._buttonBehaviorCurrent?0:1}),this._brushing=!0,this._brushFilter=t=>!t.button&&t.detail<2,this._brushMin=Ht(1),this._buttonAlign="middle",this._buttonBehavior="auto",this._buttonPadding=10,this._buttonHeight=24,this._domain=[2001,2010],this._gridSize=0,this._handleConfig={fill:A.colorDefaults.light,stroke:"#228be6","stroke-width":2,rx:2,ry:2},this._handleSize=6,this._height=100,this._labelOffset=!1,this._on={},this.orient("bottom"),this._playButton=!0,this._playButtonClass=(new l).on("click",()=>{
|
|
2299
2299
|
// if playing, pause
|
|
2300
|
-
if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass.render();else{let h=!0;var t=()=>{let t=this._selection||[this._domain[this._domain.length-1]];1===(t=(t=t instanceof Array?t:[t]).map(Pt.date).map(Number)).length&&t.push(t[0]);var i=this._ticks.map(Number),e=i.indexOf(t[0]),s=i.indexOf(t[t.length-1]);(s===i.length-1?h?this.selection([this._ticks[0],this._ticks[s-e]]):(clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass):(s+1===i.length-1&&(clearInterval(this._playTimer),this._playTimer=!1),this.selection([this._ticks[e+1],this._ticks[s+1]]))).render(),h=!1};this._playTimer=setInterval(t,this._playButtonInterval),t()}}).on("mousemove",()=>this._playButtonClass.select().style("cursor","pointer")),this._playButtonConfig={fontColor:A.colorDefaults.dark,fontSize:15,text:()=>this._playTimer?"
|
|
2300
|
+
if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass.render();else{let h=!0;var t=()=>{let t=this._selection||[this._domain[this._domain.length-1]];1===(t=(t=t instanceof Array?t:[t]).map(Pt.date).map(Number)).length&&t.push(t[0]);var i=this._ticks.map(Number),e=i.indexOf(t[0]),s=i.indexOf(t[t.length-1]);(s===i.length-1?h?this.selection([this._ticks[0],this._ticks[s-e]]):(clearInterval(this._playTimer),this._playTimer=!1,this._playButtonClass):(s+1===i.length-1&&(clearInterval(this._playTimer),this._playTimer=!1),this.selection([this._ticks[e+1],this._ticks[s+1]]))).render(),h=!1};this._playTimer=setInterval(t,this._playButtonInterval),t()}}).on("mousemove",()=>this._playButtonClass.select().style("cursor","pointer")),this._playButtonConfig={fontColor:A.colorDefaults.dark,fontSize:15,text:()=>this._playTimer?"⏸":"⏵",textAnchor:"middle",verticalAlign:"middle"},this._playButtonInterval=1e3,this._selectionConfig={fill:"#228be6","fill-opacity":()=>"buttons"===this._buttonBehaviorCurrent?.3:1,"stroke-width":0},this._shape="Rect",this._shapeConfig=Pt.assign({},this._shapeConfig,{labelBounds:t=>"buttons"===this._buttonBehaviorCurrent?{x:t.labelBounds.x,y:-this._buttonHeight/2+1,width:t.labelBounds.width,height:this._buttonHeight}:t.labelBounds,labelConfig:{fontColor:A.colorDefaults.dark,fontSize:()=>12,verticalAlign:()=>"buttons"===this._buttonBehaviorCurrent?"middle":"top"},fill:()=>"buttons"===this._buttonBehaviorCurrent?"#fff":_t,stroke:()=>"buttons"===this._buttonBehaviorCurrent?_t:"transparent",height:t=>"buttons"===this._buttonBehaviorCurrent?this._buttonHeight:t.tick?this._handleSize:0,width:t=>"buttons"===this._buttonBehaviorCurrent?this._ticksWidth/this._availableTicks.length:t.tick?this._domain.map(Number).includes(t.id)?2:1:0,y:t=>"buttons"===this._buttonBehaviorCurrent?"middle"===this._align?this._height/2:"start"===this._align?this._margin.top+this._buttonHeight/2:this._height-this._buttonHeight/2-this._margin.bottom:t.y,rx:t=>"buttons"!==this._buttonBehaviorCurrent&&this._domain.map(Number).includes(t.id)?1:0,ry:t=>"buttons"!==this._buttonBehaviorCurrent&&this._domain.map(Number).includes(t.id)?1:0}),this._snapping=!0}}
|
|
2301
2301
|
/**
|
|
2302
2302
|
* Creates a reference element for popper.
|
|
2303
2303
|
* @param {Number[]} position
|
|
@@ -2318,7 +2318,7 @@ if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playB
|
|
|
2318
2318
|
/**
|
|
2319
2319
|
Sets styles for both enter and update.
|
|
2320
2320
|
@private
|
|
2321
|
-
*/function
|
|
2321
|
+
*/function a(t){t.style("background",o._background).style(o._prefix+"border-radius",o._borderRadius).style("pointer-events",o._pointerEvents).style("padding",o._padding).style("width",o._width).style("height",o._height).style("border",o._border)}Pt.stylize(h,this._tooltipStyle),e("title"),e("body");var r=s.append("table").attr("class","d3plus-tooltip-table"),l=h.select(".d3plus-tooltip-table"),l=(Pt.stylize(l,this._tableStyle),r.append("thead").attr("class","d3plus-tooltip-thead"),h.select(".d3plus-tooltip-thead")),l=(Pt.stylize(l,this._theadStyle),l.selectAll("tr").data([0])),_=l.enter().append("tr"),l=(l.exit().remove(),l.merge(_)),_=(Pt.stylize(l,this._trStyle),l.selectAll("th").data(this._thead)),l=(_.enter().append("th").merge(_).html(n),_.exit().remove(),r.append("tbody").attr("class","d3plus-tooltip-tbody"),h.select(".d3plus-tooltip-tbody")),_=(Pt.stylize(l,this._tbodyStyle),l.selectAll("tr").data(this._tbody)),r=_.enter().append("tr"),l=(_.exit().remove(),_.merge(r)),_=(Pt.stylize(l,this._trStyle),l.selectAll("td").data(t=>t));return _.enter().append("td").merge(_).html(n),Pt.stylize(_,this._tdStyle),e("footer"),e("arrow"),s.attr("id",(t,i)=>"d3plus-tooltip-"+(t?this._id(t,i):"")).call(a).each((t,i)=>{var e=o._id(t,i),s=document.getElementById("d3plus-tooltip-"+e),h=document.getElementById("d3plus-tooltip-arrow-"+e);let n=h.offsetHeight;var a=h.getBoundingClientRect().height/2,r=(h.style.bottom=`-${n/2}px`,o._position(t,i)),r=Array.isArray(r)?{getBoundingClientRect:gt(r)}:r;this._popperClasses[e]=x.createPopper(r,s,{placement:"top",modifiers:[{name:"arrow",options:{element:h}},{name:"offset",options:{offset:[0,o._offset(t,i)+a]}},{name:"preventOverflow",options:{boundary:"scrollParent",padding:5}},{name:"flip",options:{behavior:"flip",boundary:"viewport",fallbackPlacements:["bottom"],padding:5}},{name:"update",enabled:!0,phase:"afterWrite",fn(t){var t=t.state,i=t.elements.arrow,e=t.styles.arrow,t=t.modifiersData.flip._skip,s=parseFloat(i.style.borderRightWidth,10);t?(i.style.transform=e.transform+"rotate(225deg)",i.style.top=`-${n/2+s}px`):(i.style.transform=e.transform+"rotate(45deg)",i.style.bottom=`-${n/2+s}px`)}}],removeOnDestroy:!0})}),h.each((t,i)=>{var e=o._id(t,i),t=o._position(t,i),i=this._popperClasses[e];i&&(i.state.elements.reference.getBoundingClientRect=Array.isArray(t)?gt(t):t,i.update())}).call(a),i.exit().each((t,i)=>{t=o._id(t,i),i=this._popperClasses[t];i&&(i.destroy(),delete this._popperClasses[t])}).remove(),t&&setTimeout(t,100),this}
|
|
2322
2322
|
/**
|
|
2323
2323
|
@memberof Tooltip
|
|
2324
2324
|
@desc Sets the inner HTML content of the arrow element, which by default is empty.
|
|
@@ -2550,7 +2550,7 @@ if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playB
|
|
|
2550
2550
|
@function _drawColorScale
|
|
2551
2551
|
@desc Renders the color scale if this._colorScale is not falsey.
|
|
2552
2552
|
@private
|
|
2553
|
-
*/function ut(){var t=this._data;let i=this._colorScalePosition.bind(this)(this.config());[!1,"top","bottom","left","right"].includes(i)||(i="bottom");var e=["top","bottom"].includes(i),s=this._colorScale&&i,h=this._colorScalePadding()?this._padding:{top:0,right:0,bottom:0,left:0},n=this._width-(this._margin.left+this._margin.right+h.left+h.right),
|
|
2553
|
+
*/function ut(){var t=this._data;let i=this._colorScalePosition.bind(this)(this.config());[!1,"top","bottom","left","right"].includes(i)||(i="bottom");var e=["top","bottom"].includes(i),s=this._colorScale&&i,h=this._colorScalePadding()?this._padding:{top:0,right:0,bottom:0,left:0},n=this._width-(this._margin.left+this._margin.right+h.left+h.right),a=e?Dt.min([this._colorScaleMaxSize,n]):this._width-(this._margin.left+this._margin.right),r=this._height-(this._margin.bottom+this._margin.top+h.bottom+h.top),o=e?this._height-(this._margin.bottom+this._margin.top):Dt.min([this._colorScaleMaxSize,r]),n={opacity:i?1:0,transform:`translate(${e?this._margin.left+h.left+(n-a)/2:this._margin.left}, ${e?this._margin.top:this._margin.top+h.top+(r-o)/2})`},h=Pt.elem("g.d3plus-viz-colorScale",{condition:s&&!this._colorScaleConfig.select,enter:n,parent:this._select,duration:this._duration,update:n}).node();this._colorScale&&(r=t.filter((t,i)=>{t=this._colorScale(t,i);return null!=t}),this._colorScaleClass.align({bottom:"end",left:"start",right:"end",top:"start"}[i]||"bottom").duration(this._duration).data(r).height(o).locale(this._locale).orient(i).select(h).value(this._colorScale).width(a).config(this._colorScaleConfig).render(),s)&&(n=this._colorScaleClass.outerBounds(),!this._colorScaleConfig.select)&&n.height&&(this._margin[i]+=e?n.height+2*this._legendClass.padding():n.width+2*this._legendClass.padding())}let pt=["fill","opacity","texture"];
|
|
2554
2554
|
/**
|
|
2555
2555
|
@function legendLabel
|
|
2556
2556
|
@desc Default label function for the legend.
|
|
@@ -2561,7 +2561,7 @@ if(this._playTimer)clearInterval(this._playTimer),this._playTimer=!1,this._playB
|
|
|
2561
2561
|
@desc Renders the legend if this._legend is not falsy.
|
|
2562
2562
|
@param {Array} data The filtered data array to be displayed.
|
|
2563
2563
|
@private
|
|
2564
|
-
*/function mt(t=[]){let e=[],s=(t,i,e)=>{var s=this._shape(t,i),s=("fill"===e&&"Line"===s&&(e="stroke"),(this._shapeConfig[s]&&this._shapeConfig[s][e]?this._shapeConfig[s]:this._shapeConfig)[e]);return"function"==typeof s?s.bind(this)(t,i):s};var i=(i,e)=>pt.map(t=>s(i,e,t)).join("_"),t=this._colorScale?t.filter((t,i)=>void 0===this._colorScale(t,i)):t,h=(Dt.rollup(t,t=>e.push(Lt.merge(t,this._aggs)),i),e.sort(this._legendSort),e.map((t,i)=>this._ids(t,i).slice(0,this._drawDepth+1)));for(let i=this._legendDepth=0;i<=this._drawDepth;i++){var n=h.map(t=>t[i]);if(!n.some(t=>t instanceof Array)&&Array.from(new Set(n)).length===e.length){this._legendDepth=i;break}}let
|
|
2564
|
+
*/function mt(t=[]){let e=[],s=(t,i,e)=>{var s=this._shape(t,i),s=("fill"===e&&"Line"===s&&(e="stroke"),(this._shapeConfig[s]&&this._shapeConfig[s][e]?this._shapeConfig[s]:this._shapeConfig)[e]);return"function"==typeof s?s.bind(this)(t,i):s};var i=(i,e)=>pt.map(t=>s(i,e,t)).join("_"),t=this._colorScale?t.filter((t,i)=>void 0===this._colorScale(t,i)):t,h=(Dt.rollup(t,t=>e.push(Lt.merge(t,this._aggs)),i),e.sort(this._legendSort),e.map((t,i)=>this._ids(t,i).slice(0,this._drawDepth+1)));for(let i=this._legendDepth=0;i<=this._drawDepth;i++){var n=h.map(t=>t[i]);if(!n.some(t=>t instanceof Array)&&Array.from(new Set(n)).length===e.length){this._legendDepth=i;break}}let a=(t,i)=>{let e=this._id(t,i);return e instanceof Array&&(e=e[0]),this._hidden.includes(e)||this._solo.length&&!this._solo.includes(e)};var t=this._legendClass.outerBounds(),r=this.config();let o=this._legendPosition.bind(this)(r);[!1,"top","bottom","left","right"].includes(o)||(o="bottom");var l=["top","bottom"].includes(o),_=this._legendPadding()?this._padding:{top:0,right:0,bottom:0,left:0},d={transform:`translate(${l?this._margin.left+_.left:this._margin.left}, ${l?this._margin.top:this._margin.top+_.top})`},r=this._legend.bind(this)(r,e),d=Pt.elem("g.d3plus-viz-legend",{condition:r&&!this._legendConfig.select,enter:d,parent:this._select,duration:this._duration,update:d}).node();this._legendClass.id(i).align(l?"center":o).direction(l?"row":"column").duration(this._duration).data(r?e:[]).height(l?this._height-(this._margin.bottom+this._margin.top):this._height-(this._margin.bottom+this._margin.top+_.bottom+_.top)).locale(this._locale).parent(this).select(d).shape((t,i)=>"Circle"===this._shape(t,i)?"Circle":"Rect").verticalAlign(l?o:"middle").width(l?this._width-(this._margin.left+this._margin.right+_.left+_.right):this._width-(this._margin.left+this._margin.right)).shapeConfig(jt.bind(this)(this._shapeConfig,"legend")).shapeConfig({fill:(t,i)=>a(t,i)?this._hiddenColor(t,i):s(t,i,"fill"),labelConfig:{fontOpacity:(t,i)=>a(t,i)?this._hiddenOpacity(t,i):1}}).config(this._legendConfig).render(),!this._legendConfig.select&&t.height&&(this._margin[o]+=l?t.height+2*this._legendClass.padding():t.width+2*this._legendClass.padding())}
|
|
2565
2565
|
/**
|
|
2566
2566
|
@function _drawSubtitle
|
|
2567
2567
|
@desc Draws a subtitle if this._subtitle is defined.
|
|
@@ -2626,7 +2626,7 @@ this._brushGroup.call(this._zoomBrush.move,null),kt.bind(this)(t.selection))}.bi
|
|
|
2626
2626
|
@param {Array} *bounds*
|
|
2627
2627
|
@param {Number} [*duration* = 0]
|
|
2628
2628
|
@private
|
|
2629
|
-
*/function kt(s,t=this._duration){var h=this._zoomBehavior.scaleExtent(),n=d.zoomTransform(this._container.node());if(s){var[r
|
|
2629
|
+
*/function kt(s,t=this._duration){var h=this._zoomBehavior.scaleExtent(),n=d.zoomTransform(this._container.node());if(s){var[a,r]=this._zoomBehavior.translateExtent()[1],o=s[1][0]-s[0][0],l=s[1][1]-s[0][1];let t=Math.min(h[1],1/Math.max(o/a,l/r)),i,e;o/l<a/r?(t*=(r-2*this._zoomPadding)/r,i=(a-o*t)/2/t,e=this._zoomPadding/t):(t*=(a-2*this._zoomPadding)/a,e=(r-l*t)/2/t,i=this._zoomPadding/t),n.x=(n.x-s[0][0]+i)*(n.k*t/n.k),n.y=(n.y-s[0][1]+e)*(n.k*t/n.k),n.k*=t,0<n.x?n.x=0:n.x<a*-n.k+a&&(n.x=a*-n.k+a),0<n.y?n.y=0:n.y<r*-n.k+r&&(n.y=r*-n.k+r)}else n.k=h[0],n.x=0,n.y=0;Ct.bind(this)(n,t)}function St(){this._brushGroup.selectAll(".selection").call(Pt.attrize,this._zoomBrushSelectionStyle||{}),this._brushGroup.selectAll(".handle").call(Pt.attrize,this._zoomBrushHandleStyle||{})}
|
|
2630
2630
|
/**
|
|
2631
2631
|
@name _drawAttribution
|
|
2632
2632
|
@desc Draws absolute positioned attribution text.
|
|
@@ -2915,13 +2915,9 @@ return j.select("body").on("touchstart."+this._uuid,
|
|
|
2915
2915
|
*/fontFamily(t){if(arguments.length){let i={fontFamily:t},e={titleConfig:i,shapeConfig:{labelConfig:i}};return this.shapeConfig({labelConfig:i}),this.colorScaleConfig({axisConfig:e}),["axis","column","row","timeline","x","y","x2","y2"].forEach(t=>{t+="Config";this[t]&&this[t](e)}),["back","title","total","subtitle"].forEach(t=>{t+="Config";this[t]&&this[t](i)}),this.tooltipConfig({tooltipStyle:{"font-family":H.fontFamilyStringify(t)}}),this._fontFamily=t,this}return this._fontFamily}
|
|
2916
2916
|
/**
|
|
2917
2917
|
@memberof Viz
|
|
2918
|
-
@desc
|
|
2918
|
+
@desc Defines the mapping between data and shape. The value can be a String matching a key in each data point (default is "id"), or an accessor Function that returns a unique value for each data point. Additionally, an Array of these values may be provided if the visualization supports nested hierarchies.
|
|
2919
2919
|
@param {String|Function|Array} [*value*]
|
|
2920
2920
|
@chainable
|
|
2921
|
-
@example
|
|
2922
|
-
function value(d) {
|
|
2923
|
-
return d.id;
|
|
2924
|
-
}
|
|
2925
2921
|
*/groupBy(t){return arguments.length?((this._groupByRaw=t)instanceof Array||(t=[t]),this._groupBy=t.map(t=>"function"==typeof t?t:(this._aggs[t]||(this._aggs[t]=(t,i)=>{t=Lt.unique(t.map(i));return 1===t.length?t[0]:t}),s(t))),this):this._groupBy}
|
|
2926
2922
|
/**
|
|
2927
2923
|
@memberof Viz
|
|
@@ -3051,8 +3047,8 @@ return j.select("body").on("touchstart."+this._uuid,
|
|
|
3051
3047
|
*/select(t){return arguments.length?(this._select=j.select(t),this):this._select}
|
|
3052
3048
|
/**
|
|
3053
3049
|
@memberof Viz
|
|
3054
|
-
@desc
|
|
3055
|
-
@param {Function
|
|
3050
|
+
@desc Changes the primary shape used to represent each data point in a visualization. Not all visualizations support changing shapes, this method can be provided the String name of a D3plus shape class (for example, "Rect" or "Circle"), or an accessor Function that returns the String class name to be used for each individual data point.
|
|
3051
|
+
@param {String|Function} [*value*]
|
|
3056
3052
|
@chainable
|
|
3057
3053
|
*/shape(t){return arguments.length?(this._shape="function"==typeof t?t:Ht(t),this):this._shape}
|
|
3058
3054
|
/**
|
|
@@ -3281,7 +3277,7 @@ return j.select("body").on("touchstart."+this._uuid,
|
|
|
3281
3277
|
@memberof Viz
|
|
3282
3278
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3283
3279
|
@private
|
|
3284
|
-
*/constructor(){super(),this._aggs={},this._ariaHidden=!0,this._attribution=!1,this._attributionStyle={background:"rgba(255, 255, 255, 0.75)",border:"1px solid rgba(0, 0, 0, 0.25)",color:"rgba(0, 0, 0, 0.75)",display:"block",font:"400 11px/11px "+H.fontFamilyStringify(H.fontFamily),margin:"5px",opacity:.75,padding:"4px 6px 3px"},this._backClass=(new l).on("click",()=>{(this._history.length?this.config(this._history.pop()):this.depth(this._drawDepth-1).filter(!1)).render()}).on("mousemove",()=>this._backClass.select().style("cursor","pointer")),this._backConfig={fontSize:10,padding:5,resize:!1},this._cache=!0,this._color=(t,i)=>this._groupBy[0](t,i),this._colorDefaults={...A.colorDefaults,scale:S.scaleOrdinal().range(A.colorDefaults.scale.range())},this._colorScaleClass=new
|
|
3280
|
+
*/constructor(){super(),this._aggs={},this._ariaHidden=!0,this._attribution=!1,this._attributionStyle={background:"rgba(255, 255, 255, 0.75)",border:"1px solid rgba(0, 0, 0, 0.25)",color:"rgba(0, 0, 0, 0.75)",display:"block",font:"400 11px/11px "+H.fontFamilyStringify(H.fontFamily),margin:"5px",opacity:.75,padding:"4px 6px 3px"},this._backClass=(new l).on("click",()=>{(this._history.length?this.config(this._history.pop()):this.depth(this._drawDepth-1).filter(!1)).render()}).on("mousemove",()=>this._backClass.select().style("cursor","pointer")),this._backConfig={fontSize:10,padding:5,resize:!1},this._cache=!0,this._color=(t,i)=>this._groupBy[0](t,i),this._colorDefaults={...A.colorDefaults,scale:S.scaleOrdinal().range(A.colorDefaults.scale.range())},this._colorScaleClass=new rt,this._colorScaleConfig={axisConfig:{rounding:"inside"},scale:"jenks"},this._colorScalePadding=At,this._colorScalePosition=()=>this._width>1.5*this._height?"right":"bottom",this._colorScaleMaxSize=600,this._data=[],this._dataCutoff=100,this._detectResize=!0,this._detectResizeDelay=400,this._detectVisible=!0,this._detectVisibleInterval=1e3,this._downloadButton=!1,this._downloadConfig={type:"png"},this._downloadPosition="top",this._duration=600,this._fontFamily=H.fontFamily,this._hidden=[],this._hiddenColor=Ht("#aaa"),this._hiddenOpacity=Ht(.5),this._history=[],this._groupBy=[s("id")],this._legend=(t,i)=>{var e=Dt.max(i,(t,i)=>{t=this._groupBy[this._legendDepth].bind(this)(t,i);return t instanceof Array?t.length:1});return 1<i.length&&e<=2},this._legendClass=new at,this._legendConfig={label:ft.bind(this),shapeConfig:{ariaLabel:ft.bind(this),labelConfig:{fontColor:void 0,fontResize:!1,padding:0}}},this._legendFilterInvert=Ht(!1),this._legendPadding=At,this._legendPosition=()=>this._width>1.5*this._height?"right":"bottom",this._legendSort=(t,i)=>this._drawLabel(t).localeCompare(this._drawLabel(i)),this._legendTooltip={},this._loadingHTML=()=>`
|
|
3285
3281
|
<div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">
|
|
3286
3282
|
<strong>${this._translate("Loading Visualization")}</strong>
|
|
3287
3283
|
<sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;"><a href="https://d3plus.org" target="_blank">${this._translate("Powered by D3plus")}</a></sub>
|
|
@@ -3316,22 +3312,22 @@ return j.select("body").on("touchstart."+this._uuid,
|
|
|
3316
3312
|
var e=Object.keys(this._on).some(t=>// all valid click event keys,
|
|
3317
3313
|
["click","click.shape"].includes(t)&&// truthy values (no nulls),
|
|
3318
3314
|
this._on[t]&&// and it is not our default click.shape function
|
|
3319
|
-
this._on[t].toString()!==i),n=this._on["click.shape"]&&this._on["click.shape"].toString()===i,
|
|
3315
|
+
this._on[t].toString()!==i),n=this._on["click.shape"]&&this._on["click.shape"].toString()===i,a=this._drawDepth<this._groupBy.length-1,e=(
|
|
3320
3316
|
// only show the hand cursor when the shape has a click event
|
|
3321
|
-
this._select.style("cursor",e||n&&
|
|
3317
|
+
this._select.style("cursor",e||n&&a?"pointer":"auto"),h.touches?[h.touches[0].clientX,h.touches[0].clientY]:[h.clientX,h.clientY]);
|
|
3322
3318
|
// does the shape still have our default "click.shape" event?
|
|
3323
3319
|
// (if the user only sets "click", both functions will fire)
|
|
3324
|
-
this._tooltipClass.data([s||t]).footer(!(!n||!
|
|
3320
|
+
this._tooltipClass.data([s||t]).footer(!(!n||!a)&&this._translate("Click to Expand")).title(this._drawLabel).position(e).config(jt.bind(this)(this._tooltipConfig)).render()}}.bind(this),"mousemove.legend":function(e,s,h,n){var n=n.touches?[n.touches[0].clientX,n.touches[0].clientY]:[n.clientX,n.clientY],a=Dt.merge(this._legendClass.data().map((t,i)=>{let e=this._id(t,i);return e=e instanceof Array?e:[e]})).length;if(e&&this._tooltip(e,s)){let t=this._id(e,s);t instanceof Array&&(t=t[0]);s=this._translate;let i=Mt.bind(this).toString();
|
|
3325
3321
|
// does the legend have any user-defined click events?
|
|
3326
|
-
var
|
|
3322
|
+
var r=Object.keys(this._on).some(t=>// all valid click event keys,
|
|
3327
3323
|
["click","click.legend"].includes(t)&&// truthy values (no nulls),
|
|
3328
3324
|
this._on[t]&&// and it is not our default click.legend function
|
|
3329
|
-
this._on[t].toString()!==i),o=this._on["click.legend"]&&this._on["click.legend"].toString()===i,l=this._drawDepth<this._groupBy.length-1,
|
|
3325
|
+
this._on[t].toString()!==i),o=this._on["click.legend"]&&this._on["click.legend"].toString()===i,l=this._drawDepth<this._groupBy.length-1,r=(
|
|
3330
3326
|
// only show the hand cursor when the shape has a click event
|
|
3331
|
-
this._select.style("cursor",
|
|
3327
|
+
this._select.style("cursor",r||o&&l?"pointer":"auto"),this._legendFilterInvert.bind(this)()),l=this._solo.includes(t),_=this._hidden.includes(t);
|
|
3332
3328
|
// does the legend still have our default "click.legend" event?
|
|
3333
3329
|
// (if the user only sets "click", both functions will fire)
|
|
3334
|
-
this._tooltipClass.data([h||e]).footer(!!o&&(
|
|
3330
|
+
this._tooltipClass.data([h||e]).footer(!!o&&(r?this._solo.length&&!l||_?s("Click to Highlight"):1===this._solo.length&&l||this._hidden.length===a-1?s("Click to Show All"):s("Click to Highlight")+"<br />"+s("Shift+Click to Hide"):this._solo.length&&!l||_?s("Click to Show")+"<br />"+s("Shift+Click to Highlight"):1===this._solo.length&&l||this._hidden.length===a-1?s("Click to Show All"):s("Click to Hide")+"<br />"+s("Shift+Click to Highlight"))).title(this._legendConfig.label?this._legendClass.label():ft.bind(this)).position(n).config(jt.bind(this)(this._tooltipConfig)).config(jt.bind(this)(this._legendTooltip)).render()}}.bind(this)},this._queue=[],this._resizeContainer="undefined"==typeof window?"":window,this._scrollContainer="undefined"==typeof window?"":window,this._shape=Ht("Rect"),this._shapes=[],this._shapeConfig={ariaLabel:(t,i)=>this._drawLabel(t,i),fill:(i,e)=>{for(;i.__d3plus__&&i.data;)e=(i=i.data).i;if(this._colorScale){let t=this._colorScale(i,e);var s,h;if(null!=t)return s=this._colorScaleClass._colorScale,h=this._colorScaleClass.color(),s?s.domain().length?s(t):s.range()[s.range().length-1]:h instanceof Array?h[h.length-1]:h}let t=this._color(i,e);return n.color(t)?t:A.colorAssign("string"==typeof t?t:JSON.stringify(t),this._colorDefaults)},labelConfig:{fontColor:(t,i)=>{t="function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,i):this._shapeConfig.fill;return A.colorContrast(t)}},opacity:Ht(1),stroke:(t,i)=>{t="function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,i):this._shapeConfig.fill;return n.color(t).darker(.25)},role:"presentation",strokeWidth:Ht(0)},this._solo=[],this._subtitleClass=new l,this._subtitleConfig={ariaHidden:!0,fontSize:12,padding:5,resize:!1,textAnchor:"middle"},this._subtitlePadding=At,this._svgDesc="",this._svgTitle="",this._timeline=!0,this._timelineClass=(new dt).align("end"),this._timelineConfig={brushing:!1,padding:5},this._timelinePadding=At,this._threshold=Ht(1e-4),this._thresholdKey=void 0,this._thresholdName=()=>this._translate("Values"),this._titleClass=new l,this._titleConfig={ariaHidden:!0,fontSize:16,padding:5,resize:!1,textAnchor:"middle"},this._titlePadding=At,this._tooltip=Ht(!0),this._tooltipClass=new ct,this._tooltipConfig={pointerEvents:"none",titleStyle:{"max-width":"200px"}},this._totalClass=new l,this._totalConfig={fontSize:10,padding:5,resize:!1,textAnchor:"middle"},this._totalFormat=t=>this._translate("Total")+": "+Tt.formatAbbreviate(t,this._locale),this._totalPadding=At,this._zoom=!1,this._zoomBehavior=d.zoom(),this._zoomBrush=y.brush(),this._zoomBrushHandleSize=1,this._zoomBrushHandleStyle={fill:"#444"},this._zoomBrushSelectionStyle={fill:"#777","stroke-width":0},this._zoomControlStyle={background:"rgba(255, 255, 255, 0.75)",border:"1px solid rgba(0, 0, 0, 0.75)",color:"rgba(0, 0, 0, 0.75)",display:"block",font:"900 15px/21px "+H.fontFamilyStringify(H.fontFamily),height:"20px",margin:"5px",opacity:.75,padding:0,"text-align":"center",width:"20px"},this._zoomControlStyleActive={background:"rgba(0, 0, 0, 0.75)",color:"rgba(255, 255, 255, 0.75)",opacity:1},this._zoomControlStyleHover={cursor:"pointer",opacity:1},this._zoomFactor=2,this._zoomMax=16,this._zoomPadding=20,this._zoomPan=!0,this._zoomScroll=!0}}
|
|
3335
3331
|
/**
|
|
3336
3332
|
@module discreteBuffer
|
|
3337
3333
|
@desc Adds left/right padding to a point or time scale.
|
|
@@ -3350,7 +3346,7 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3350
3346
|
/**
|
|
3351
3347
|
@module numericBuffer
|
|
3352
3348
|
@private
|
|
3353
|
-
*/function p(n,r,
|
|
3349
|
+
*/function p(n,a,r,o,t,i,l,_){if(void 0===r||isNaN(i[0])||isNaN(i[1]))return i;if(_&&(i=i.slice().reverse(),t=t.slice().reverse()),i[0]===i[1])i=i.slice(),"log"===a?(i=[Gt(i[0]),Vt(i[0])])[1]<i[0]&&i.reverse():(t=Math.abs(parseFloat(i[0].toPrecision(1).replace(/[0-9]{1}$/,"1"))),i[0]-=t,i[1]+=t),n.domain(_?i.slice().reverse():i);else{var e=i[0]===i[1]?10:Math.abs(Math.log(i[1]-i[0])/100),s=()=>{let e=n.copy(),s=!1;if("log"===a){let t=n.domain().slice(),i=n.range().slice();_&&(t=t.reverse(),i=i.reverse()),(s=t[0]*t[1]<0)&&(h=(h=S.scaleLog().domain([1e-6,Math.abs(t[l])]).range([0,1])(Math.abs(t[l?0:1])))/(h+1)*(i[1]-i[0]),t=(0===l?[t[0],1e-6]:[1e-6,t[1]]).map(Math.abs),i=0===l?[i[0],i[0]+h]:[i[0]+h,i[1]]),e=S.scaleLog().domain(t).range(i)}let t=!1;var h=e.range();let i;return i="log"===a&&s?e(Math.abs(r)):e(r),_?0===l?t=i+o>h[l]:1===l&&(t=i-o<h[l]):0===l?t=i-o<h[l]:1===l&&(t=i+o>h[l]),t};if(n.invert&&s())if("log"===a){let t=0;for(;t<10&&s();){var h=(0===l?-1:1)*(i[l]<0?-1:1);i[l]+=i[l]*e*h,n.domain(_?i.slice().reverse():i),t++}}else 0===l?(t=n.invert(n(r)+(o+10)*(_?1:-1)))<i[l]&&(i[l]=t,n.domain(_?i.slice().reverse():i)):1===l&&(t=n.invert(n(r)+(o+10)*(_?-1:1)))>i[l]&&(i[l]=t,n.domain(_?i.slice().reverse():i))}return _?i.reverse():i}
|
|
3354
3350
|
/**
|
|
3355
3351
|
@module circleBuffer
|
|
3356
3352
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -3360,7 +3356,7 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3360
3356
|
@param {Object} [config]
|
|
3361
3357
|
@param {Number} [buffer] Defaults to the radius of the largest Circle.
|
|
3362
3358
|
@private
|
|
3363
|
-
*/let Yt=
|
|
3359
|
+
*/let Yt=g.theme,Kt=new It,Ut=new l,Xt={Bar:function({data:t,x:i,y:e,x2:s,y2:h,buffer:n=10}){let a=s?"x2":"x",r=h?"y2":"y";var o,h=(s="x"===this._discrete?e:i).domain().slice();let l="x"===this._discrete;l&&h.reverse();let _,d,g=(_=this._stacked?(o=Ot.nest().key(t=>t[this._discrete]+"_"+t.group).entries(t).map(t=>t.values.map(t=>t[l?r:a])),d=o.map(t=>Dt.sum(t.filter(t=>0<t))),o.map(t=>Dt.sum(t.filter(t=>t<0)))):(o=t.map(t=>t[l?r:a]),d=o.filter(t=>0<t),o.filter(t=>t<0)),s(Dt.max(d))),c=((l?g<s(0):g>s(0))&&(g+=l?-n:n),g=s.invert(g),s(Dt.min(_)));return(l?c>s(0):c<s(0))&&(c+=l?n:-n),c=s.invert(c),g>h[1]&&(h[1]=g),c<h[0]&&(h[0]=c),l&&h.reverse(),s.domain(h),[i,e]}
|
|
3364
3360
|
/**
|
|
3365
3361
|
@module boxBuffer
|
|
3366
3362
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -3370,7 +3366,7 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3370
3366
|
@param {Object} [config]
|
|
3371
3367
|
@param {Number} [buffer = 10]
|
|
3372
3368
|
@private
|
|
3373
|
-
*/,Box:function({data:t,x:i,y:e,x2:s,y2:h,buffer:n=10}){let
|
|
3369
|
+
*/,Box:function({data:t,x:i,y:e,x2:s,y2:h,buffer:n=10}){let a=s?"x2":"x",r=h?"y2":"y",o=(s="x"===this._discrete?e:i,h=s.domain().slice(),"x"===this._discrete);o&&h.reverse();let l,_;l=this._stacked?(d=Ot.nest().key(t=>t[this._discrete]).entries(t).map(t=>t.values.map(t=>t[o?r:a])),_=d.map(t=>Dt.sum(t.filter(t=>0<t))),d.map(t=>Dt.sum(t.filter(t=>t<0)))):_=t.map(t=>t[o?r:a]);var d=s(Dt.max(_)),t=(d+=o?-n:n,d=s.invert(d),s(Dt.min(l)));return t+=o?n:-n,t=s.invert(t),d>h[1]&&(h[1]=d),t<h[0]&&(h[0]=t),o&&h.reverse(),s.domain(h),[i,e]},Circle:function({data:t,x:e,y:s,x2:i,y2:h,yScale:n,xScale:a,config:r,buffer:o}){e=e.copy(),s=s.copy();let l=i?"x2":"x",_=h?"y2":"y",d=e.domain().slice(),g=s.domain().slice(),c=e.range(),u=s.range();return!e.invert&&e.padding&&qt(e,t,this._discrete),!s.invert&&s.padding&&qt(s,t,this._discrete),(e.invert||s.invert)&&t.forEach(t=>{var i=o||2*r.r(t.data,t.i);e.invert&&(d=p(e,a,t[l],i,c,d,0,!1),d=p(e,a,t[l],i,c,d,1,!1)),s.invert&&(g=p(s,n,t[_],i,u,g,0,!0),g=p(s,n,t[_],i,u,g,1,!0))}),[e,s]}
|
|
3374
3370
|
/**
|
|
3375
3371
|
@module lineBuffer
|
|
3376
3372
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -3380,7 +3376,7 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3380
3376
|
@param {Object} [config]
|
|
3381
3377
|
@param {Number} [buffer] Defaults to the radius of the largest Circle.
|
|
3382
3378
|
@private
|
|
3383
|
-
*/,Line:function({data:t,x:i,y:e,x2:s,y2:h}){let n=s?"x2":"x",
|
|
3379
|
+
*/,Line:function({data:t,x:i,y:e,x2:s,y2:h}){let n=s?"x2":"x",a=h?"y2":"y";return s="x"===this._discrete?e:i,h=s.domain().slice(),"x"===this._discrete&&h.reverse(),t=t.map(t=>t["x"===this._discrete?a:n]),(t=s.invert(s(Dt.max(t))+("x"===this._discrete?-10:10)))>h[1]&&(h[1]=t),"x"===this._discrete&&h.reverse(),s.domain(h),[i,e]}
|
|
3384
3380
|
/**
|
|
3385
3381
|
@module rectBuffer
|
|
3386
3382
|
@desc Adds a buffer to either side of the non-discrete axis.
|
|
@@ -3390,7 +3386,7 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3390
3386
|
@param {Object} [config]
|
|
3391
3387
|
@param {Number} [buffer] Defaults to the width/height of the largest Rect.
|
|
3392
3388
|
@private
|
|
3393
|
-
*/,Rect:function({data:t,x:e,y:s,x2:i,y2:h,yScale:n,xScale:
|
|
3389
|
+
*/,Rect:function({data:t,x:e,y:s,x2:i,y2:h,yScale:n,xScale:a,config:r}){e=e.copy(),s=s.copy();let o=i?"x2":"x",l=h?"y2":"y",_=e.domain().slice(),d=s.domain().slice(),g=e.range(),c=s.range();return!e.invert&&e.padding&&qt(e,t,this._discrete),!s.invert&&s.padding&&qt(s,t,this._discrete),(e.invert||s.invert)&&t.forEach(t=>{var i;e.invert&&(i=r.width(t.data,t.i),_=p(e,a,t[o],i,g,_,0,!1),_=p(e,a,t[o],i,g,_,1,!1)),s.invert&&(i=r.height(t.data,t.i),d=p(s,n,t[l],i,c,d,0,!0),d=p(s,n,t[l],i,c,d,1,!0))}),[e,s]}};
|
|
3394
3390
|
/**
|
|
3395
3391
|
@desc Logic for determining default sizes of shapes using the sizeScaleD3 internal function.
|
|
3396
3392
|
@private
|
|
@@ -3410,7 +3406,7 @@ this._tooltipClass.data([h||e]).footer(!!o&&(a?this._solo.length&&!l||_?s("Click
|
|
|
3410
3406
|
/**
|
|
3411
3407
|
@desc Logic for determining default sum of shapes using the stackSum function used in d3Shape.
|
|
3412
3408
|
@private
|
|
3413
|
-
*/function ii(r
|
|
3409
|
+
*/function ii(a,r){var o;if(0<(o=a.length)){let i,e,s,h,n;var l=a[r[0]].length;for(let t=0;t<l;++t)for(n=h=0,s=0;s<o;++s)0<=(e=(i=a[r[s]][t])[1]-i[0])?(i[0]=n,i[1]=n+=e):e<0?(i[1]=h,i[0]=h+=e):i[0]=n}}
|
|
3414
3410
|
/**
|
|
3415
3411
|
* Determines if a Bar label should be placed outside of the Bar.
|
|
3416
3412
|
* @param {@} d
|
|
@@ -3434,20 +3430,20 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3434
3430
|
/**
|
|
3435
3431
|
Extends the draw behavior of the abstract Viz class.
|
|
3436
3432
|
@private
|
|
3437
|
-
*/_draw(
|
|
3438
|
-
/* Determines whether or not any of the x or y axes are a "time" axis. */var
|
|
3433
|
+
*/_draw(at){if(this._filteredData.length||this._annotations.length){
|
|
3434
|
+
/* Determines whether or not any of the x or y axes are a "time" axis. */var rt=!!this._time&&this._time(this._filteredData[0],0);let s=this._x2Time=rt&&this._x2(this._filteredData[0],0)===rt,h=this._xTime=rt&&this._x(this._filteredData[0],0)===rt,E=this._y2Time=rt&&this._y2(this._filteredData[0],0)===rt,j=this._yTime=rt&&this._y(this._filteredData[0],0)===rt,H=h||s||j||E,R=(t,i)=>`${!H&&this._time?this._time(t,i):"time"}_`+(this._stacked?""+(1<this._groupBy.length?this._ids(t,i).slice(0,-1).join("_"):"group"):""+this._ids(t,i).join("_"));var rt=(t,i)=>{t={__d3plus__:!0,data:t,group:R(t,i),i:i,hci:this._confidence&&this._confidence[1]&&this._confidence[1](t,i),id:this._ids(t,i).slice(0,this._drawDepth+1).join("_"),lci:this._confidence&&this._confidence[0]&&this._confidence[0](t,i),shape:this._shape(t,i),x:h?Pt.date(this._x(t,i)):this._x(t,i),x2:s?Pt.date(this._x2(t,i)):this._x2(t,i),y:j?Pt.date(this._y(t,i)):this._y(t,i),y2:E?Pt.date(this._y2(t,i)):this._y2(t,i)};return t.discrete="Bar"===t.shape?t[this._discrete]+"_"+t.group:""+t[this._discrete],t.id="Bar"===t.shape?t.id+"_"+t[this._discrete]:t.id,t};let a=this._formattedData=this._filteredData.map(rt),r=this._axisPersist?this._data.map(rt):a;this._size?(rt=Dt.extent(r,t=>this._size(t.data)),this._sizeScaleD3=$t["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(rt).range([rt[0]===rt[1]?this._sizeMax:Dt.min([this._sizeMax/2,this._sizeMin]),this._sizeMax])):this._sizeScaleD3=()=>this._sizeMin;var rt=r.some(t=>void 0!==t.x2),ot=r.some(t=>void 0!==t.y2);let t=this._height-this._margin.top-this._margin.bottom,c=this._discrete?"x"===this._discrete?"y":"x":void 0,F=this._discrete?"x"===this._discrete?"y2":"x2":void 0,W=[c,F].filter(t=>t),i=this._select,e=this._transition,x=this._width-this._margin.left-this._margin.right;
|
|
3439
3435
|
/**
|
|
3440
3436
|
* @desc Returns all unique values for a given axis.
|
|
3441
3437
|
* @param {String} axis
|
|
3442
3438
|
* @returns {Array}
|
|
3443
3439
|
* @private
|
|
3444
|
-
*/var lt=At.bind(this)("x"),_t=At.bind(this)("x2"),dt=At.bind(this)("y"),gt=At.bind(this)("y2");let N,u,p,f;if(this._stacked){var ct=
|
|
3440
|
+
*/var lt=At.bind(this)("x"),_t=At.bind(this)("x2"),dt=At.bind(this)("y"),gt=At.bind(this)("y2");let N,u,p,f;if(this._stacked){var ct=r.filter(t=>["Area","Bar"].includes(t.shape));let h=Ot.nest().key(t=>t.group).entries(ct).reduce((t,i)=>(t[i.key]||(t[i.key]=0),t[i.key]+=Dt.sum(i.values,t=>t[c]),t),{}),e=(r.sort((t,i)=>{var e,s;return this[`_${this._discrete}Sort`]?this[`_${this._discrete}Sort`](t.data,i.data):(e=t[this._discrete])-(s=i[this._discrete])!=0?e-s:t.group!==i.group?h[i.group]-h[t.group]:i[c]-t[c]}),N=Array.from(new Set(r.map(t=>t.discrete))),f=Array.from(new Set(r.map(t=>t.id))),(p=Ot.nest().key(t=>t.discrete).entries(r).map(t=>t.values)).forEach(s=>{let h=Array.from(new Set(s.map(t=>t.id)));h.length<f.length&&f.forEach(i=>{var t,e;h.includes(i)||"Area"===(t=r.filter(t=>t.id===i)[0]).shape&&(e=R(t.data,t.i),e={__d3plus__:!0,data:t.data,discrete:"Bar"===t.shape?s[0][this._discrete]+"_"+e:""+s[0][this._discrete],group:e,id:t.id,ids:i,shape:t.shape,[this._discrete]:s[0][this._discrete],[c]:0},a.push(e))})}),this[`_${this._discrete}Sort`]?a.sort((t,i)=>this[`_${this._discrete}Sort`](t.data,i.data)):a.sort((t,i)=>t[this._discrete]-i[this._discrete]),this._stackOrder);e instanceof Array?f.sort((t,i)=>e.indexOf(t)-e.indexOf(i)):e===Et.stackOrderNone&&f.sort((t,i)=>t.localeCompare(i)),p=Et.stack().keys(f).offset(this._stackOffset).order(e instanceof Array?Et.stackOrderNone:e).value((t,i)=>{t=t.filter(t=>t.id===i);return t.length?t[0][c]:0})(p);ct="x"===this._discrete?lt:dt;u={[this._discrete]:this[`_${this._discrete}Time`]?Dt.extent(ct):ct,[c]:[Dt.min(p.map(t=>Dt.min(t.map(t=>t[0])))),Dt.max(p.map(t=>Dt.max(t.map(t=>t[1]))))]}}else{let e=this._discrete||"x";this[`_${this._discrete}Sort`]?r.sort((t,i)=>this[`_${this._discrete}Sort`](t.data,i.data)):r.sort((t,i)=>t[e]-i[e]),u={x:!h&&"x"===this._discrete||this._xSort?lt:Dt.extent(lt),x2:!s&&"x"===this._discrete||this._x2Sort?_t:Dt.extent(_t),y:!j&&"y"===this._discrete||this._ySort?dt:Dt.extent(dt),y2:!E&&"y"===this._discrete||this._y2Sort?gt:Dt.extent(gt)}}
|
|
3445
3441
|
/**
|
|
3446
3442
|
* Determins default scale type and domain for a given axis.
|
|
3447
3443
|
* @param {String} axis
|
|
3448
3444
|
* @private
|
|
3449
|
-
*/let[I,m,q,G]=Bt.bind(this)("x"),[V,y,Y,K]=Bt.bind(this)("y");ct=(i,t)=>{var e,s=this[`_${i}Config`].scale;return"auto"===s?this._discrete===i?t:(e=
|
|
3450
|
-
/** */function t(e,s,h){if(e.defaultY||(e.defaultY=this._yAxis._getPosition(e.value)),s){var n=h[s-1],{fontSize:
|
|
3445
|
+
*/let[I,m,q,G]=Bt.bind(this)("x"),[V,y,Y,K]=Bt.bind(this)("y");ct=(i,t)=>{var e,s=this[`_${i}Config`].scale;return"auto"===s?this._discrete===i?t:(e=r.map(t=>t[i]),3<Dt.deviation(e)/Dt.mean(e)?"log":"linear"):s||t};let n=this._yConfigScale=ct("y",y).toLowerCase(),o=this._y2ConfigScale=ct("y2",K).toLowerCase(),l=this._xConfigScale=ct("x",m).toLowerCase(),_=this._x2ConfigScale=ct("x2",G).toLowerCase(),b=(u={x:I,x2:q||I,y:V,y2:Y||V},Object.keys(u).forEach(i=>{"log"===this[`_${i}ConfigScale`]&&u[i].includes(0)&&(Dt.min(u[i])<0?u[i][1]=Dt.max(a.map(t=>t[i]).filter(t=>![NaN,void 0,!1].includes(t))):u[i][0]=Dt.min(r.map(t=>t[i]).filter(t=>![NaN,void 0,!1].includes(t))))}),W.forEach(t=>{var i;this[`_${t}Config`].domain?(i=this[`_${t}Config`].domain,"x"===this._discrete&&i.reverse(),u[t]=i):t&&void 0!==this._baseline&&(i=this._baseline,u[t]&&u[t][0]>i?u[t][0]=i:u[t]&&u[t][1]<i&&(u[t][1]=i))}),$t["scale"+m]().domain(u.x).range(Dt.range(0,1+x,x/(u.x.length-1)))),U=$t["scale"+G]().domain(u.x2).range(Dt.range(0,1+x,x/(u.x2.length-1))),v=$t["scale"+y]().domain(u.y.reverse()).range(Dt.range(0,1+t,t/(u.y.length-1))),X=$t["scale"+K]().domain(u.y2.reverse()).range(Dt.range(0,1+t,t/(u.y2.length-1)));ct=Ot.nest().key(t=>t.shape).entries(a).sort((t,i)=>this._shapeSort(t.key,i.key));"Point"!==("x"===this._discrete?y:m)&&Ot.nest().key(t=>t.shape).entries(r).forEach(t=>{var i;["Bar","Box"].includes(t.key)&&qt("x"===this._discrete?b:v,a,this._discrete),this._buffer[t.key]&&(i=this._buffer[t.key].bind(this)({data:t.values,x:b,y:v,yScale:n,xScale:l,config:this._shapeConfig[t.key]}),b=i[0],v=i[1],i=this._buffer[t.key].bind(this)({data:t.values,x:U,y:X,yScale:o,xScale:_,x2:!0,y2:!0,config:this._shapeConfig[t.key]}),U=i[0],X=i[1])});let C=b.domain(),J=U.domain(),w=v.domain(),d=X.domain();var ut={barConfig:{"stroke-width":0},gridSize:0,labels:[],title:!1,tickSize:0},_t=rt?{data:_t}:ut,gt=ot?{data:gt}:ut,ut=("x"!==this._discrete||this._width>this._discreteCutoff)&&this._width>this._xCutoff,pt=("y"!==this._discrete||this._height>this._discreteCutoff)&&this._height>this._yCutoff,dt={data:dt,locale:this._locale,rounding:this._yDomain?"none":"outside",scalePadding:v.padding?v.padding():0},ft=(!ut&&pt&&(dt.barConfig={stroke:"transparent"},dt.tickSize=0,dt.shapeConfig={labelBounds:(t,i)=>{var{width:t,y:e}=t.labelBounds,s=this._height/2;return{x:i?-s:0,y:e,width:t,height:s}},labelConfig:{padding:0,rotate:0},labelRotation:!1}),Pt.elem("g.d3plus-plot-test",{enter:{opacity:0},parent:this._select})),mt=jt.bind(this)(this._shapeConfig,"shape","Bar");let Q=void 0!==mt.label?"function"==typeof mt.label?mt.label:Ht(mt.label):this._drawLabel,g=r.map(t=>Q(t.data,t.i)).filter(t=>"number"==typeof t||t).map(String),k=Lt.unique(r.map(t=>t.x2)),S=(k="Point"===G&&k.every(t=>g.includes(""+t))?[]:null,Lt.unique(r.map(t=>t.x))),Z=(S="Point"===m&&S.every(t=>g.includes(""+t))?[]:null,Lt.unique(r.map(t=>t.y2))),z=(Z="Point"===K&&Z.every(t=>g.includes(""+t))?[]:null,Lt.unique(r.map(t=>t.y)));z="Point"===y&&z.every(t=>g.includes(""+t))?[]:null,pt&&this._yTest.domain(w).height(t).maxSize(x/2).range([void 0,void 0]).select(ft.node()).ticks(z).width(x).config(dt).config(this._yConfig).scale(n).render();var mt=this._yTest.outerBounds(),yt=mt.width?mt.width+this._yTest.padding():void 0,xt=(ot&&this._y2Test.domain(d).height(t).range([void 0,void 0]).select(ft.node()).ticks(Z).width(x).config(dt).config(gt).config(this._y2Config).scale(o).render(),this._y2Test.outerBounds()),bt=xt.width?xt.width+this._y2Test.padding():void 0,lt={data:lt,locale:this._locale,rounding:this._xDomain?"none":"outside",scalePadding:b.padding?b.padding():0};!pt&&ut&&(lt.barConfig={stroke:"transparent"},lt.tickSize=0,lt.shapeConfig={labelBounds:(t,i)=>{var{height:t,y:e}=t.labelBounds,s=this._width/2;return{x:i?-s:0,y:e,width:s,height:t}},labelConfig:{padding:0,rotate:0,textAnchor:t=>S&&t.id===S[0]?"start":"end"},labelRotation:!1});let M=void 0;ut&&this._xTest.domain(C).height(t).maxSize(t/2).range([void 0,M]).select(ft.node()).ticks(S).width(x).config(lt).config(this._xConfig).scale(l).render();let tt,A=[],it=this._lineLabels&&!ot;if(it){var vt=a.filter(t=>"Line"===t.shape&&("function"!=typeof this._lineLabels||this._lineLabels(t.data,t.i))),vt=Ot.nest().key(t=>t.id).entries(vt);if(vt.length){var Ct=jt.bind(this)(this._shapeConfig,"shape","Line"),wt=(Kt.config(Ct),Kt.labelConfig());let d=void 0!==wt.fontColor?wt.fontColor:Ut.fontColor(),g=void 0!==wt.fontSize?wt.fontSize:Ut.fontSize(),c=void 0!==wt.fontWeight?wt.fontWeight:Ut.fontWeight(),u=void 0!==wt.fontFamily?wt.fontFamily:Ut.fontFamily(),p=void 0!==wt.padding?wt.padding:Ut.padding(),f=Ct.label||this._drawLabel,m=t=>("log"===l&&0===t&&(t=C[0]<0?this._xTest._d3Scale.domain()[1]:this._xTest._d3Scale.domain()[0]),this._xTest._getPosition.bind(this._xTest)(t)),y=t=>("log"===n&&0===t&&(t=w[0]<0?this._yTest._d3Scale.domain()[1]:this._yTest._d3Scale.domain()[0]),this._yTest._getPosition.bind(this._yTest)(t)),i=(A=vt.map(t=>{let i=t.values[t.values.length-1],e;for(;i.__d3plus__&&i.data;)i=i.data,e=i.i;var s="function"==typeof f?f(i,e):f,h="function"==typeof d?d(i,e):d,n="function"==typeof g?g(i,e):g,a="function"==typeof c?c(i,e):c;let r="function"==typeof u?u(i,e):u;r instanceof Array&&(r=r.map(t=>`'${t}'`).join(", "));var o="function"==typeof p?p(i,e):p,s=Pt.textWidth(s,{"font-size":n,"font-family":r,"font-weight":a}),a=t.values.map(t=>[m(t.x),y(t.y)]);let l=Dt.max(t.values.map(t=>m(t.x)));var _=t.values.find(t=>m(t.x)===l).y;return{id:t.key,labelWidth:s+2*o,spaceNeeded:s+4*o,value:_,yEstimate:y(_),padding:o,fontSize:n,fontColor:h,maxX:l,xValue:Dt.max(t.values,t=>t.x),coords:a}}).sort((t,i)=>w[1]>w[0]?t.value-i.value:i.value-t.value).filter((t,i,e)=>{let{fontSize:s,id:h,labelWidth:n,maxX:a,yEstimate:r}=t;return 0===e.filter(i=>i.id!==h&&i.coords.some(t=>(t[0]>a||t[0]===a&&i.maxX!==a)&&t[0]<=a+n&&t[1]<=r+.75*s&&t[1]>=r-.75*s)).length}),Dt.max(A,t=>t.maxX));tt=Dt.max(A.map(t=>t.labelWidth));wt=i===this._xTest._getRange.bind(this._xTest)()[1]?Dt.max(A.filter(t=>t.maxX===i),t=>t.spaceNeeded):0;wt&&(Ct=Dt.min([wt,x/4]),M=x-Ct-this._margin.right)}}ut&&M&&this._xTest.domain(C).height(t).maxSize(t/2).range([void 0,M]).select(ft.node()).ticks(S).width(x).config(lt).config(this._xConfig).scale(l).render(),rt&&this._x2Test.domain(J).height(t).range([void 0,M]).select(ft.node()).ticks(k).width(x).config(lt).tickSize(0).config(_t).config(this._x2Config).scale(_).render();vt=this._xTest._getRange(),wt=this._x2Test._getRange(),Ct=this._x2Test.outerBounds();let B=rt?Ct.height+this._x2Test.padding():0;var Ct=Dt.max([yt,vt[0],wt[0]]),kt=(ut&&this._xTest.range([Ct,void 0]).render(),pt?this._yTest.shapeConfig().labelConfig.fontSize()/2:0),St=Dt.max([bt,x-vt[1],x-wt[1]]),zt=this._xTest.outerBounds().height+(pt?this._xTest.padding():0),at=(this._padding.left+=Ct,this._padding.right+=St,this._padding.bottom+=zt,this._padding.top+=B+kt,super._draw(at),this._margin.left+this._margin.right),Mt=this._margin.top+this._margin.bottom;let P=[B,t-(zt+kt+Mt)],D=(pt&&this._yTest.domain(w).height(t).maxSize(x/2).range(P).select(ft.node()).ticks(z).width(x).config(dt).config(this._yConfig).scale(n).render(),yt=(mt=this._yTest.outerBounds()).width?mt.width+this._yTest.padding():void 0,Ct=Dt.max([yt,vt[0],wt[0]]),ot&&this._y2Test.config(dt).domain(d).gridSize(0).height(t).range(P).select(ft.node()).width(x-Dt.max([0,St-bt])).title(!1).config(this._y2Config).config(gt).scale(o).render(),bt=(xt=this._y2Test.outerBounds()).width?xt.width+this._y2Test.padding():void 0,St=Dt.max([0,bt,x-vt[1],x-wt[1]]),[Ct,x-(St+at)]);mt=Pt.elem("g.d3plus-plot-background",{parent:i,transition:e}),ft=`translate(${this._margin.left}, ${this._margin.top+B+kt})`,xt=`translate(${this._margin.left}, ${this._margin.top+kt})`,vt=Pt.elem("g.d3plus-plot-x-axis",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft,opacity:ut?1:0}}),wt=rt&&Pt.elem("g.d3plus-plot-x2-axis",{parent:i,transition:e,enter:{transform:xt},update:{transform:xt}}),at=`translate(${this._margin.left+(yt<Ct?Ct-yt:0)}, ${this._margin.top+kt})`,ut=Pt.elem("g.d3plus-plot-y-axis",{parent:i,transition:e,enter:{transform:at},update:{transform:at,opacity:pt?1:0}}),xt=`translate(-${this._margin.right}, ${this._margin.top+kt})`,Ct=ot&&Pt.elem("g.d3plus-plot-y2-axis",{parent:i,transition:e,enter:{transform:xt},update:{transform:xt}});this._xAxis.domain(C).height(t-(B+kt+Mt)).maxSize(t/2).range(D).select(vt.node()).ticks(S).width(x).config(lt).config(this._xConfig).scale(l).render(),rt&&this._x2Axis.domain(J).height(t-(zt+kt+Mt)).range(D).select(wt.node()).ticks(k).width(x).config(lt).config(_t).config(this._x2Config).scale(_).render(),this._xFunc=b=(t,i)=>("x2"===i?("log"===_&&0===t&&(t=J[0]<0?this._x2Axis._d3Scale.domain()[1]:this._x2Axis._d3Scale.domain()[0]),this._x2Axis._getPosition.bind(this._x2Axis)):("log"===l&&0===t&&(t=C[0]<0?this._xAxis._d3Scale.domain()[1]:this._xAxis._d3Scale.domain()[0]),this._xAxis._getPosition.bind(this._xAxis)))(t),P=[this._xAxis.outerBounds().y+B,t-(zt+kt+Mt)],this._yAxis.domain(w).height(t).maxSize(x/2).range(P).select(ut.node()).ticks(z).width(D[D.length-1]).config(dt).config(this._yConfig).scale(n).render(),ot&&this._y2Axis.config(dt).domain(ot?d:w).gridSize(0).height(t).range(P).select(Ct.node()).width(x-Dt.max([0,St-bt])).title(!1).config(this._y2Config).config(gt).scale(o).render();let et={},O=(A&&(Ot.nest().key(t=>t.xValue).entries(A).forEach(({values:t})=>{var i=Dt.max(t.map(t=>t.fontSize));let l=Dt.range(P[0],P[1],i).reverse(),_=(P[1]-P[0])/8;t.forEach(
|
|
3446
|
+
/** */function t(e,s,h){if(e.defaultY||(e.defaultY=this._yAxis._getPosition(e.value)),s){var n=h[s-1],{fontSize:a,padding:r}=e,o=e.newY||e.defaultY;let i=n.newY||n.defaultY;o-a/2-r<i&&(o=l.find(t=>t<i),e.defaultY-o<_)&&(n.newY=o,s)&&t(n,s-1,h)}}.bind(this))}),et=A.reduce((t,i)=>(i.newY&&(t[i.id]=i.newY),t),{})),this._yFunc=v=(t,i)=>"y2"===i?("log"===o&&0===t&&(t=d[1]<0?this._y2Axis._d3ScaleNegative.domain()[0]:this._y2Axis._d3Scale.domain()[1]),this._y2Axis._getPosition.bind(this._y2Axis)(t)-B):("log"===n&&0===t&&(t=w[1]<0?this._yAxis._d3ScaleNegative.domain()[0]:this._yAxis._d3Scale.domain()[1]),this._yAxis._getPosition.bind(this._yAxis)(t)-B),this._xAxis.barConfig()["stroke-width"]);O&&(O/=2),(new Ft).data([{}]).select(mt.node()).x(D[0]+(D[1]-D[0])/2).width(D[1]-D[0]).y(this._margin.top+kt+P[0]+(P[1]-P[0])/2).height(P[1]-P[0]).config(this._backgroundConfig).render();yt=A.filter(t=>void 0!==t.newY);if(yt.length){at=Pt.elem("g.d3plus-plot-connectors",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node();let t=yt.map(t=>Pt.assign({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue),y:t.defaultY},t)).concat(yt.map(t=>Pt.assign({x:this._xAxis._getPosition.bind(this._xAxis)(t.xValue)+t.padding-1,y:t.newY||t.defaultY},t)));(new It).config({data:t,stroke:t=>t.fontColor,x:t=>t.x,y:t=>t.y}).config(this._labelConnectorConfig).select(at).render()}let st=Pt.elem("g.d3plus-plot-annotations",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node();pt=Pt.elem("g.d3plus-plot-shapes",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node();let ht=Pt.elem("g.d3plus-plot-annotations-front",{parent:i,transition:e,enter:{transform:ft},update:{transform:ft}}).node(),L=(Object.keys(this._previousAnnotations).forEach(i=>{let e="front"===i?ht:st;var t=this._annotations.filter(t=>"back"===i&&!t.layer||t.layer===i);let s=t.map(t=>t.shape);t.forEach(t=>{(new Wt[t.shape]).duration(this._duration).config(t).config({x:t=>t.x2?b(t.x2,"x2"):b(t.x),x0:"x"===this._discrete?t=>t.x2?b(t.x2,"x2"):b(t.x):b(u.x[0]),x1:"x"===this._discrete?null:t=>t.x2?b(t.x2,"x2"):b(t.x),y:t=>t.y2?v(t.y2,"y2"):v(t.y),y0:"y"===this._discrete?t=>t.y2?v(t.y2,"y2"):v(t.y):v(u.y[1])-O,y1:"y"===this._discrete?null:t=>t.y2?v(t.y2,"y2"):v(t.y)-O}).select(e).render()}),this._previousAnnotations[i].filter(t=>!s.includes(t)).forEach(t=>{(new Wt[t]).data([]).select(e).render()}),this._previousAnnotations[i]=s}),this._discrete||"x"),T={discrete:this._discrete,duration:this._duration,label:t=>this._drawLabel(t.data,t.i),select:pt,x:t=>void 0!==t.x2?b(t.x2,"x2"):b(t.x),x0:"x"===L?t=>t.x2?b(t.x2,"x2"):b(t.x):b("number"==typeof this._baseline?this._baseline:u.x[0]),x1:"x"===L?null:t=>t.x2?b(t.x2,"x2"):b(t.x),y:t=>void 0!==t.y2?v(t.y2,"y2"):v(t.y),y0:"y"===L?t=>t.y2?v(t.y2,"y2"):v(t.y):v("number"==typeof this._baseline?this._baseline:u.y[1])-O,y1:"y"===L?null:t=>t.y2?v(t.y2,"y2"):v(t.y)-O},nt=Object.keys(this._on),$=(ct.forEach(n=>{var a=Object.assign({},T);if(this._stacked&&["Area","Bar"].includes(n.key)){let s="x"===c?b:v;a[""+c]=a[c+"0"]=t=>{var i=f.indexOf(t.id),e=N.indexOf(t.discrete),t=t[c]<0?1:0;return 0<=i?s(p[i][e][t]):s(u[c]["x"===c?0:1])},a[c+"1"]=t=>{var i=f.indexOf(t.id),e=N.indexOf(t.discrete),t=t[c]<0?0:1;return 0<=i?s(p[i][e][t]):s(u[c]["x"===c?0:1])}}var r=(new Wt[n.key]).config(a).data(n.values);if("Bar"===n.key){let t,i="x"===this._discrete?b:v;var a="x"===this._discrete?m:y,o="x"===this._discrete?C:w,l="x"===this._discrete?D:P;t="Point"!==a&&2===o.length?((a=Array.from(new Set(n.values.map(t=>i(t[this._discrete]))))).unshift(l[0]-a[0]-l[0]),a.push(l[1]+l[1]-a[a.length-1]),a.reduce((t,i,e,s)=>t=e&&(i=Math.abs(i-s[e-1]))<t?i:t,1/0)):1<o.length?i(o[1])-i(o[0]):l[l.length-1]-l[0],this._groupPadding<t&&(t-=this._groupPadding);let s=t||1;a=Ot.nest().key(t=>t[this._discrete]).key(t=>t.group).entries(n.values),o=Dt.merge(a.map(t=>t.values.map(t=>t.key)));let h=Array.from(new Set(o));if(1===Dt.max(a.map(t=>t.values.length)))r[this._discrete]((t,i)=>T[this._discrete](t,i));else{s=(s-this._barPadding*h.length-1)/h.length;l=t/2-s/2;let e=$t.scaleLinear().domain([0,h.length-1]).range([-l,l]);r[this._discrete]((t,i)=>T[this._discrete](t,i)+e(h.indexOf(t.group)))}r.width(s),r.height(s)}else if("Line"===n.key){if(r.duration(1.5*x),this._confidence){o=Object.assign({},T),a=this._discrete||"x";let i="x"===a?"y":"x",e="x"===a?v:b;o[i+"0"]=t=>e(this._confidence[0]?t.lci:t[i]),o[i+"1"]=t=>e(this._confidence[1]?t.hci:t[i]);l=(new Nt).config(o).data(n.values),a=Object.assign(this._shapeConfig,this._confidenceConfig);l.config(Pt.assign(jt.bind(this)(a,"shape","Line"),jt.bind(this)(a,"shape","Area"))).render(),this._shapes.push(l)}r.config({discrete:T.discrete||"x",label:!!it&&((e,t)=>{if("function"!=typeof this._lineLabels||this._lineLabels(e.data,e.i)){var s=A.find(t=>t.id===e.id);if(s){let i=s.newY||s.defaultY;s=A.filter(t=>t.newY===i);return 1<s.length?s[0].id===e.id&&`+${Tt.formatAbbreviate(s.length,this._locale)} `+this._translate("more"):this._drawLabel(e,t)}}return!1}),labelBounds:!!it&&((t,i,e)=>{var[s,h]=e.points[0],[e,n]=e.points[e.points.length-1],a=this._height/4;return{x:e-s,y:n-h-a/2-(et[t.id]?n-et[t.id]:0),width:tt,height:a}})})}let _=nt.filter(t=>t.includes("."+n.key)),d=nt.filter(t=>!t.includes(".")),g=nt.filter(t=>t.includes(".shape"));for(let h=0;h<d.length;h++)r.on(d[h],(t,i,e,s)=>this._on[d[h]](t.data,t.i,e,s));for(let h=0;h<g.length;h++)r.on(g[h],(t,i,e,s)=>this._on[g[h]](t.data,t.i,e,s));for(let h=0;h<_.length;h++)r.on(_[h],(t,i,e,s)=>this._on[_[h]](t.data,t.i,e,s));o=jt.bind(this)(this._shapeConfig,"shape",n.key);if(void 0===this._shapeConfig.duration&&delete o.duration,r.config(o).render(),this._shapes.push(r),"Line"===n.key){var t=(new Rt).data(this._lineMarkers?n.values:[]).config(T).config(this._lineMarkerConfig).id(t=>t.id+"_"+t.discrete);for(let h=0;h<d.length;h++)t.on(d[h],(t,i,e,s)=>this._on[d[h]](t.data,t.i,e,s));for(let h=0;h<g.length;h++)t.on(g[h],(t,i,e,s)=>this._on[g[h]](t.data,t.i,e,s));for(let h=0;h<_.length;h++)t.on(_[h],(t,i,e,s)=>this._on[_[h]](t.data,t.i,e,s));t.render(),this._shapes.push(t)}}),ct.map(t=>t.key));function At(e){let s=this[`_${e}Time`];var t=s?a:r,i=t.filter(t=>![NaN,void 0,!1].includes(t[e]));if(!i.length)return[];let h="number"==typeof i[0][e],n=this._discrete===e?Ot.nest().key(t=>t[e]).rollup(t=>1===t.length?t[0].data:Lt.merge(t.map(t=>t.data),this._aggs)).entries(i).sort((t,i)=>this[`_${e}Sort`]?this[`_${e}Sort`](t.value,i.value):(s||h?parseFloat(t.key,10):t.key)-(s||h?parseFloat(i.key,10):i.key)).map(t=>s?Pt.date(t.key):h?parseFloat(t.key,10):t.key):Lt.unique(i.sort((t,i)=>this[`_${e}Sort`]?this[`_${e}Sort`](t.data,i.data):t[e]-i[e]).map(t=>t[e]),t=>""+t);return n=this._discrete!==e.charAt(0)&&this._confidence&&(this._confidence[0]&&(n=n.concat(t.map(t=>t.lci))),this._confidence[1])?n.concat(t.map(t=>t.hci)):n}function Bt(t){var i=this[`_${t}Time`]?"Time":this._discrete===t||this[`_${t}Sort`]?"Point":"Linear",e=this[`_${t}Domain`]?this[`_${t}Domain`].slice():u[t],s=this[`_${t}2Domain`]?this[`_${t}2Domain`].slice():u[t+"2"];return"Point"!=i&&(e&&void 0===e[0]&&(e[0]=u[t][0]),e&&void 0===e[1]&&(e[1]=u[t][1]),s&&void 0===s[0]&&(s[0]=u[t+"2"][0]),s)&&void 0===s[1]&&(s[1]=u[t+"2"][1]),[e,i,s,i]}$.includes("Line")&&(this._confidence&&$.push("Area"),this._lineMarkers)&&$.push("Circle"),this._previousShapes.filter(t=>!$.includes(t)).forEach(t=>{(new Wt[t]).config(T).data([]).render()}),this._previousShapes=$}return this}
|
|
3451
3447
|
/**
|
|
3452
3448
|
@memberof Plot
|
|
3453
3449
|
@desc Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).
|
|
@@ -3710,7 +3706,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3710
3706
|
@memberof Plot
|
|
3711
3707
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3712
3708
|
@private
|
|
3713
|
-
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Pt.assign({},Xt,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(t,i)=>"function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,i):this._shapeConfig.Line.stroke,fillOpacity:Ht(.5)},this._discreteCutoff=100,this._groupPadding=5,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=Ht("auto"),this._lineMarkerConfig={fill:(t,i)=>A.colorAssign(this._id(t,i)),r:Ht(3)},this._lineMarkers=!1,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{Area:{label:(t,i)=>!!this._stacked&&this._drawLabel(t,i),labelBounds:(t,i,e)=>{let s=E.largestRect(e.points,{angle:Dt.range(-20,20,5)});if(!(s=!s||s.height<20||s.width<50?E.largestRect(e.points,{angle:Dt.range(-80,80,5)}):s))return null;let h=Dt.min(e.points,t=>t[0]);e=Dt.max(e.points.filter(t=>t[0]===h),t=>t[1]);return{angle:s.angle,width:s.width,height:s.height,x:s.cx-s.width/2-h,y:s.cy-s.height/2-e}},labelConfig:{fontMin:6,fontResize:!0,padding:10}},ariaLabel:(t,i)=>{let e="";return t.nested?e=""+this._drawLabel(t.data,t.i):(e=""+this._drawLabel(t,i),void 0!==this._x(t,i)&&(e+=", x: "+this._x(t,i)),void 0!==this._y(t,i)&&(e+=", y: "+this._y(t,i)),void 0!==this._x2(t,i)&&(e+=", x2: "+this._x2(t,i)),void 0!==this._y2(t,i)&&(e+=", y2: "+this._y2(t,i))),e+"."},Bar:{labelBounds(t,i,e){var s="y"===this._discrete?"width":"height",h="y"===this._discrete?"height":"width",n="x"===this._discrete.charAt(0)?"y":"x",
|
|
3709
|
+
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Pt.assign({},Xt,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(t,i)=>"function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,i):this._shapeConfig.Line.stroke,fillOpacity:Ht(.5)},this._discreteCutoff=100,this._groupPadding=5,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=Ht("auto"),this._lineMarkerConfig={fill:(t,i)=>A.colorAssign(this._id(t,i)),r:Ht(3)},this._lineMarkers=!1,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{Area:{label:(t,i)=>!!this._stacked&&this._drawLabel(t,i),labelBounds:(t,i,e)=>{let s=E.largestRect(e.points,{angle:Dt.range(-20,20,5)});if(!(s=!s||s.height<20||s.width<50?E.largestRect(e.points,{angle:Dt.range(-80,80,5)}):s))return null;let h=Dt.min(e.points,t=>t[0]);e=Dt.max(e.points.filter(t=>t[0]===h),t=>t[1]);return{angle:s.angle,width:s.width,height:s.height,x:s.cx-s.width/2-h,y:s.cy-s.height/2-e}},labelConfig:{fontMin:6,fontResize:!0,padding:10}},ariaLabel:(t,i)=>{let e="";return t.nested?e=""+this._drawLabel(t.data,t.i):(e=""+this._drawLabel(t,i),void 0!==this._x(t,i)&&(e+=", x: "+this._x(t,i)),void 0!==this._y(t,i)&&(e+=", y: "+this._y(t,i)),void 0!==this._x2(t,i)&&(e+=", x2: "+this._x2(t,i)),void 0!==this._y2(t,i)&&(e+=", y2: "+this._y2(t,i))),e+"."},Bar:{labelBounds(t,i,e){var s="y"===this._discrete?"width":"height",h="y"===this._discrete?"height":"width",n="x"===this._discrete.charAt(0)?"y":"x",a="y"==n,n=this._discrete.replace(this._discrete.charAt(0),n),r=this[`_${n}Axis`]._d3Scale.range(),r=Math.abs(r[1]-r[0]),n=this["_"+n](t,i)<0;return ei.bind(this)(t,i)?{[s]:r-e[s],[h]:e[h],x:a?-e.width/2:n?-r:e.width+1,y:a?n?e.height+1:-r:-e.height/2+1}:{[s]:e[s],[h]:e[h],x:a?-e.width/2:n?(this._stacked,1-e.width):-1,y:a?n?(this._stacked,1):1-e.height:-e.height/2+1}},labelConfig:{fontMax:16,fontMin:6,fontResize:!0,fontColor(t,i){return ei.bind(this)(t,i)?"transparent"===this._backgroundConfig.fill?A.colorDefaults.dark:A.colorContrast(this._backgroundConfig.fill):A.colorContrast("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,i):this._shapeConfig.fill)},fontStroke(t,i){return ei.bind(this)(t,i)?"transparent"===this._backgroundConfig.fill?A.colorDefaults.dark:A.colorContrast(this._backgroundConfig.fill):"transparent"},fontStrokeWidth(t,i){return ei.bind(this)(t,i)?.1:0},padding:3,textAnchor(t,i){var e="x"===this._discrete.charAt(0)?"y":"x",s="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,i)<0,s=s?"middle":ei.bind(this)(t,i)?e?"end":"start":e?"start":"end";return Pt.rtl()?"start"==s?"end":"end"==s?"start":s:s},verticalAlign(t,i){var e="x"===this._discrete.charAt(0)?"y":"x",s="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,i)<0;return s?ei.bind(this)(t,i)?e?"top":"bottom":e?"bottom":"top":"middle"}}},Circle:{r:Jt.bind(this)},Line:{curve:()=>this._discrete?"monotone"+this._discrete.charAt(0).toUpperCase():"linear",fill:Ht("none"),labelConfig:{fontColor:(t,i)=>{t="function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,i):this._shapeConfig.Line.stroke;return A.colorLegible(t)},fontResize:!1,padding:5,textAnchor:"start",verticalAlign:"middle"},strokeWidth:Ht(2)},Rect:{height:t=>2*Jt.bind(this)(t),width:t=>2*Jt.bind(this)(t)}}),this._shapeOrder=["Area","Path","Bar","Box","Line","Rect","Circle"],this._shapeSort=(t,i)=>this._shapeOrder.indexOf(t)-this._shapeOrder.indexOf(i),this._sizeMax=20,this._sizeMin=5,this._sizeScale="sqrt",this._stackOffset=ii,this._stackOrder=Zt,this._timelineConfig=Pt.assign(this._timelineConfig,{brushing:!0,brushMin:()=>this._xTime||this._yTime||this._x2Time||this._y2Time?2:1}),this._x=s("x"),this._xKey="x",this._xAxis=(new et).align("end"),this._xTest=(new et).align("end").gridSize(0),this._xConfig={gridConfig:{stroke:t=>this._discrete&&"x"===this._discrete.charAt(0)||this._xAxis.range()[0]===this._xAxis._getPosition.bind(this._xAxis)(t.id)?"transparent":Yt.colors.gray[200]}},this._xCutoff=150,this._x2=s("x2"),this._x2Key="x2",this._x2Axis=(new nt).align("start"),this._x2Test=(new nt).align("start").gridSize(0),this._x2Config={},this._y=s("y"),this._yKey="y",this._yAxis=(new st).align("start"),this._yKey="y",this._yTest=(new st).align("start").gridSize(0),this._yConfig={gridConfig:{stroke:t=>{var i;return this._discrete&&"y"===this._discrete.charAt(0)||(i=this._yAxis.range())[i.length-1]===this._yAxis._getPosition.bind(this._yAxis)(t.id)?"transparent":Yt.colors.gray[200]}}},this._yCutoff=150,this._y2=s("y2"),this._y2Key="y2",this._y2Axis=(new ht).align("end"),this._y2Test=(new st).align("end").gridSize(0),this._y2Config={}}}class hi extends si{
|
|
3714
3710
|
/**
|
|
3715
3711
|
@memberof AreaPlot
|
|
3716
3712
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
@@ -3720,12 +3716,12 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3720
3716
|
@memberof BarChart
|
|
3721
3717
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
3722
3718
|
@private
|
|
3723
|
-
*/constructor(){super(),this._baseline=0,this._discrete="x";let e=this._legend;this._legend=(t,i)=>i.map(this._groupBy[this._legendDepth].bind(this)).sort().join()!==this._filteredData.map(this._groupBy[this._legendDepth].bind(this)).sort().join()&&e.bind(this)(t,i),this._shape=Ht("Bar")}}class
|
|
3719
|
+
*/constructor(){super(),this._baseline=0,this._discrete="x";let e=this._legend;this._legend=(t,i)=>i.map(this._groupBy[this._legendDepth].bind(this)).sort().join()!==this._filteredData.map(this._groupBy[this._legendDepth].bind(this)).sort().join()&&e.bind(this)(t,i),this._shape=Ht("Bar")}}class ai extends si{
|
|
3724
3720
|
/**
|
|
3725
3721
|
@memberof BoxWhisker
|
|
3726
3722
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
3727
3723
|
@private
|
|
3728
|
-
*/constructor(){super(),this._discrete="x",this._shape=Ht("Box"),this._tooltipConfig=Pt.assign(this._tooltipConfig,{title:(t,i)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)i=(t=t.data).i;var e;return this._label?this._label(t,i):(e=this._ids(t,i).slice(0,this._drawDepth))[e.length-1]}})}}class
|
|
3724
|
+
*/constructor(){super(),this._discrete="x",this._shape=Ht("Box"),this._tooltipConfig=Pt.assign(this._tooltipConfig,{title:(t,i)=>{if(!t)return"";for(;t.__d3plus__&&t.data;)i=(t=t.data).i;var e;return this._label?this._label(t,i):(e=this._ids(t,i).slice(0,this._drawDepth))[e.length-1]}})}}class ri extends si{
|
|
3729
3725
|
/**
|
|
3730
3726
|
@memberof BumpChart
|
|
3731
3727
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
@@ -3734,7 +3730,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3734
3730
|
/**
|
|
3735
3731
|
Extends the draw behavior of the abstract Viz class.
|
|
3736
3732
|
@private
|
|
3737
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,e=Dt.min([i,t])/2,s=this._pieData=this._pie.padAngle(this._padAngle||this._padPixel/e).sort(this._sort).value(this._value)(this._filteredData),e=(s.forEach((t,i)=>{t.__d3plus__=!0,t.i=i}),
|
|
3733
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,e=Dt.min([i,t])/2,s=this._pieData=this._pie.padAngle(this._padAngle||this._padPixel/e).sort(this._sort).value(this._value)(this._filteredData),e=(s.forEach((t,i)=>{t.__d3plus__=!0,t.i=i}),m.arc().innerRadius(this._innerRadius).outerRadius(e)),i=`translate(${i/2+this._margin.left}, ${t/2+this._margin.top})`;return this._shapes.push((new B).data(s).d(e).select(Pt.elem("g.d3plus-Pie",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config({id:t=>this._ids(t).join("-"),x:0,y:0}).label(this._drawLabel).config(jt.bind(this)(this._shapeConfig,"shape","Path")).render()),this}
|
|
3738
3734
|
/**
|
|
3739
3735
|
@memberof Pie
|
|
3740
3736
|
@desc The pixel value, or function that returns a pixel value, that is used as the inner radius of the Pie (creating a Donut).
|
|
@@ -3770,7 +3766,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3770
3766
|
@memberof Pie
|
|
3771
3767
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
3772
3768
|
@private
|
|
3773
|
-
*/constructor(){super();let e=this._legend;this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._value(i)-this._value(t),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._pieData?`${++this._pieData[i].index}. ${this._drawLabel(t,i)}, ${this._value(t,i)}.`:"",Path:{labelConfig:{fontResize:!0}}}),this._innerRadius=0,this._legendSort=(t,i)=>this._value(i)-this._value(t),this._padPixel=0,this._pie=
|
|
3769
|
+
*/constructor(){super();let e=this._legend;this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._value(i)-this._value(t),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._pieData?`${++this._pieData[i].index}. ${this._drawLabel(t,i)}, ${this._value(t,i)}.`:"",Path:{labelConfig:{fontResize:!0}}}),this._innerRadius=0,this._legendSort=(t,i)=>this._value(i)-this._value(t),this._padPixel=0,this._pie=m.pie(),this._sort=(t,i)=>this._value(i)-this._value(t),this._value=s("value")}}class li extends oi{
|
|
3774
3770
|
/**
|
|
3775
3771
|
@memberof Donut
|
|
3776
3772
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
@@ -3795,7 +3791,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3795
3791
|
/**
|
|
3796
3792
|
Extends the draw behavior of the abstract Viz class.
|
|
3797
3793
|
@private
|
|
3798
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,s=(this._container=this._select.selectAll("svg.d3plus-geomap").data([0]),this._container=this._container.enter().append("svg").attr("class","d3plus-geomap").attr("opacity",0).attr("width",i).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color",this._ocean||"transparent").merge(this._container),this._container.transition(this._transition).attr("opacity",1).attr("width",i).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top),this._container.selectAll("rect.d3plus-geomap-ocean").data([0]));s.enter().append("rect").attr("class","d3plus-geomap-ocean").merge(s).attr("width",i).attr("height",t).attr("fill",this._ocean||"transparent"),this._tileGroup=this._container.selectAll("g.d3plus-geomap-tileGroup").data([0]),this._tileGroup=this._tileGroup.enter().append("g").attr("class","d3plus-geomap-tileGroup").merge(this._tileGroup),this._zoomGroup=this._container.selectAll("g.d3plus-geomap-zoomGroup").data([0]),this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-geomap-zoomGroup").merge(this._zoomGroup);let e=this._zoomGroup.selectAll("g.d3plus-geomap-paths").data([0]);e=e.enter().append("g").attr("class","d3plus-geomap-paths").merge(e);s=this._coordData=this._topojson?ci(this._topojson,this._topojsonKey):{type:"FeatureCollection",features:[]};this._topojsonFilter&&(s.features=s.features.filter(this._topojsonFilter));let
|
|
3794
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,s=(this._container=this._select.selectAll("svg.d3plus-geomap").data([0]),this._container=this._container.enter().append("svg").attr("class","d3plus-geomap").attr("opacity",0).attr("width",i).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color",this._ocean||"transparent").merge(this._container),this._container.transition(this._transition).attr("opacity",1).attr("width",i).attr("height",t).attr("x",this._margin.left).attr("y",this._margin.top),this._container.selectAll("rect.d3plus-geomap-ocean").data([0]));s.enter().append("rect").attr("class","d3plus-geomap-ocean").merge(s).attr("width",i).attr("height",t).attr("fill",this._ocean||"transparent"),this._tileGroup=this._container.selectAll("g.d3plus-geomap-tileGroup").data([0]),this._tileGroup=this._tileGroup.enter().append("g").attr("class","d3plus-geomap-tileGroup").merge(this._tileGroup),this._zoomGroup=this._container.selectAll("g.d3plus-geomap-zoomGroup").data([0]),this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-geomap-zoomGroup").merge(this._zoomGroup);let e=this._zoomGroup.selectAll("g.d3plus-geomap-paths").data([0]);e=e.enter().append("g").attr("class","d3plus-geomap-paths").merge(e);s=this._coordData=this._topojson?ci(this._topojson,this._topojsonKey):{type:"FeatureCollection",features:[]};this._topojsonFilter&&(s.features=s.features.filter(this._topojsonFilter));let r=this._path=di.geoPath().projection(this._projection);var h=this._filteredData.filter((t,i)=>this._point(t,i)instanceof Array);let n=this._filteredData.filter((t,i)=>!(this._point(t,i)instanceof Array)).reduce((t,i)=>(t[this._id(i)]=i,t),{});var a=s.features.reduce((t,i)=>{var e=this._topojsonId(i);return t.push({__d3plus__:!0,data:n[e],feature:i,id:e}),t},[]);let o=$t["scale"+this._pointSizeScale.charAt(0).toUpperCase()+this._pointSizeScale.slice(1)]().domain(Dt.extent(h,(t,i)=>this._pointSize(t,i))).range([this._pointSizeMin,this._pointSizeMax]);if(!this._zoomSet){s=this._fitObject?ci(this._fitObject,this._fitKey):s;if(this._extentBounds={type:"FeatureCollection",features:this._fitFilter?s.features.filter(this._fitFilter):s.features.slice()},this._extentBounds.features=this._extentBounds.features.reduce((t,a)=>{if(a.geometry){let e={type:a.type,id:a.id,geometry:{coordinates:a.geometry.coordinates,type:a.geometry.type}};if("MultiPolygon"===a.geometry.type&&1<a.geometry.coordinates.length){let s=[],h=[],i=(a.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],s.push(r.area(e))}),e.geometry.coordinates=[a.geometry.coordinates[s.indexOf(Dt.max(s))]],r.centroid(e)),n=(a.geometry.coordinates.forEach(t=>{e.geometry.coordinates=[t],h.push(E.pointDistance(r.centroid(e),i))}),Dt.quantile(s.reduce((t,i,e)=>(i&&t.push(s[e]/i),t),[]),.9));e.geometry.coordinates=a.geometry.coordinates.filter((t,i)=>{var e=h[i];return 0===e||s[i]/e>=n})}t.push(e)}return t},[]),!this._extentBounds.features.length&&h.length){let e=[[void 0,void 0],[void 0,void 0]];h.forEach((t,i)=>{t=this._projection(this._point(t,i));(void 0===e[0][0]||t[0]<e[0][0])&&(e[0][0]=t[0]),(void 0===e[1][0]||t[0]>e[1][0])&&(e[1][0]=t[0]),(void 0===e[0][1]||t[1]<e[0][1])&&(e[0][1]=t[1]),(void 0===e[1][1]||t[1]>e[1][1])&&(e[1][1]=t[1])}),this._extentBounds={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"MultiPoint",coordinates:e.map(t=>this._projection.invert(t))}}]};s=Dt.max(h,(t,i)=>o(this._pointSize(t,i)));this._projectionPadding.top+=s,this._projectionPadding.right+=s,this._projectionPadding.bottom+=s,this._projectionPadding.left+=s}this._zoomBehavior.extent([[0,0],[i,t]]).scaleExtent([1,this._zoomMax]).translateExtent([[0,0],[i,t]]),this._zoomSet=!0}this._projection=this._projection.fitExtent(this._extentBounds.features.length?[[this._projectionPadding.left,this._projectionPadding.top],[i-this._projectionPadding.right,t-this._projectionPadding.bottom]]:[[0,0],[i,t]],this._extentBounds.features.length?this._extentBounds:{type:"Sphere"}),this._shapes.push((new B).data(a).d(t=>r(t.feature)).select(e.node()).x(0).y(0).config(jt.bind(this)(this._shapeConfig,"shape","Path")).render());let l=this._zoomGroup.selectAll("g.d3plus-geomap-pins").data([0]);l=l.enter().append("g").attr("class","d3plus-geomap-pins").merge(l);var _=(new Rt).config(jt.bind(this)(this._shapeConfig,"shape","Circle")).data(h).r((t,i)=>o(this._pointSize(t,i))).select(l.node()).sort((t,i)=>this._pointSize(i)-this._pointSize(t)).x((t,i)=>this._projection(this._point(t,i))[0]).y((t,i)=>this._projection(this._point(t,i))[1]),s=Object.keys(this._on),d=s.filter(t=>t.includes(".Circle")),g=s.filter(t=>!t.includes(".")),c=s.filter(t=>t.includes(".shape"));for(let t=0;t<g.length;t++)_.on(g[t],this._on[g[t]]);for(let t=0;t<c.length;t++)_.on(c[t],this._on[c[t]]);for(let t=0;t<d.length;t++)_.on(d[t],this._on[d[t]]);return this._shapes.push(_.render()),this}
|
|
3799
3795
|
/**
|
|
3800
3796
|
@memberof Geomap
|
|
3801
3797
|
@desc Topojson files sometimes include small geographies that negatively impact how the library determines the default zoom level (for example, a small island or territory far off the coast that is barely visible to the eye). The fitFilter method can be used to remove specific geographies from the logic used to determine the zooming.
|
|
@@ -3934,7 +3930,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
3934
3930
|
@memberof Matrix
|
|
3935
3931
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
3936
3932
|
@private
|
|
3937
|
-
*/_draw(o){var{rowValues:l,columnValues:_,shapeData:d}=fi.bind(this)(this._filteredData);if(l.length&&_.length){let t=this._height-this._margin.top-this._margin.bottom,e=this._select,s=this._transition,i=this._width-this._margin.left-this._margin.right;var g={opacity:0},c={opacity:1},u=i/_.length<120,p=(t,i)=>Pt.elem("g.d3plus-Matrix-"+t,Object.assign({parent:e,transition:s},i)).node(),f=(this._rowAxis.select(p("row",{enter:g,update:g})).domain(l).height(t-this._margin.top-this._margin.bottom-this._padding.bottom-this._padding.top).maxSize(i/4).width(i).config(this._rowConfig).render(),this._rowAxis.outerBounds().width),m=(this._padding.left+=f,`translate(0, ${this._margin.top})`),g=Object.assign({transform:m},g),g=(this._columnAxis.select(p("column",{enter:g,update:g})).domain(_).range([this._margin.left+this._padding.left,i-this._margin.right+this._padding.right]).height(t).maxSize(t/4).width(i).labelRotation(u).config(this._columnConfig).render(),this._columnAxis.outerBounds().height),u=(this._padding.top+=g,super._draw(o),`translate(${this._margin.left}, ${this._margin.top})`),m=`translate(0, ${this._margin.top})`,o=Object.assign({transform:m},c);this._rowAxis.select(p("row",{update:Object.assign({transform:u},c)})).height(t-this._margin.top-this._margin.bottom-this._padding.bottom).maxSize(f).range([g+this._columnAxis.padding(),void 0]).render(),this._columnAxis.select(p("column",{update:o})).range([this._margin.left+this._padding.left+this._rowAxis.padding(),i-this._margin.right+this._padding.right]).maxSize(g).render();let h=this._rowAxis._getPosition.bind(this._rowAxis),n=this._columnAxis._getPosition.bind(this._columnAxis),
|
|
3933
|
+
*/_draw(o){var{rowValues:l,columnValues:_,shapeData:d}=fi.bind(this)(this._filteredData);if(l.length&&_.length){let t=this._height-this._margin.top-this._margin.bottom,e=this._select,s=this._transition,i=this._width-this._margin.left-this._margin.right;var g={opacity:0},c={opacity:1},u=i/_.length<120,p=(t,i)=>Pt.elem("g.d3plus-Matrix-"+t,Object.assign({parent:e,transition:s},i)).node(),f=(this._rowAxis.select(p("row",{enter:g,update:g})).domain(l).height(t-this._margin.top-this._margin.bottom-this._padding.bottom-this._padding.top).maxSize(i/4).width(i).config(this._rowConfig).render(),this._rowAxis.outerBounds().width),m=(this._padding.left+=f,`translate(0, ${this._margin.top})`),g=Object.assign({transform:m},g),g=(this._columnAxis.select(p("column",{enter:g,update:g})).domain(_).range([this._margin.left+this._padding.left,i-this._margin.right+this._padding.right]).height(t).maxSize(t/4).width(i).labelRotation(u).config(this._columnConfig).render(),this._columnAxis.outerBounds().height),u=(this._padding.top+=g,super._draw(o),`translate(${this._margin.left}, ${this._margin.top})`),m=`translate(0, ${this._margin.top})`,o=Object.assign({transform:m},c);this._rowAxis.select(p("row",{update:Object.assign({transform:u},c)})).height(t-this._margin.top-this._margin.bottom-this._padding.bottom).maxSize(f).range([g+this._columnAxis.padding(),void 0]).render(),this._columnAxis.select(p("column",{update:o})).range([this._margin.left+this._padding.left+this._rowAxis.padding(),i-this._margin.right+this._padding.right]).maxSize(g).render();let h=this._rowAxis._getPosition.bind(this._rowAxis),n=this._columnAxis._getPosition.bind(this._columnAxis),a=1<l.length?h(l[1])-h(l[0]):this._rowAxis.height(),r=1<_.length?n(_[1])-n(_[0]):this._columnAxis.width();m=`translate(0, ${this._margin.top})`,u=jt.bind(this)(this._shapeConfig,"shape","Rect");this._shapes.push((new Ft).data(d).select(Pt.elem("g.d3plus-Matrix-cells",{parent:this._select,enter:{transform:m},update:{transform:m}}).node()).config({height:a-this._cellPadding,width:r-this._cellPadding,x:t=>n(t.column)+r/2,y:t=>h(t.row)+a/2}).config(u).render())}return this}
|
|
3938
3934
|
/**
|
|
3939
3935
|
@memberof Matrix
|
|
3940
3936
|
@desc The pixel padding in between each cell.
|
|
@@ -4002,7 +3998,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4002
3998
|
@memberof Matrix
|
|
4003
3999
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4004
4000
|
@private
|
|
4005
|
-
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnAxis=new o,this._columnConfig=Pt.assign({orient:"top"},mi),this._columnSort=(t,i)=>(""+t).localeCompare(""+i),this._label=(t,i)=>
|
|
4001
|
+
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnAxis=new o,this._columnConfig=Pt.assign({orient:"top"},mi),this._columnSort=(t,i)=>(""+t).localeCompare(""+i),this._label=(t,i)=>r.bind(this)("row",t,i)+" / "+r.bind(this)("column",t,i);let a=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,i,e,s)=>{a(t,i,e,s);let h=r.bind(this)("row",t,i),n=r.bind(this)("column",t,i);this.hover((t,i)=>r.bind(this)("row",t,i)===h||r.bind(this)("column",t,i)===n)},this._row=s("row"),this._rowAxis=new o,this._rowConfig=Pt.assign({orient:"left"},mi),this._rowSort=(t,i)=>(""+t).localeCompare(""+i)}}
|
|
4006
4002
|
/**
|
|
4007
4003
|
* Fetches the unique ID for a data point, whether it's defined by data or nodes.
|
|
4008
4004
|
* @private
|
|
@@ -4010,7 +4006,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4010
4006
|
/**
|
|
4011
4007
|
Extends the draw behavior of the abstract Viz class.
|
|
4012
4008
|
@private
|
|
4013
|
-
*/_draw(t){super._draw(t);var t=this._duration,i=this._height-this._margin.top-this._margin.bottom,e=`translate(${this._margin.left}, ${this._margin.top})`,s=this._width-this._margin.left-this._margin.right;let h=this._filteredData.reduce((t,i,e)=>(t[this._id(i,e)]=i,t),{}),n=this._nodes.reduce((t,i,e)=>(t[xi.bind(this)(i,e)]=i,t),{}),
|
|
4009
|
+
*/_draw(t){super._draw(t);var t=this._duration,i=this._height-this._margin.top-this._margin.bottom,e=`translate(${this._margin.left}, ${this._margin.top})`,s=this._width-this._margin.left-this._margin.right;let h=this._filteredData.reduce((t,i,e)=>(t[this._id(i,e)]=i,t),{}),n=this._nodes.reduce((t,i,e)=>(t[xi.bind(this)(i,e)]=i,t),{}),a=(n=Array.from(new Set(Object.keys(h).concat(Object.keys(n)))).map((t,i)=>{var e=h[t],s=n[t];return void 0!==s&&{__d3plus__:!0,data:e||s,i:i,id:t,fx:void 0===e||isNaN(this._x(e))?this._x(s):this._x(e),fy:void 0===e||isNaN(this._y(e))?this._y(s):this._y(e),node:s,r:this._size?void 0!==e&&void 0!==this._size(e)?this._size(e):this._size(s):this._sizeMin,shape:void 0!==e&&void 0!==this._shape(e)?this._shape(e):this._shape(s)}}).filter(t=>t),this._nodeLookup=n.reduce((t,i)=>(t[i.id]=i,t),{})),r=n.map(t=>t.node);var o=this._links.map(t=>{var i=typeof t.source;return{size:this._linkSize(t),source:"number"==i?n[r.indexOf(this._nodes[t.source])]:"string"==i?a[t.source]:a[t.source.id],target:"number"==i?n[r.indexOf(this._nodes[t.target])]:"string"==i?a[t.target]:a[t.target.id]}}),l=(this._linkLookup=o.reduce((t,i)=>(t[i.source.id]||(t[i.source.id]=[]),t[i.source.id].push(i.target),t[i.target.id]||(t[i.target.id]=[]),t[i.target.id].push(i.source),t),{}),n.some(t=>void 0===t.fx||void 0===t.fy));if(l){let i=$t.scaleLinear().domain(Dt.extent(o,t=>t.size)).range([.1,.5]);var l=D.forceSimulation().force("link",D.forceLink(o).id(t=>t.id).distance(1).strength(t=>i(t.size)).iterations(4)).force("charge",D.forceManyBody().strength(-1)).stop(),_=1-Math.pow(.001,.01),_=(l.velocityDecay(0),l.alphaMin(.001),l.alphaDecay(_),l.alphaDecay(0),l.nodes(n),l.tick(100).stop(),n.map(t=>[t.vx,t.vy]));let e=0,s=0,h=0;2===_.length?e=100:2<_.length&&(l=O.polygonHull(_),_=E.largestRect(l,{verbose:!0}),e=_.angle,s=_.cx,h=_.cy),n.forEach(t=>{var i=E.pointRotate([t.vx,t.vy],Math.PI/180*e*-1,[s,h]);t.fx=i[0],t.fy=i[1]})}l=Dt.extent(n.map(t=>t.fx)),_=Dt.extent(n.map(t=>t.fy));let d=$t.scaleLinear().domain(l).range([0,s]),g=$t.scaleLinear().domain(_).range([0,i]);var l=(l[1]-l[0])/(_[1]-_[0])||1,_=s/i,c=(_<l?(c=i*_/l,g.range([(i-c)/2,i-(i-c)/2])):(c=s*l/_,d.range([(s-c)/2,s-(s-c)/2])),n.forEach(t=>{t.x=d(t.fx),t.y=g(t.fy)}),Dt.extent(n.map(t=>t.r))),u=this._sizeMax||Dt.max([1,Dt.min(Dt.merge(n.map(i=>n.map(t=>i===t?null:E.pointDistance([i.x,i.y],[t.x,t.y])))))/2]);let p=$t["scale"+this._sizeScale.charAt(0).toUpperCase()+this._sizeScale.slice(1)]().domain(c).range([c[0]===c[1]?u:Dt.min([u/2,this._sizeMin]),u]),f=d.domain(),m=g.domain();var y=f[1]-f[0],x=m[1]-m[0],b=(n.forEach(t=>{var i=p(t.r);f[0]>d.invert(t.x-i)&&(f[0]=d.invert(t.x-i)),f[1]<d.invert(t.x+i)&&(f[1]=d.invert(t.x+i)),m[0]>g.invert(t.y-i)&&(m[0]=g.invert(t.y-i)),m[1]<g.invert(t.y+i)&&(m[1]=g.invert(t.y+i))}),f[1]-f[0]),v=m[1]-m[0];u*=Dt.min([y/b,x/v]),p.range([c[0]===c[1]?u:Dt.min([u/2,this._sizeMin]),u]),d.domain(f),g.domain(m);let C=(_<l?s:i)/2;n.forEach(t=>{t.x=d(t.fx),t.fx=t.x,t.y=g(t.fy),t.fy=t.y,t.r=p(t.r)||C,t.width=2*t.r,t.height=2*t.r}),this._container=this._select.selectAll("svg.d3plus-network").data([0]),this._container=this._container.enter().append("svg").attr("class","d3plus-network").attr("opacity",0).attr("width",s).attr("height",i).attr("x",this._margin.left).attr("y",this._margin.top).style("background-color","transparent").merge(this._container),this._container.transition().duration(t).attr("opacity",1).attr("width",s).attr("height",i).attr("x",this._margin.left).attr("y",this._margin.top);y=this._container.selectAll("rect.d3plus-network-hitArea").data([0]),y.enter().append("rect").attr("class","d3plus-network-hitArea").merge(y).attr("width",s).attr("height",i).attr("fill","transparent").on("click",()=>{this._focus&&(this.active(!1),this._focus=void 0,this._zoomToBounds(null))}),this._zoomGroup=this._container.selectAll("g.d3plus-network-zoomGroup").data([0]),b=this._zoomGroup=this._zoomGroup.enter().append("g").attr("class","d3plus-network-zoomGroup").merge(this._zoomGroup),x=Dt.extent(o,t=>t.size);if(x[0]!==x[1]){let i=$t["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(x).range([this._linkSizeMin,p.range()[0]]);o.forEach(t=>{t.size=i(t.size)})}v=jt.bind(this)(this._shapeConfig,"edge","Path");delete v.on,this._shapes.push((new B).config(v).strokeWidth(t=>t.size).activeStyle({"stroke-width":t=>t.size}).d(t=>`M${t.source.x},${t.source.y} ${t.target.x},`+t.target.y).data(o).select(Pt.elem("g.d3plus-network-links",{parent:b,duration:t,enter:{transform:e},update:{transform:e}}).node()).render());let w={label:t=>!!(n.length<=this._dataCutoff||this._hover&&this._hover(t)||this._active&&this._active(t))&&this._drawLabel(t.data||t.node,t.i),select:Pt.elem("g.d3plus-network-nodes",{parent:b,duration:t,enter:{transform:e},update:{transform:e}}).node()};return Ot.nest().key(t=>t.shape).entries(n).forEach(t=>{this._shapes.push((new Wt[t.key]).config(jt.bind(this)(this._shapeConfig,"shape",t.key)).config(w).config(w[t.key]||{}).data(t.values).render())}),this}
|
|
4014
4010
|
/**
|
|
4015
4011
|
@memberof Network
|
|
4016
4012
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -4102,11 +4098,11 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4102
4098
|
@memberof Network
|
|
4103
4099
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4104
4100
|
@private
|
|
4105
|
-
*/constructor(){super(),this._links=[],this._linkSize=Ht(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodeGroupBy=[s("id")],this._nodes=[],this._on["click.shape"]=(t,
|
|
4101
|
+
*/constructor(){super(),this._links=[],this._linkSize=Ht(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodeGroupBy=[s("id")],this._nodes=[],this._on["click.shape"]=(t,a,i,e)=>{if(this._tooltipClass.data([]).render(),this._hover&&this._drawDepth>=this._groupBy.length-1){let n=xi.bind(this)(t,a);if(this._focus&&this._focus===n)this.active(!1),this._on.mouseenter.bind(this)(t,a,i,e),this._focus=void 0,this._zoomToBounds(null);else{this.hover(!1);t=this._linkLookup[n],a=this._nodeLookup[n];let e=[n],i=[a.x-a.r,a.x+a.r],s=[a.y-a.r,a.y+a.r],h=(t.forEach(t=>{e.push(t.id),t.x-t.r<i[0]&&(i[0]=t.x-t.r),t.x+t.r>i[1]&&(i[1]=t.x+t.r),t.y-t.r<s[0]&&(s[0]=t.y-t.r),t.y+t.r>s[1]&&(s[1]=t.y+t.r)}),this.active((t,i)=>t.source&&t.target?t.source.id===n||t.target.id===n:e.includes(xi.bind(this)(t,i))),this._focus=n,d.zoomTransform(this._container.node()));i=i.map(t=>t*h.k+h.x),s=s.map(t=>t*h.k+h.y),this._zoomToBounds([[i[0],s[0]],[i[1],s[1]]])}}},this._on["click.legend"]=(t,i,e,s)=>{var n=this._id(t),a=(a=this._ids(t))[a.length-1];if(this._hover&&this._drawDepth>=this._groupBy.length-1){if(this._focus&&this._focus===n)this.active(!1),this._focus=void 0,this._zoomToBounds(null);else{this.hover(!1);var r=n.map(t=>this._nodeLookup[t]);let e=[""+a],i=[r[0].x-r[0].r,r[0].x+r[0].r],s=[r[0].y-r[0].r,r[0].y+r[0].r],h=(r.forEach(t=>{e.push(t.id),t.x-t.r<i[0]&&(i[0]=t.x-t.r),t.x+t.r>i[1]&&(i[1]=t.x+t.r),t.y-t.r<s[0]&&(s[0]=t.y-t.r),t.y+t.r>s[1]&&(s[1]=t.y+t.r)}),this.active((t,i)=>t.source&&t.target?e.includes(t.source.id)&&e.includes(t.target.id):(t=this._ids(t,i),e.includes(""+t[t.length-1]))),this._focus=n,d.zoomTransform(this._container.node()));i=i.map(t=>t*h.k+h.x),s=s.map(t=>t*h.k+h.y),this._zoomToBounds([[i[0],s[0]],[i[1],s[1]]])}this._on.mouseenter.bind(this)(t,i,e,s),this._on["mousemove.legend"].bind(this)(t,i,e,s)}},this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let _=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,i,e,s)=>{_(t,i,e,s);let h=xi.bind(this)(t,i),n=this._linkLookup[h]||[],a=this._nodeLookup[h],r=[h],o=[a.x-a.r,a.x+a.r],l=[a.y-a.r,a.y+a.r];n.forEach(t=>{r.push(t.id),t.x-t.r<o[0]&&(o[0]=t.x-t.r),t.x+t.r>o[1]&&(o[1]=t.x+t.r),t.y-t.r<l[0]&&(l[0]=t.y-t.r),t.y+t.r>l[1]&&(l[1]=t.y+t.r)}),this.hover((t,i)=>t.source&&t.target?t.source.id===h||t.target.id===h:r.includes(""+this._ids(t,i)[this._drawDepth]))},this._sizeMin=5,this._sizeScale="sqrt",this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>{var e=this._size?", "+this._size(t,i):"";return this._drawLabel(t,i)+e+"."},labelConfig:{duration:0,fontMin:1,fontResize:!0,labelPadding:0,textAnchor:"middle",verticalAlign:"middle"},Path:{fill:"none",label:!1,stroke:"#eee"}}),this._x=s("x"),this._y=s("y"),this._zoom=!0}}let vi=(t,i=[])=>(t.values?t.values.forEach(t=>{i.push(t),vi(t,i)}):i.push(t),i);class Ci extends _{
|
|
4106
4102
|
/**
|
|
4107
4103
|
Extends the draw behavior of the abstract Viz class.
|
|
4108
4104
|
@private
|
|
4109
|
-
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,e=Math.min(t,i),i=`translate(${(i-e)/2}, ${(t-e)/2})`;let s=Ot.nest();for(let t=0;t<=this._drawDepth;t++)s.key(this._groupBy[t]);s=s.entries(this._filteredData);t=this._pack.padding(this._layoutPadding).size([e,e])(
|
|
4105
|
+
*/_draw(t){super._draw(t);var t=this._height-this._margin.top-this._margin.bottom,i=this._width-this._margin.left-this._margin.right,e=Math.min(t,i),i=`translate(${(i-e)/2}, ${(t-e)/2})`;let s=Ot.nest();for(let t=0;t<=this._drawDepth;t++)s.key(this._groupBy[t]);s=s.entries(this._filteredData);t=this._pack.padding(this._layoutPadding).size([e,e])(f.hierarchy({key:s.key,values:s},t=>t.values).sum(this._sum).sort(this._sort)).descendants().filter((t,i)=>(t.__d3plus__=!0,t.i=i,t.id=t.parent?t.parent.data.key:"root",t.data.__d3plusOpacity__=t.height?this._packOpacity(t.data,i):1,t.data.__d3plusTooltip__=!t.height,!t.children||1<t.children.length));return this._shapes.push((new Rt).data(t).select(Pt.elem("g.d3plus-Pack",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(jt.bind(this)(this._shapeConfig,"shape","Circle")).render()),this}
|
|
4110
4106
|
/**
|
|
4111
4107
|
@memberof Pack
|
|
4112
4108
|
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
@@ -4145,12 +4141,12 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4145
4141
|
@memberof Pack
|
|
4146
4142
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4147
4143
|
@private
|
|
4148
|
-
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,
|
|
4144
|
+
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,a=(this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._on.mouseenter=()=>{},this._on["mousemove.legend"]),n=(this._on["mousemove.legend"]=(e,t,i,s)=>{a(e,t,i,s);let h=this._ids(e,t),n=vi(e);this.hover(i=>(Object.keys(i).filter(t=>"value"!==t).every(t=>e[t]&&e[t].includes(i[t]))?n.push(i):h.includes(i.key)&&n.push(...vi(i,[i])),n.includes(i)))},this._on["mousemove.shape"]);this._on["mousemove.shape"]=(t,i,e,s)=>{t.__d3plusTooltip__&&n(t,i,e,s);let h=vi(t,[t]);this.hover(t=>h.includes(t))},this._pack=f.pack(),this._packOpacity=Ht(.25),this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{Circle:{label:t=>!(!t.parent||t.children)&&t.id,labelConfig:{fontResize:!0},opacity:t=>t.__d3plusOpacity__}}),this._sort=(t,i)=>i.value-t.value,this._sum=s("value")}}class wi extends _{
|
|
4149
4145
|
/**
|
|
4150
4146
|
@memberof Priestley
|
|
4151
4147
|
@desc Extends the render behavior of the abstract Viz class.
|
|
4152
4148
|
@private
|
|
4153
|
-
*/_draw(n){if(super._draw(n),this._filteredData){n=this._filteredData.map((t,i)=>({__d3plus__:!0,data:t,end:"time"===this._axisConfig.scale?Pt.date(this._end(t,i)):this._end(t,i),i:i,id:this._id(t,i),start:"time"===this._axisConfig.scale?Pt.date(this._start(t,i)):this._start(t,i)})).filter(t=>0<t.end-t.start).sort((t,i)=>t.start-i.start);let t;if(1<this._groupBy.length&&0<this._drawDepth){var
|
|
4149
|
+
*/_draw(n){if(super._draw(n),this._filteredData){n=this._filteredData.map((t,i)=>({__d3plus__:!0,data:t,end:"time"===this._axisConfig.scale?Pt.date(this._end(t,i)):this._end(t,i),i:i,id:this._id(t,i),start:"time"===this._axisConfig.scale?Pt.date(this._start(t,i)):this._start(t,i)})).filter(t=>0<t.end-t.start).sort((t,i)=>t.start-i.start);let t;if(1<this._groupBy.length&&0<this._drawDepth){var a=Ot.nest();for(let i=0;i<this._drawDepth;i++)a.key(t=>this._groupBy[i](t.data,t.i));t=a.entries(n)}else t=[{values:n}];let s=0;t.forEach(t=>{let e=[];t.values.forEach(i=>{var t=(e=e.map(t=>!(t<=i.start)&&t)).indexOf(!1);t<0?(i.lane=s+e.length,e.push(i.end)):(e[t]=i.end,i.lane=s+t)}),s+=e.length});var r={domain:[Dt.min(n,t=>t.start)||0,Dt.max(n,t=>t.end)||0],height:this._height-this._margin.top-this._margin.bottom,width:this._width-this._margin.left-this._margin.right},o=`translate(${this._margin.left}, ${this._margin.top})`,r=(this._axisTest.config(r).config(this._axisConfig).select(Pt.elem("g.d3plus-priestley-axis-test",{parent:this._select,enter:{opacity:0}}).node()).render(),this._axis.config(r).config(this._axisConfig).select(Pt.elem("g.d3plus-priestley-axis",{parent:this._select,enter:{transform:o},update:{transform:o}}).node()).render(),this._axisTest._padding);let i=this._axis._d3Scale,e=S.scaleBand().domain(Dt.range(0,s,1)).paddingInner(this._paddingInner).paddingOuter(this._paddingOuter).rangeRound([this._height-this._margin.bottom-this._axisTest.outerBounds().height-r,this._margin.top+r]),h=e.bandwidth();this._shapes.push((new Ft).data(n).duration(this._duration).height(h).label((t,i)=>this._drawLabel(t.data,i)).select(Pt.elem("g.d3plus-priestley-shapes",{parent:this._select}).node()).width(t=>{t=Math.abs(i(t.end)-i(t.start));return 2<t?t-2:t}).x(t=>i(t.start)+(i(t.end)-i(t.start))/2).y(t=>e(t.lane)+h/2).config(jt.bind(this)(this._shapeConfig,"shape","Rect")).render())}return this}
|
|
4154
4150
|
/**
|
|
4155
4151
|
@memberof Priestley
|
|
4156
4152
|
@desc If *value* is specified, sets the config method for the axis and returns the current class instance. If *value* is not specified, returns the current axis configuration.
|
|
@@ -4189,7 +4185,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4189
4185
|
/**
|
|
4190
4186
|
Extends the draw behavior of the abstract Viz class.
|
|
4191
4187
|
@private
|
|
4192
|
-
*/_draw(t){super._draw(t);let l=this._height-this._margin.top-this._margin.bottom,_=this._width-this._margin.left-this._margin.right,d=Dt.min([l,_])/2-this._outerPadding,i=`translate(${_/2}, ${l/2})`;var t=Ot.nest().key(this._metric).entries(this._filteredData),e=Ot.nest().key(this._id).key(this._metric).entries(this._filteredData);let s=Dt.max(e.map(t=>t.values.map(t=>Dt.sum(t.values,(t,i)=>this._value(t,i)))).flat());var h=Array.from(Array(this._levels).keys()).map(t=>({id:t,r:d*((t+1)/this._levels)})),n=jt.bind(this)(this._axisConfig.shapeConfig,"shape","Circle");delete n.label,(new Rt).data(h).select(Pt.elem("g.d3plus-Radar-radial-circles",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(n).render();let g=t.length;var h=t.map((t,i)=>{var e=this._outerPadding,s=2*(1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(t,i)||11)),h=parseInt(360-360/g*i/90,10)%4+1,n=ki/g*i;let
|
|
4188
|
+
*/_draw(t){super._draw(t);let l=this._height-this._margin.top-this._margin.bottom,_=this._width-this._margin.left-this._margin.right,d=Dt.min([l,_])/2-this._outerPadding,i=`translate(${_/2}, ${l/2})`;var t=Ot.nest().key(this._metric).entries(this._filteredData),e=Ot.nest().key(this._id).key(this._metric).entries(this._filteredData);let s=Dt.max(e.map(t=>t.values.map(t=>Dt.sum(t.values,(t,i)=>this._value(t,i)))).flat());var h=Array.from(Array(this._levels).keys()).map(t=>({id:t,r:d*((t+1)/this._levels)})),n=jt.bind(this)(this._axisConfig.shapeConfig,"shape","Circle");delete n.label,(new Rt).data(h).select(Pt.elem("g.d3plus-Radar-radial-circles",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(n).render();let g=t.length;var h=t.map((t,i)=>{var e=this._outerPadding,s=2*(1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(t,i)||11)),h=parseInt(360-360/g*i/90,10)%4+1,n=ki/g*i;let a=360/g*i,r="start",o=10;2!=h&&3!=h||(o=-e-10,r="end",a+=180);h={x:o,y:-s/2,width:e,height:s};return{__d3plus__:!0,data:Lt.merge(t.values,this._aggs),i:i,id:t.key,angle:a,textAnchor:r,labelBounds:h,rotateAnchor:[-o,s/2],x:d*Math.cos(n),y:d*Math.sin(n)}}).sort((t,i)=>t.key-i.key),n=((new Ft).data(h).rotate(t=>t.angle||0).width(0).height(0).x(t=>t.x).y(t=>t.y).label(t=>t.id).labelBounds(t=>t.labelBounds).labelConfig(this._axisConfig.shapeConfig.labelConfig).select(Pt.elem("g.d3plus-Radar-text",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).render(),(new B).data(h).d(t=>`M0,0 ${-t.x},`+-t.y).select(Pt.elem("g.d3plus-Radar-axis",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(jt.bind(this)(this._axisConfig.shapeConfig,"shape","Path")).render(),e.map(t=>{var i=t.values.map((t,i)=>{t=Dt.sum(t.values,(t,i)=>this._value(t,i))/s*d,i=ki/g*i;return{x:t*Math.cos(i),y:t*Math.sin(i)}}),e=`M ${i[0].x} ${i[0].y} ${i.map(t=>`L ${t.x} `+t.y).join(" ")} L ${i[0].x} `+i[0].y;return{arr:t.values.map(t=>Lt.merge(t.values,this._aggs)),id:t.key,points:i,d:e,__d3plus__:!0,data:Lt.merge(t.values.map(t=>Lt.merge(t.values,this._aggs)),this._aggs)}})),a=jt.bind(this)(this._shapeConfig,"shape","Path"),r=Object.keys(a.on);a.on={};for(let t=0;t<r.length;t++){let o=r[t];a.on[o]=(t,i,e,s)=>{var h=t.points.map(t=>t.x+_/2),n=t.points.map(t=>t.y+l/2);let a=j.pointer(s,this._select.node());h=h.map(t=>Math.abs(t-a[0]));let r=n.map(t=>Math.abs(t-a[1]));n=h.map((t,i)=>t+r[i]);this._on[o].bind(this)(t.arr[n.indexOf(Dt.min(n))],i,e,s)}}return this._shapes.push((new B).data(n).d(t=>t.d).select(Pt.elem("g.d3plus-Radar-items",{parent:this._select,enter:{transform:i},update:{transform:i}}).node()).config(a).render()),this}
|
|
4193
4189
|
/**
|
|
4194
4190
|
@memberof Radar
|
|
4195
4191
|
@desc Sets the config method used for the radial spokes, circles, and labels.
|
|
@@ -4226,11 +4222,11 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4226
4222
|
@memberof RadialMatrix
|
|
4227
4223
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
4228
4224
|
@private
|
|
4229
|
-
*/_draw(o){let{rowValues:l,columnValues:_,shapeData:d}=fi.bind(this)(this._filteredData);if(l.length&&_.length){super._draw(o);var o=this._height-this._margin.top-this._margin.bottom,g=this._select,c=this._transition,u=this._width-this._margin.left-this._margin.right;let
|
|
4225
|
+
*/_draw(o){let{rowValues:l,columnValues:_,shapeData:d}=fi.bind(this)(this._filteredData);if(l.length&&_.length){super._draw(o);var o=this._height-this._margin.top-this._margin.bottom,g=this._select,c=this._transition,u=this._width-this._margin.left-this._margin.right;let a=Dt.min([o-100,u-200])/2,t=`translate(${u/2+this._margin.left}, ${o/2+this._margin.top})`;u=_.slice().reverse();u.unshift(u.pop());let r=u.length,i=u.map((t,i)=>{var i=i/r*zi,e=Math.round(180*i/Math.PI),s=Math.floor((e+90)/90%4+1),h=[0,180].includes(e)?-50:[2,3].includes(s)?-100:0,n=[90,270].includes(e)?-25:[2,1].includes(s)?-50:0;return{key:t,angle:e,quadrant:s,radians:i,x:a*Math.sin(i+Math.PI)+h,y:a*Math.cos(i+Math.PI)+n}});
|
|
4230
4226
|
/**
|
|
4231
4227
|
* Extracts the axis config "labels" Array, if it exists, it filters
|
|
4232
4228
|
* the column labels by the values included in the Array.
|
|
4233
|
-
*/o=this._columnConfig.labels instanceof Array?i.filter(t=>this._columnConfig.labels.includes(t.key)):i;this._columnLabels.data(o).x(t=>t.x).y(t=>t.y).text(t=>t.key).width(100).height(50).config(this._columnConfig.shapeConfig.labelConfig).select(Pt.elem("g.d3plus-RadialMatrix-columns",{parent:g,transition:c,enter:{transform:t},update:{transform:t}}).node()).render();let e=this._innerRadius(
|
|
4229
|
+
*/o=this._columnConfig.labels instanceof Array?i.filter(t=>this._columnConfig.labels.includes(t.key)):i;this._columnLabels.data(o).x(t=>t.x).y(t=>t.y).text(t=>t.key).width(100).height(50).config(this._columnConfig.shapeConfig.labelConfig).select(Pt.elem("g.d3plus-RadialMatrix-columns",{parent:g,transition:c,enter:{transform:t},update:{transform:t}}).node()).render();let e=this._innerRadius(a),s=(a-e)/l.length,h=1<i.length?i[1].radians-i[0].radians:zi,n=l.slice().reverse();u=m.arc().padAngle(this._cellPadding/a).innerRadius(t=>e+n.indexOf(t.row)*s+this._cellPadding/2).outerRadius(t=>e+(n.indexOf(t.row)+1)*s-this._cellPadding/2).startAngle(t=>i[_.indexOf(t.column)].radians-h/2).endAngle(t=>i[_.indexOf(t.column)].radians+h/2);this._shapes.push((new B).data(d).d(u).select(Pt.elem("g.d3plus-RadialMatrix-arcs",{parent:g,transition:c,enter:{transform:t},update:{transform:t}}).node()).config({id:t=>this._ids(t).join("-"),x:0,y:0}).config(jt.bind(this)(this._shapeConfig,"shape","Path")).render())}return this}
|
|
4234
4230
|
/**
|
|
4235
4231
|
@memberof RadialMatrix
|
|
4236
4232
|
@desc The pixel padding in between each cell.
|
|
@@ -4301,11 +4297,11 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4301
4297
|
@memberof RadialMatrix
|
|
4302
4298
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4303
4299
|
@private
|
|
4304
|
-
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnConfig={shapeConfig:{labelConfig:{fontColor:"#000",padding:5,textAnchor:t=>[0,180].includes(t.angle)?"middle":[2,3].includes(t.quadrant)?"end":"start",verticalAlign:t=>[90,270].includes(t.angle)?"middle":[2,1].includes(t.quadrant)?"bottom":"top"}}},this._columnSort=(t,i)=>(""+t).localeCompare(""+i),this._innerRadius=t=>t/5,this._label=(t,i)=>
|
|
4300
|
+
*/constructor(){super(),this._cellPadding=2,this._column=s("column"),this._columnConfig={shapeConfig:{labelConfig:{fontColor:"#000",padding:5,textAnchor:t=>[0,180].includes(t.angle)?"middle":[2,3].includes(t.quadrant)?"end":"start",verticalAlign:t=>[90,270].includes(t.angle)?"middle":[2,1].includes(t.quadrant)?"bottom":"top"}}},this._columnSort=(t,i)=>(""+t).localeCompare(""+i),this._innerRadius=t=>t/5,this._label=(t,i)=>r.bind(this)("row",t,i)+" / "+r.bind(this)("column",t,i);let a=this._on["mousemove.shape"];this._on["mousemove.shape"]=(t,i,e,s)=>{a(t,i,e,s);let h=r.bind(this)("row",t,i),n=r.bind(this)("column",t,i);this.hover((t,i)=>r.bind(this)("row",t,i)===h||r.bind(this)("column",t,i)===n)},this._row=s("row"),this._rowSort=(t,i)=>(""+t).localeCompare(""+i),this._columnLabels=new l}}class Ai extends _{
|
|
4305
4301
|
/**
|
|
4306
4302
|
Extends the draw behavior of the abstract Viz class.
|
|
4307
4303
|
@private
|
|
4308
|
-
*/_draw(e){super._draw(e);let h=this._filteredData.reduce((t,i,e)=>(t[this._id(i,e)]=i,t),{}),o=this._nodes;!this._nodes.length&&this._links.length&&(e=Array.from(new Set(this._links.reduce((t,i)=>t.concat([i.source,i.target]),[]))),o=e.map(t=>"object"==typeof t?t:{id:t})),o=o.reduce((t,i,e)=>(t[this._nodeGroupBy?this._nodeGroupBy[this._drawDepth](i,e):this._id(i,e)]=i,t),{}),o=Array.from(new Set(Object.keys(h).concat(Object.keys(o)))).map((t,i)=>{var e=h[t],s=o[t];return void 0!==s&&{__d3plus__:!0,data:e||s,i:i,id:t,node:s,shape:void 0!==e&&void 0!==this._shape(e)?this._shape(e):this._shape(s)}}).filter(t=>t);let s=this._nodeLookup=o.reduce((t,i)=>(t[i.id]=i,t),{});e=this._links.map(e=>{var t=["source","target"].reduce((t,i)=>(t[i]="number"==typeof e[i]?o[e[i]]:s[e[i].id||e[i]],t),{});return t.size=this._linkSize(e),t});let n=e.reduce((t,i)=>(t[i.source.id]||(t[i.source.id]=[]),t[i.source.id].push(i),t[i.target.id]||(t[i.target.id]=[]),t[i.target.id].push(i),t),{}),t=this._duration,l=this._height-this._margin.top-this._margin.bottom,i=`translate(${this._margin.left}, ${this._margin.top})`,_=this._width-this._margin.left-this._margin.right,d=[],
|
|
4304
|
+
*/_draw(e){super._draw(e);let h=this._filteredData.reduce((t,i,e)=>(t[this._id(i,e)]=i,t),{}),o=this._nodes;!this._nodes.length&&this._links.length&&(e=Array.from(new Set(this._links.reduce((t,i)=>t.concat([i.source,i.target]),[]))),o=e.map(t=>"object"==typeof t?t:{id:t})),o=o.reduce((t,i,e)=>(t[this._nodeGroupBy?this._nodeGroupBy[this._drawDepth](i,e):this._id(i,e)]=i,t),{}),o=Array.from(new Set(Object.keys(h).concat(Object.keys(o)))).map((t,i)=>{var e=h[t],s=o[t];return void 0!==s&&{__d3plus__:!0,data:e||s,i:i,id:t,node:s,shape:void 0!==e&&void 0!==this._shape(e)?this._shape(e):this._shape(s)}}).filter(t=>t);let s=this._nodeLookup=o.reduce((t,i)=>(t[i.id]=i,t),{});e=this._links.map(e=>{var t=["source","target"].reduce((t,i)=>(t[i]="number"==typeof e[i]?o[e[i]]:s[e[i].id||e[i]],t),{});return t.size=this._linkSize(e),t});let n=e.reduce((t,i)=>(t[i.source.id]||(t[i.source.id]=[]),t[i.source.id].push(i),t[i.target.id]||(t[i.target.id]=[]),t[i.target.id].push(i),t),{}),t=this._duration,l=this._height-this._margin.top-this._margin.bottom,i=`translate(${this._margin.left}, ${this._margin.top})`,_=this._width-this._margin.left-this._margin.right,d=[],a=Dt.min([l,_])/2,g=a/3,c=g,u=2*g,p=s[this._center],r=(p.x=_/2,p.y=l/2,p.r=this._sizeMin?Dt.max([this._sizeMin,.65*c]):this._sizeMax?Dt.min([this._sizeMax,.65*c]):.65*c,[p]),f=[],m=(n[this._center].forEach(t=>{var i=t.source.id===this._center?t.target:t.source;i.edges=n[i.id].filter(t=>t.source.id!==this._center||t.target.id!==this._center),i.edge=t,r.push(i),f.push(i)}),f.sort((t,i)=>t.edges.length-i.edges.length),[]),y=0,x=(f.forEach(t=>{let e=t.id;t.edges=t.edges.filter(t=>!r.includes(t.source)&&t.target.id===e||!r.includes(t.target)&&t.source.id===e),y+=t.edges.length||1,t.edges.forEach(t=>{var{source:t,target:i}=t,t=i.id===e?t:i;r.push(t)})}),2*Math.PI),b=0;f.forEach((s,t)=>{let h=s.edges.length||1;var i=x/y*h;0===t&&(b-=i/2);let n=b+i/2-x/4;s.radians=n,s.x=_/2+c*Math.cos(n),s.y=l/2+c*Math.sin(n),b+=i,s.edges.forEach((t,i)=>{var t=t.source.id===s.id?t.target:t.source,e=x/y,e=n-e*h/2+e/2+e*i;t.radians=e,t.x=_/2+u*Math.cos(e),t.y=l/2+u*Math.sin(e),m.push(t)})});var v=g/2,C=g/4;let w=v/2-4,k=(v/2-4<8&&(w=Dt.min([v/2,8])),C/2-4);(k=(k=C/2-4<4?Dt.min([C/2,4]):k)>g/10?g/10:k)>w&&10<k&&(k=.75*w),w>1.5*k&&(w=1.5*k),w=Math.floor(w),k=Math.floor(k);let S;this._size?((v=Dt.extent(h,t=>t.size))[0]===v[1]&&(v[0]=0),S=$t.scaleLinear().domain(v).rangeRound([3,Dt.min([w,k])]),C=p.size,p.r=S(C)):S=$t.scaleLinear().domain([1,2]).rangeRound([w,k]),m.forEach(t=>{t.ring=2;var i=this._size?t.size:2;t.r=this._sizeMin?Dt.max([this._sizeMin,S(i)]):this._sizeMax?Dt.min([this._sizeMax,S(i)]):S(i)}),f.forEach(t=>{t.ring=1;var i=this._size?t.size:1;t.r=this._sizeMin?Dt.max([this._sizeMin,S(i)]):this._sizeMax?Dt.min([this._sizeMax,S(i)]):S(i)}),o=[p].concat(f).concat(m),f.forEach(r=>{let e=r.edge;["source","target"].forEach(i=>{e[i]=o.find(t=>t.id===e[i].id)}),d.push(e),n[r.id].forEach(a=>{let i=a.source.id===r.id?a.target:a.source;if(i.id!==p.id){let n=m.find(t=>t.id===i.id);if(n=n||f.find(t=>t.id===i.id)){a.spline=!0;let e=_/2,s=l/2,h=c+.5*(u-c);["source","target"].forEach((i,t)=>{a[i+"X"]=a[i].x+Math.cos(2===a[i].ring?a[i].radians+Math.PI:a[i].radians)*a[i].r,a[i+"Y"]=a[i].y+Math.sin(2===a[i].ring?a[i].radians+Math.PI:a[i].radians)*a[i].r,a[i+"BisectX"]=e+h*Math.cos(a[i].radians),a[i+"BisectY"]=s+h*Math.sin(a[i].radians),a[i]=o.find(t=>t.id===a[i].id),void 0===a[i].edges&&(a[i].edges={});t=(0===t?a.target:a.source).id;a[i].id===r.id?a[i].edges[t]={angle:r.radians+Math.PI,radius:g/2}:a[i].edges[t]={angle:n.radians,radius:g/2}}),d.push(a)}}})}),o.forEach(s=>{if(s.id!==this._center){var h=1.4*(this._shapeConfig.labelConfig.fontSize&&this._shapeConfig.labelConfig.fontSize(s)||11),n=2*h,a=g-s.r;let t=s.radians*(180/Math.PI),i=s.r+5,e="start";(t<-90||90<t)&&(i=-s.r-a-5,e="end",t+=180),s.labelBounds={x:i,y:-h/2,width:a,height:n},s.rotate=t,s.textAnchor=e}else s.labelBounds={x:-c/2,y:-c/2,width:c,height:c}}),this._linkLookup=e.reduce((t,i)=>(t[i.source.id]||(t[i.source.id]=[]),t[i.source.id].push(i.target),t[i.target.id]||(t[i.target.id]=[]),t[i.target.id].push(i.source),t),{});v=Dt.extent(e,t=>t.size);if(v[0]!==v[1]){let t=Dt.min(o,t=>t.r),i=$t["scale"+this._linkSizeScale.charAt(0).toUpperCase()+this._linkSizeScale.slice(1)]().domain(v).range([this._linkSizeMin,t]);e.forEach(t=>{t.size=i(t.size)})}C=jt.bind(this)(this._shapeConfig,"edge","Path");delete C.on,this._shapes.push((new B).config(C).strokeWidth(t=>t.size).id(t=>t.source.id+"_"+t.target.id).d(t=>t.spline?`M${t.sourceX},${t.sourceY}C${t.sourceBisectX},${t.sourceBisectY} ${t.targetBisectX},${t.targetBisectY} ${t.targetX},`+t.targetY:`M${t.source.x},${t.source.y} ${t.target.x},`+t.target.y).data(d).select(Pt.elem("g.d3plus-rings-links",{parent:this._select,duration:t,enter:{transform:i},update:{transform:i}}).node()).render());let z=this,M={label:t=>!!(o.length<=this._dataCutoff||this._hover&&this._hover(t)||this._active&&this._active(t))&&this._drawLabel(t.data||t.node,t.i),labelBounds:t=>t.labelBounds,labelConfig:{fontColor:t=>t.id===this._center?jt.bind(z)(z._shapeConfig,"shape",t.key).labelConfig.fontColor(t):A.colorLegible(jt.bind(z)(z._shapeConfig,"shape",t.key).fill(t)),fontResize:t=>t.id===this._center,padding:0,textAnchor:t=>s[t.id].textAnchor||jt.bind(z)(z._shapeConfig,"shape",t.key).labelConfig.textAnchor,verticalAlign:t=>t.id===this._center?"middle":"top"},rotate:t=>s[t.id].rotate||0,select:Pt.elem("g.d3plus-rings-nodes",{parent:this._select,duration:t,enter:{transform:i},update:{transform:i}}).node()};return Ot.nest().key(t=>t.shape).entries(o).forEach(t=>{this._shapes.push((new Wt[t.key]).config(jt.bind(this)(this._shapeConfig,"shape",t.key)).config(M).data(t.values).render())}),this}
|
|
4309
4305
|
/**
|
|
4310
4306
|
@memberof Rings
|
|
4311
4307
|
@desc Sets the center node to be the node with the given id.
|
|
@@ -4391,7 +4387,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
|
|
|
4391
4387
|
@memberof Rings
|
|
4392
4388
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4393
4389
|
@private
|
|
4394
|
-
*/constructor(){super(),this._links=[],this._linkSize=Ht(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodes=[],this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let e=this._on["mousemove.shape"];this._on["mousemove.shape"]=(r,
|
|
4390
|
+
*/constructor(){super(),this._links=[],this._linkSize=Ht(1),this._linkSizeMin=1,this._linkSizeScale="sqrt",this._noDataMessage=!1,this._nodes=[],this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let e=this._on["mousemove.shape"];this._on["mousemove.shape"]=(a,r,t,i)=>{if(e(a,r,t,i),this._focus&&this._focus===a.id)this.hover(!1),this._on.mouseenter.bind(this)(a,r,t,i),this._focus=void 0;else{let t=this._nodeGroupBy&&this._nodeGroupBy[this._drawDepth](a,r)?this._nodeGroupBy[this._drawDepth](a,r):this._id(a,r),i=this._linkLookup[t],e=this._nodeLookup[t],s=[e.id],h=[e.x-e.r,e.x+e.r],n=[e.y-e.r,e.y+e.r];i.forEach(t=>{s.push(t.id),t.x-t.r<h[0]&&(h[0]=t.x-t.r),t.x+t.r>h[1]&&(h[1]=t.x+t.r),t.y-t.r<n[0]&&(n[0]=t.y-t.r),t.y+t.r>n[1]&&(n[1]=t.y+t.r)}),this.hover((t,i)=>t.source&&t.target?t.source.id===e.id||t.target.id===e.id:s.includes(this._ids(t,i)[this._drawDepth]))}},this._on["click.shape"]=t=>{this._center=t.id,
|
|
4395
4391
|
// Need to resets margins and padding because we are
|
|
4396
4392
|
// skipping over the default render method and using
|
|
4397
4393
|
// _draw directly.
|
|
@@ -4472,7 +4468,7 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4472
4468
|
@memberof Sankey
|
|
4473
4469
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4474
4470
|
@private
|
|
4475
|
-
*/constructor(){super(),this._nodeId=s("id"),this._links=s("links"),this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=s("nodes"),this._nodeAlign=Bi.justify,this._nodePadding=8,this._nodeWidth=30,this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let i=this._on["mousemove.shape"];this._on["mousemove.shape"]=(h,n,
|
|
4471
|
+
*/constructor(){super(),this._nodeId=s("id"),this._links=s("links"),this._linksSource="source",this._linksTarget="target",this._noDataMessage=!1,this._nodes=s("nodes"),this._nodeAlign=Bi.justify,this._nodePadding=8,this._nodeWidth=30,this._on.mouseenter=()=>{},this._on["mouseleave.shape"]=()=>{this.hover(!1)};let i=this._on["mousemove.shape"];this._on["mousemove.shape"]=(h,n,a,t)=>{if(i(h,n,a,t),this._focus&&this._focus===h.id)this.hover(!1),this._on.mouseenter.bind(this)(h,n,a,t),this._focus=void 0;else{let e=this._nodeId(h,n),t=this._nodeLookup[e],i=Object.keys(this._nodeLookup).reduce((t,i)=>(t[this._nodeLookup[i]]=isNaN(i)?i:parseInt(i,10),t),{});a=this._linkLookup[t];let s=[e];a.forEach(t=>{s.push(i[t])}),this.hover((t,i)=>t.source&&t.target?t.source.id===e||t.target.id===e:s.includes(this._nodeId(t,i)))}},this._path=e.sankeyLinkHorizontal(),this._sankey=e.sankey(),this._shape=Ht("Rect"),this._shapeConfig=Pt.assign(this._shapeConfig,{Path:{fill:"none",hoverStyle:{"stroke-width":t=>Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)},label:!1,stroke:"#DBDBDB",strokeOpacity:.5,strokeWidth:t=>Math.max(1,Math.abs(t.source.y1-t.source.y0)*(t.value/t.source.value)-2)},Rect:{}}),this._value=Ht(1)}}class Di extends hi{
|
|
4476
4472
|
/**
|
|
4477
4473
|
@memberof StackedArea
|
|
4478
4474
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
|
@@ -4481,15 +4477,15 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4481
4477
|
/**
|
|
4482
4478
|
Extends the draw behavior of the abstract Viz class.
|
|
4483
4479
|
@private
|
|
4484
|
-
*/_draw(t){super._draw(t);let
|
|
4480
|
+
*/_draw(t){super._draw(t);let a="vertical"===this._orient,n="horizontal"===this._orient,i=a?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right,r=a?"left":"top",e=this,s=`translate(${this._margin.left}, ${this._margin.top})`,o=n?this._height-this._margin.top-this._margin.bottom:this._width-this._margin.left-this._margin.right;t=this._treeData=this._tree.separation(this._separation).size([o,i])(f.hierarchy({key:"root",values:Lt.nest(this._filteredData,this._groupBy.slice(0,this._drawDepth+1))},t=>t.key&&t.values?t.values:null).sort(this._sort)).descendants().filter(t=>t.depth<=this._groupBy.length&&t.parent);
|
|
4485
4481
|
/**
|
|
4486
4482
|
Merges the values of a given nest branch.
|
|
4487
4483
|
@private
|
|
4488
|
-
*/t.forEach((t,i)=>{t.data.key&&t.data.values&&(t.data=function i(t){return Lt.merge(t.values.map(t=>t.key&&t.values?i(t):t),e._aggs)}(t.data)),t.__d3plus__=!0,t.i=i});let h=this._shapeConfig.r;"function"!=typeof h&&(h=Ht(h));var
|
|
4484
|
+
*/t.forEach((t,i)=>{t.data.key&&t.data.values&&(t.data=function i(t){return Lt.merge(t.values.map(t=>t.key&&t.values?i(t):t),e._aggs)}(t.data)),t.__d3plus__=!0,t.i=i});let h=this._shapeConfig.r;"function"!=typeof h&&(h=Ht(h));var l=Dt.max(t,t=>1===t.depth?h(t.data,t.i):0),_=Dt.max(t,t=>t.children?0:h(t.data,t.i)),d=Dt.extent(t,t=>t.y);this._labelHeight=Dt.min([a?50:100,(d[1]-l-_)/(this._groupBy.length+1)]),this._labelWidths=Lt.nest(t,t=>t.depth).map(h=>h.values.reduce((t,i,e)=>{var s=e<h.values.length-1?h.values[e+1].x:o+this._margin[r],e=e?h.values[e-1].x:this._margin[r];return Dt.min([t,s-i.x,i.x-e])},o));let g=S.scaleLinear().domain(d).range([l+this._labelHeight,i-_-this._labelHeight]),c=(t.forEach(t=>{var i=g(t.y);n?(t.y=t.x,t.x=i):t.y=i}),{parent:this._select,enter:{transform:s},update:{transform:s}}),u=(this._shapes.push((new B).data(t.filter(t=>1<t.depth).map(t=>Pt.assign({},t))).select(Pt.elem("g.d3plus-Tree-Links",c).node()).config(jt.bind(this)(this._shapeConfig,"shape","Path")).config({d:t=>{let i=this._shapeConfig.r;"function"==typeof i&&(i=i(t.data,t.i));var e=t.parent.x-t.x+(a?0:i),t=t.parent.y-t.y+(a?i:0),s=a?0:-i,h=a?-i:0;return a?`M${s},${h}C${s},${(h+t)/2} ${e},${(h+t)/2} ${e},`+t:`M${s},${h}C${(s+e)/2},${h} ${(s+e)/2},${t} ${e},`+t},id:(t,i)=>this._ids(t,i)[t.depth-1]}).render()),{id:(t,i)=>this._ids(t,i)[t.depth-1],label:(t,i)=>this._label?this._label(t.data,i):(i=this._ids(t,i).slice(0,t.depth))[i.length-1],labelConfig:{textAnchor:(t,i,e)=>a?"middle":e.children&&e.depth!==this._drawDepth+1?"end":"start",verticalAlign:(t,i,e)=>a?1===e.depth?"bottom":"top":"middle"},hitArea:(t,i,e)=>{var s=this._labelHeight,e=e.r||(a?e.height/2:e.width/2),h=this._labelWidths[t.depth-1];return{width:a?h:2*e+h,height:n?s:2*e+s,x:a?-h/2:t.children&&t.depth!==this._groupBy.length?-(e+h):-e,y:n?-s/2:t.children&&t.depth!==this._groupBy.length?-(e+this._labelHeight):-e}},labelBounds:(t,i,e)=>{var s=this._labelHeight,h=a?"height":"width",e=e.r||(a?e.height/2:e.width/2),n=this._labelWidths[t.depth-1];return{[a?"width":"height"]:n,[h]:s,[a?"x":"y"]:-n/2,[a?"y":"x"]:t.children&&t.depth!==this._groupBy.length?-(e+s):e}}});d=Lt.nest(t,t=>this._shape(t.data));let p=d.map(t=>t.key);l=this._previousShapes.filter(t=>!p.includes(t));return d.concat(l.map(t=>({key:t,values:[]}))).forEach(({key:t,values:i})=>{this._shapes.push((new Wt[t]).data(i).select(Pt.elem("g.d3plus-Tree-"+t,c).node()).config(jt.bind(this)(this._shapeConfig,"shape",t)).config(u).render())}),this._previousShapes=p,this}
|
|
4489
4485
|
/**
|
|
4490
4486
|
@memberof Tree
|
|
4491
|
-
@desc
|
|
4492
|
-
@param {
|
|
4487
|
+
@desc Changes the orientation of the entire Tree, either "vertical" (top to bottom) or "horizontal" (left to right).
|
|
4488
|
+
@param {'vertical'|'horizontal'} [*value* = "vertical"] Accepts either "vertical" or "horizontal".
|
|
4493
4489
|
*/orient(t){return arguments.length?(this._orient=t,this):this._orient}
|
|
4494
4490
|
/**
|
|
4495
4491
|
@memberof Tree
|
|
@@ -4507,29 +4503,29 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4507
4503
|
@memberof Tree
|
|
4508
4504
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4509
4505
|
@private
|
|
4510
|
-
*/constructor(){super(),this._orient="vertical",this._separation=(t,i)=>t.parent===i.parent?1:2,this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._treeData?`${this._treeData[i].depth}. ${this._drawLabel(t,i)}.`:"",labelConfig:{fontColor:
|
|
4506
|
+
*/constructor(){super(),this._orient="vertical",this._separation=(t,i)=>t.parent===i.parent?1:2,this._legendTooltip=Pt.assign(this._legendTooltip,{title:ft.bind(this)}),this._previousShapes=[],this._shape=Ht("Circle"),this._shapeConfig=Pt.assign(this._shapeConfig,{ariaLabel:(t,i)=>this._treeData?`${this._treeData[i].depth}. ${this._drawLabel(t,i)}.`:"",labelConfig:{fontColor:A.colorDefaults.dark},Path:{fill:"none",stroke:A.colorDefaults.missing,strokeWidth:2},r:Ht(7),width:Ht(12),height:Ht(12)}),this._tooltipConfig=Pt.assign(this._tooltipConfig,{title:(t,i,e)=>this._drawLabel(t,i,e.depth-1)}),this._tree=f.tree()}}let Li={treemapBinary:f.treemapBinary,treemapDice:f.treemapDice,treemapSlice:f.treemapSlice,treemapSliceDice:f.treemapSliceDice,treemapSquarify:f.treemapSquarify,treemapResquarify:f.treemapResquarify};class Ti extends _{
|
|
4511
4507
|
/**
|
|
4512
4508
|
@memberof Treemap
|
|
4513
4509
|
@desc Extends the draw behavior of the abstract Viz class.
|
|
4514
4510
|
@private
|
|
4515
|
-
*/_draw(t){super._draw(t);let i=Ot.nest();for(let t=0;t<=this._drawDepth;t++)i.key(this._groupBy[t]);i=i.entries(this._filteredData);t=this._treemap.padding(this._layoutPadding).size([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom]).tile(this._tile)(
|
|
4511
|
+
*/_draw(t){super._draw(t);let i=Ot.nest();for(let t=0;t<=this._drawDepth;t++)i.key(this._groupBy[t]);i=i.entries(this._filteredData);t=this._treemap.padding(this._layoutPadding).size([this._width-this._margin.left-this._margin.right,this._height-this._margin.top-this._margin.bottom]).tile(this._tile)(f.hierarchy({values:i},t=>t.values).sum(this._sum).sort(this._sort));let n=[],a=this;
|
|
4516
4512
|
/**
|
|
4517
4513
|
@memberof Treemap
|
|
4518
4514
|
@desc Flattens and merges treemap data.
|
|
4519
4515
|
@private
|
|
4520
|
-
*/t.children&&!function i(e){for(let t=0;t<e.length;t++){var s,h=e[t];h.depth<=
|
|
4516
|
+
*/t.children&&!function i(e){for(let t=0;t<e.length;t++){var s,h=e[t];h.depth<=a._drawDepth?i(h.children):(s=1===h.data.values.length?a._filteredData.indexOf(h.data.values[0]):void 0,h.__d3plus__=!0,h.id=h.data.key,h.i=-1<s?s:void 0,h.data=Lt.merge(h.data.values,a._aggs),h.x=h.x0+(h.x1-h.x0)/2,h.y=h.y0+(h.y1-h.y0)/2,n.push(h))}}(t.children),this._rankData=n.sort(this._sort).map(t=>t.data);let e=t.value;n.forEach(t=>{t.share=this._sum(t.data,t.i)/e});var t=`translate(${this._margin.left}, ${this._margin.top})`,s=jt.bind(this)(this._shapeConfig,"shape","Rect");let r=s.labelConfig.fontMax,o=s.labelConfig.fontMin,l=s.labelConfig.padding;return this._shapes.push((new Ft).data(n).label(t=>[this._drawLabel(t.data,t.i),Tt.formatAbbreviate(100*t.share,this._locale)+"%"]).select(Pt.elem("g.d3plus-Treemap",{parent:this._select,enter:{transform:t},update:{transform:t}}).node()).config({height:t=>t.y1-t.y0,labelBounds:(t,i,e)=>{var s=e.height;let h=Math.min(r,.5*(s-2*l));return h<o&&(h=0),[{width:e.width,height:s-h,x:-e.width/2,y:-s/2},{width:e.width,height:h+2*l,x:-e.width/2,y:s/2-h-2*l}]},labelConfig:{textAnchor:(t,i,e)=>{let s,h=e;for(;void 0===s&&h;)void 0!==h.l&&(s=h.l),h=h.__d3plusParent__;return s?"middle":"start"},verticalAlign:(t,i,e)=>{let s,h=e;for(;void 0===s&&h;)void 0!==h.l&&(s=h.l),h=h.__d3plusParent__;return s?"bottom":"top"}},width:t=>t.x1-t.x0}).config(s).render()),this}
|
|
4521
4517
|
/**
|
|
4522
4518
|
* Applies the threshold algorithm for Treemaps.
|
|
4523
4519
|
* @param {Array} data The data to process.
|
|
4524
4520
|
* @private
|
|
4525
|
-
*/_thresholdFunction(t){let
|
|
4521
|
+
*/_thresholdFunction(t){let a=this._aggs,i=this._drawDepth,e=this._groupBy,r=this._threshold,o=this._thresholdKey,l=Dt.sum(t,o);return r&&o?
|
|
4526
4522
|
/**
|
|
4527
4523
|
* @memberof Treemap
|
|
4528
4524
|
* @desc Explores the data tree recursively and merges elements under the indicated threshold.
|
|
4529
4525
|
* @param {object[]} branchData The current subset of the dataset to work on.
|
|
4530
4526
|
* @param {number} depth The depth of the current branch.
|
|
4531
4527
|
* @private
|
|
4532
|
-
*/function s(n,h){if(h<i)return Ot.nest().key(e[h]).entries(n).reduce((t,i)=>{let e=s(i.values,h+1);return t.concat(e)},[]);if(h===i){let i=Math.min(1,Math.max(0,
|
|
4528
|
+
*/function s(n,h){if(h<i)return Ot.nest().key(e[h]).entries(n).reduce((t,i)=>{let e=s(i.values,h+1);return t.concat(e)},[]);if(h===i){let i=Math.min(1,Math.max(0,r(n)));if(!isFinite(i)||isNaN(i))return null;let e=[],s=n.slice(),t=i*l,h=s.length;for(;h--;){let i=s[h];if(o(i)<t){let t=s.indexOf(i);s.splice(t,1),e.push(i)}}if(0<e.length){let t=Lt.merge(e,a);t._isAggregation=!0,t._threshold=i,s.push(t)}return s}throw new Error("Depth is higher than the amount of grouping levels.")}(t,0):t}
|
|
4533
4529
|
/**
|
|
4534
4530
|
@memberof Treemap
|
|
4535
4531
|
@desc If *value* is specified, sets the inner and outer padding accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current padding accessor.
|
|
@@ -4559,10 +4555,10 @@ this._margin={bottom:0,left:0,right:0,top:0},this._padding={bottom:0,left:0,righ
|
|
|
4559
4555
|
|
|
4560
4556
|
Can either be a string referring to a d3-hierarchy [tiling method](https://github.com/d3/d3-hierarchy#treemap-tiling), or a custom function in the same format.
|
|
4561
4557
|
@param {String|Function} [*value* = "squarify"]
|
|
4562
|
-
*/tile(t){return arguments.length?(this._tile="string"==typeof t?Li["treemap"+t.charAt(0).toUpperCase()+t.slice(1)]||
|
|
4558
|
+
*/tile(t){return arguments.length?(this._tile="string"==typeof t?Li["treemap"+t.charAt(0).toUpperCase()+t.slice(1)]||f.treemapSquarify:t,this):this._tile}
|
|
4563
4559
|
/**
|
|
4564
4560
|
@memberof Treemap
|
|
4565
4561
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
4566
4562
|
@private
|
|
4567
|
-
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,h=(this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._sum(i)-this._sum(t),this._legendTooltip=Pt.assign({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Pt.assign({},this._shapeConfig,{ariaLabel:(t,i)=>(this._rankData?this._rankData.indexOf(t)+1+". ":"")+this._drawLabel(t,i)+`, ${this._sum(t,i)}.`,labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}}),this._sort=(t,i)=>{var e=h(t),s=h(i);return e&&!s?1:!e&&s?-1:i.value-t.value},this._sum=s("value"),this._thresholdKey=this._sum,this._tile=
|
|
4563
|
+
*/constructor(){super(),this._layoutPadding=1;let e=this._legend,h=(this._legend=(t,i)=>i.length!==this._filteredData.length&&e.bind(this)(t,i),this._legendSort=(t,i)=>this._sum(i)-this._sum(t),this._legendTooltip=Pt.assign({},this._legendTooltip,{tbody:[]}),this._shapeConfig=Pt.assign({},this._shapeConfig,{ariaLabel:(t,i)=>(this._rankData?this._rankData.indexOf(t)+1+". ":"")+this._drawLabel(t,i)+`, ${this._sum(t,i)}.`,labelConfig:{fontMax:32,fontMin:8,fontResize:!0,padding:5}}),this._sort=(t,i)=>{var e=h(t),s=h(i);return e&&!s?1:!e&&s?-1:i.value-t.value},this._sum=s("value"),this._thresholdKey=this._sum,this._tile=f.treemapSquarify,this._tooltipConfig=Pt.assign({},this._tooltipConfig,{tbody:[[()=>this._translate("Share"),(t,i,e)=>Tt.formatAbbreviate(100*e.share,this._locale)+"%"]]}),this._treemap=f.treemap().round(!0),t=>t.children&&1===t.children.length&&t.children[0].data._isAggregation)}}t.Area=Nt,t.AreaPlot=hi,t.Axis=o,t.AxisBottom=et,t.AxisLeft=st,t.AxisRight=ht,t.AxisTop=nt,t.Bar=K,t.BarChart=ni,t.BaseClass=h,t.Box=Q,t.BoxWhisker=ai,t.BumpChart=ri,t.Circle=Rt,t.ColorScale=rt,t.Donut=li,t.Geomap=ui,t.Image=V,t.Legend=at,t.Line=It,t.LinePlot=pi,t.Matrix=yi,t.Message=ot,t.Network=bi,t.Pack=Ci,t.Path=B,t.Pie=oi,t.Plot=si,t.Priestley=wi,t.RESET=T,t.Radar=Si,t.RadialMatrix=Mi,t.Rect=Ft,t.Rings=Ai,t.Sankey=Pi,t.Shape=a,t.StackedArea=Di,t.TextBox=l,t.Timeline=dt,t.Tooltip=ct,t.Tree=Oi,t.Treemap=Ti,t.Viz=_,t.Whisker=X,t.accessor=s,t.configPrep=jt,t.constant=Ht,t.uuid=q});
|
|
4568
4564
|
//# sourceMappingURL=d3plus-core.js.map
|