@d3plus/core 3.0.12 → 3.0.14

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/core v3.0.12
2
+ @d3plus/core v3.0.14
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
@@ -1154,15 +1154,16 @@ this._whiskerEndpoint=[],Ot.nest().key(t=>t.outlier).entries(n).forEach(t=>{var
1154
1154
  * Calculates ticks from a given scale (negative and/or positive)
1155
1155
  * @param {scale} scale A d3-scale object
1156
1156
  * @private
1157
- */function it(t,e=!1){let s=[];var h=
1157
+ */function it(t,e=!1){let s=[];var h=t.copy(),n=("time"===this._scale&&this._data.length&&(t=(n=Dt.extent(this._data)).map(t),h.domain(n).range(t)),h.domain());let a=n[1]<n[0];t=
1158
1158
  /**
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 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
- // forces min/max into ticks, if not present
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)(h,e);if(e||"log"!==this._scale){if(s=h.ticks(t),!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*t));s=i<=1&&e[0]===e[1]||r!=a?h.ticks(t).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"))}
1164
1163
  // for time scale, if data array has been provided, filter out ticks that are not in the array
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{
1164
+ if("time"===this._scale&&this._data.length){let e=this._data.map(Number);s=s.filter(t=>{let i=+t;return e.find(t=>t>=i-936e5&&t<=936e5+i)})}
1165
+ // forces min/max into ticks, if not present
1166
+ return 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]),s}class o extends h{
1166
1167
  /**
1167
1168
  @memberof Axis
1168
1169
  @desc Sets positioning for the axis bar.
@@ -3813,7 +3814,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
3813
3814
  @param {Object|String} *data* = `undefined`
3814
3815
  @param {Function} [*formatter*]
3815
3816
  @chainable
3816
- */fitObject(t,i){var e;return arguments.length?("string"==typeof t?(e=this._queue.find(t=>"fitObject"===t[3]),i=[Lt.load.bind(this),t,i,"fitObject"],e?this._queue[this._queue.indexOf(e)]=i:this._queue.push(i)):this._fitObject=t,this._zoomSet=!1,this):this._fitObject}
3817
+ */fitObject(t,i){return arguments.length?(Lt.addToQueue.bind(this)(t,i,"fitObject"),this._zoomSet=!1,this):this._fitObject}
3817
3818
  /**
3818
3819
  @memberof Geomap
3819
3820
  @desc The color visible behind any shapes drawn on the map projection. By default, a color value matching the color used in the map tiles is used to help mask the loading time needed to render the tiles. Any value CSS color value may be used, including hexidecimal, rgb, rgba, and color strings like `"blue"` and `"transparent"`.
@@ -3882,7 +3883,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
3882
3883
  @param {Object|String} *data* = []
3883
3884
  @param {Function} [*formatter*]
3884
3885
  @chainable
3885
- */topojson(t,i){var e;return arguments.length?("string"==typeof t?(e=this._queue.find(t=>"topojson"===t[3]),i=[Lt.load.bind(this),t,i,"topojson"],e?this._queue[this._queue.indexOf(e)]=i:this._queue.push(i)):this._topojson=t,this._zoomSet=!1,this):this._topojson}
3886
+ */topojson(t,i){return arguments.length?(Lt.addToQueue.bind(this)(t,i,"topojson"),this._zoomSet=!1,this):this._topojson}
3886
3887
  /**
3887
3888
  @memberof Geomap
3888
3889
  @desc The function is used to set default color of the map.