@d3plus/core 3.1.4 → 3.1.6
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 +5093 -5092
- package/es/src/charts/Matrix.js +1 -1
- package/es/src/charts/Matrix.js.map +1 -1
- package/es/src/components/Axis.js +6 -3
- package/es/src/components/Axis.js.map +1 -1
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/package.json +11 -8
- package/types/src/utils/D3plusConfig.d.ts +4 -2
- package/umd/d3plus-core.full.js +21 -7
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +22 -11
- package/umd/d3plus-core.js +8 -5
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +9 -6
package/umd/d3plus-core.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.1.
|
|
2
|
+
@d3plus/core v3.1.5
|
|
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) 2026 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -465,7 +465,10 @@ $=t?t.slice():[void 0,void 0];let[e,n]=v;this._range&&(void 0!==this._range[0]&&
|
|
|
465
465
|
* previously defined range variable.
|
|
466
466
|
*/const o=`scale${this._scale.charAt(0).toUpperCase()}${this._scale.slice(1)}`,r=this._domain.slice();if(
|
|
467
467
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
468
|
-
this._d3Scale=O[o]().domain("time"===this._scale?r.map(i.date):r).range($),"none"!==this._rounding){const t=()=>{const t=t=>{if(i){if(!t)return 0;const 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},i=r.every(t=>Math.abs(t)<1),e=[t(r[0]),t(r[1])].filter(Boolean).sort()
|
|
468
|
+
this._d3Scale=O[o]().domain("time"===this._scale?r.map(i.date):r).range($),"none"!==this._rounding){const t=()=>{const t=t=>{if(i){if(!t)return 0;const 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},i=r.every(t=>Math.abs(t)<1),e=[t(r[0]),t(r[1])].filter(Boolean).sort();
|
|
469
|
+
// Nothing meaningful to round to (e.g. a zero-extent domain like
|
|
470
|
+
// [0, 0]); leave the scale's domain as-is to avoid a NaN factor.
|
|
471
|
+
if(!e.length)return;const n=r.some(t=>ot(t))&&r.some(t=>t>0),h=1===e.length?e[0]:e[0]>1&&e[0]===e[1]?e[0]-1:"outside"!==this._rounding&&n?s.max(e):e[0]+(e[1]-e[0])/2;let o=h<1?lt(h):+`1${Array(Math.floor(lt(h))-1).fill(0).join("")}`;o>=Math.abs(r[1]-r[0])&&(o/=2);const a=r[1]<r[0],l=[Math["outside"===this._rounding?a?"ceil":"floor":a?"floor":"ceil"](r[0]/o)*o,Math["outside"===this._rounding?a?"floor":"ceil":a?"ceil":"floor"](r[1]/o)*o];"log"===this._scale&&(0===l[0]&&(l[0]=r[0]),0===l[1]&&(l[1]=r[1])),this._d3Scale.domain(l.map(lt))};if("linear"===this._scale)t.bind(this)();else if("log"===this._scale){const i=[],e=r[1]<r[0];i[0]=("outside"===this._rounding?ot(r[0])?e?rt:at:e?at:rt:ot(r[0])?e?at:rt:e?rt:at)(r[0]),i[1]=("inside"===this._rounding?ot(r[1])?e?rt:at:e?at:rt:ot(r[1])?e?at:rt:e?rt:at)(r[1]);const s=i[1]<i[0];i[0]!==i[1]&&i.some(t=>Math.abs(t)>10)&&s===e?this._d3Scale.domain(i):t.bind(this)()}}if(this._d3Scale.padding&&this._d3Scale.padding(this._scalePadding),this._d3Scale.paddingInner&&this._d3Scale.paddingInner(this._paddingInner),this._d3Scale.paddingOuter&&this._d3Scale.paddingOuter(this._paddingOuter)
|
|
469
472
|
/**
|
|
470
473
|
* Constructs a separate "negative only" scale for logarithmic
|
|
471
474
|
* domains, as they cannot pass zero.
|
|
@@ -514,7 +517,7 @@ T=z.map((t,s)=>{const h="function"==typeof e?e(t,s):e,o="function"==typeof n?n(t
|
|
|
514
517
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
515
518
|
T=T.map(t=>{t.space=h-2*t.fP;const i=L(t);return Object.assign(i,t)});const o=T.slice().reverse();
|
|
516
519
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
517
|
-
T.forEach(t=>{const{fP:i,i:e,position:s}=t,n=p?"
|
|
520
|
+
T.forEach(t=>{const{fP:i,i:e,position:s}=t,n=t.rotate&&p||!t.rotate&&!p?"height":"width";
|
|
518
521
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
519
522
|
let h=!!e&&o.find(t=>t.i<e&&!t.truncated);if(e===T.length-1)for(;h&&s-t[n]/2-i<h.position+h[n]/2;)h.truncated=!0,
|
|
520
523
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -537,7 +540,7 @@ t=>t.id);K.exit().transition(C).attr("opacity",0).call(this._gridPosition.bind(t
|
|
|
537
540
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
538
541
|
let J=M.concat(U).map(t=>{
|
|
539
542
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
540
|
-
const i=T.find(i=>i.d===t),e=this._getPosition(t),s=i?i.space:0,n=i?i.lines.length:1,h=i?i.lineHeight:1,l=i?i.fP:0,_=i&&this._labelOffset?i.offset:0,d=p?s:V.width-k[this._position.opposite]-P-k[this._orient]+x,c=k[f],g=(P+_)*(y?-1:1),u=y?V[a]+V[o]-c:V[a]+c,m={id:t,labelBounds:X&&i?{x:-i.width/2+i.fS/4,y:"bottom"===this._orient?g+(i.width-h*n)/2+l:
|
|
543
|
+
const i=T.find(i=>i.d===t),e=this._getPosition(t),s=i?i.space:0,n=i?i.lines.length:1,h=i?i.lineHeight:1,l=i?i.fP:0,_=i&&this._labelOffset?i.offset:0,d=p?s:V.width-k[this._position.opposite]-P-k[this._orient]+x,c=k[f],g=(P+_)*(y?-1:1),u=y?V[a]+V[o]-c:V[a]+c,m={id:t,labelBounds:X&&i?{x:-i.width/2+i.fS/4,y:"bottom"===this._orient?g+(i.width-h*n)/2+l:g-(i.width+h*n)/2-2*l,width:i.width,height:i.height}:{x:p?-s/2:"left"===this._orient?-d-x+g:g+x,y:p?"bottom"===this._orient?g+l:g-I-l:-s/2,width:p?s:d,height:p?I:s},rotate:!!i&&i.rotate,size:z.includes(t)||"log"===this._scale&&Math.log10(Math.abs(t))%1==0?g:M.includes(t)?Math.ceil(g/2):this._data.find(i=>+i===t)?Math.ceil(g/4):0,text:// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
541
544
|
!((i||{}).truncated||!z.includes(t))&&A(t),tick:M.includes(t),[r]:e+("band"===this._scale?this._d3Scale.bandwidth()/2:0),[a]:u};return m});"Line"===this._shape&&(J=J.concat(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
542
545
|
J.map(t=>{const i=Object.assign({},t);return i[a]+=t.size,i}))),
|
|
543
546
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -560,7 +563,7 @@ tickFormat(t){return arguments.length?(this._tickFormat=t,this):this._tickFormat
|
|
|
560
563
|
/**
|
|
561
564
|
Invoked when creating a new class instance, and sets any default parameters.
|
|
562
565
|
@private
|
|
563
|
-
*/constructor(){super(),this._align="middle",this._barConfig={stroke:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},"stroke-width":1},this._data=[],this._domain=[0,10],this._duration=600,this._gridConfig={stroke:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)===r.colorDefaults.dark?ht.colors.gray[200]:ht.colors.gray[600]},"stroke-width":1},this._gridLog=!1,this._height=400,this._labelOffset=!1,this._labelRotation=!1,this.orient("bottom"),this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._paddingInner=.1,this._paddingOuter=.1,this._rounding="none",this._roundingInsideMinPrefix="< ",this._roundingInsideMinSuffix="",this._roundingInsideMaxPrefix="",this._roundingInsideMaxSuffix="+",this._scale="linear",this._scalePadding=.5,this._shape="Line",this._shapeConfig={fill:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},height:t=>t.tick?8:0,label:t=>t.text,labelBounds:t=>t.labelBounds,labelConfig:{fontColor:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},fontResize:!1,fontSize:I(12),padding:5,textAnchor:()=>{const t=i.rtl();return"left"===this._orient?t?"start":"end":"right"===this._orient?t?"end":"start":this._labelRotation?"bottom"===this._orient?"end":"start":"middle"},verticalAlign:()=>"bottom"===this._orient?"top":"top"===this._orient?"bottom":"middle"},r:t=>t.tick?4:0,stroke:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},strokeWidth:1,width:t=>t.tick?8:0},this._tickSize=8,this._tickSuffix="normal",this._tickUnit=0,this._timeLocale=void 0,this._titleClass=new Ct,this._titleConfig={fontColor:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},fontSize:12,textAnchor:"middle"},this._width=400,this._margin={top:0,right:0,bottom:0,left:0},this._availableTicks=[],this._visibleTicks=[]}}class ut extends gt{
|
|
566
|
+
*/constructor(){super(),this._align="middle",this._barConfig={stroke:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},"stroke-width":1},this._data=[],this._domain=[0,10],this._duration=600,this._gridConfig={stroke:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)===r.colorDefaults.dark?ht.colors.gray[200]:ht.colors.gray[600]},"stroke-width":1},this._gridLog=!1,this._height=400,this._labelOffset=!1,this._labelRotation=!1,this.orient("bottom"),this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._paddingInner=.1,this._paddingOuter=.1,this._rounding="none",this._roundingInsideMinPrefix="< ",this._roundingInsideMinSuffix="",this._roundingInsideMaxPrefix="",this._roundingInsideMaxSuffix="+",this._scale="linear",this._scalePadding=.5,this._shape="Line",this._shapeConfig={fill:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},height:t=>t.tick?8:0,label:t=>t.text,labelBounds:t=>t.labelBounds,labelConfig:{fontColor:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},fontResize:!1,fontSize:I(12),padding:5,textAnchor:()=>{const t=i.rtl();return"left"===this._orient?t?"start":"end":"right"===this._orient?t?"end":"start":this._labelRotation?"bottom"===this._orient?"end":"start":"middle"},verticalAlign:()=>"bottom"===this._orient?"top":"top"===this._orient?this._labelRotation?"top":"bottom":"middle"},r:t=>t.tick?4:0,stroke:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},strokeWidth:1,width:t=>t.tick?8:0},this._tickSize=8,this._tickSuffix="normal",this._tickUnit=0,this._timeLocale=void 0,this._titleClass=new Ct,this._titleConfig={fontColor:()=>{const t=this._select?i.backgroundColor(this._select.node()):"rgb(255, 255, 255)";return r.colorContrast(t)},fontSize:12,textAnchor:"middle"},this._width=400,this._margin={top:0,right:0,bottom:0,left:0},this._availableTicks=[],this._visibleTicks=[]}}class ut extends gt{
|
|
564
567
|
/**
|
|
565
568
|
Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
566
569
|
@private
|
|
@@ -1841,7 +1844,7 @@ _draw(t){const{rowValues:e,columnValues:s,shapeData:n}=zi.bind(this)(this._filte
|
|
|
1841
1844
|
/**
|
|
1842
1845
|
Invoked when creating a new class instance, and sets any default parameters.
|
|
1843
1846
|
@private
|
|
1844
|
-
*/constructor(){super(),this._cellPadding=2,this._column=j("column"),this._columnAxis=new gt,this._columnConfig=i.assign({orient:"top"},$i),this._columnSort=(t,i)=>`${t}`.localeCompare(`${i}`),this._label=(t,i)=>`${G.bind(this)("row",t,i)} / ${G.bind(this)("column",t,i)}`;const t=this._on["mousemove.shape"];this._on["mousemove.shape"]=(i,e,s,n)=>{t(i,e,s,n);const h=G.bind(this)("row",i,e),o=G.bind(this)("column",i,e);this.hover((t,i)=>G.bind(this)("row",t,i)===h||G.bind(this)("column",t,i)===o)},this._row=j("row"),this._rowAxis=new gt,this._rowConfig=i.assign({orient:"left"},$i),this._rowSort=(t,i)=>`${t}`.localeCompare(`${i}`)}},t.Message=bt,t.Network=class extends hi{
|
|
1847
|
+
*/constructor(){super(),this._cellPadding=2,this._column=j("column"),this._columnAxis=new gt,this._columnConfig=i.assign({orient:"top"},$i),this._columnSort=(t,i)=>`${t}`.localeCompare(`${i}`),this._label=(t,i)=>`${G.bind(this)("row",t,i)} / ${G.bind(this)("column",t,i)}`;const t=this._on["mousemove.shape"];this._on["mousemove.shape"]=(i,e,s,n)=>{t(i,e,s,n);const h=G.bind(this)("row",i,e),o=G.bind(this)("column",i,e);this.hover((t,i)=>(G.bind(this)("row",t,i)===h||G.bind(this)("column",t,i)===o)&&"number"==typeof this._colorScale(t,i))},this._row=j("row"),this._rowAxis=new gt,this._rowConfig=i.assign({orient:"left"},$i),this._rowSort=(t,i)=>`${t}`.localeCompare(`${i}`)}},t.Message=bt,t.Network=class extends hi{
|
|
1845
1848
|
/**
|
|
1846
1849
|
Extends the draw behavior of the abstract Viz class.
|
|
1847
1850
|
@private
|