@d3plus/core 3.0.4 → 3.0.5
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 +80 -87
- package/es/src/charts/BoxWhisker.js +0 -4
- package/es/src/charts/Plot.js +1 -3
- package/es/src/charts/Viz.js +1 -1
- package/es/src/components/Axis.js +3 -2
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +6 -7
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +9 -9
- package/umd/d3plus-core.js +5 -6
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.
|
|
2
|
+
@d3plus/core v3.0.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) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -2531,24 +2531,24 @@ if(Pc(r[0])&&Pc(r[r.length-1]))this._d3ScaleNegative=this._d3Scale.copy().domain
|
|
|
2531
2531
|
*/if(w=(this._ticks?"time"===this._scale?this._ticks.map(Pt):this._ticks:(this._d3Scale||this._d3ScaleNegative).ticks?this._getTicks():this._domain).slice(),b=(this._labels?"time"===this._scale?this._labels.map(Pt):this._labels:(this._d3Scale||this._d3ScaleNegative).ticks?this._getLabels():w).slice(),"time"===this._scale&&(w=w.map(Number),b=b.map(Number)),w=w.sort((t,n)=>this._getPosition(t)-this._getPosition(n)),b=b.sort((t,n)=>this._getPosition(t)-this._getPosition(n)),"linear"===this._scale&&"smallest"===this._tickSuffix){i=b.filter(t=>1e3<=t);if(0<i.length){var l=Math.min(...i);let t=1;for(;t&&t<7;){if(!(1<=l/Math.pow(10,3*t)))break;this._tickUnit=t,t+=1}}}
|
|
2532
2532
|
/**
|
|
2533
2533
|
* Removes ticks when they overlap other ticks.
|
|
2534
|
-
*/let h=[];(this._availableTicks=w).forEach((t,n)=>{let e=y({id:t,tick:!0},n);"Circle"===this._shape&&(e*=2);n=this._getPosition(t);!h.length||Math.abs(wu(n,h)-n)>2*e?h.push(n):h.push(!1)}),w=w.filter((t,n)=>!1!==h[n]),this._visibleTicks=w}
|
|
2534
|
+
*/let h=[];(this._availableTicks=w).forEach((t,n)=>{let e=y({id:t,tick:!0},n);"Circle"===this._shape&&(e*=2);n=this._getPosition(t);!h.length||Math.abs(wu(n,h)-n)>2*e?h.push(n):h.push(!1)}),w=w.filter((t,n)=>!1!==h[n]),this._visibleTicks=w}
|
|
2535
2535
|
/**
|
|
2536
2536
|
* Pre-calculates the size of the title, if defined, in order
|
|
2537
2537
|
* to adjust the internal margins.
|
|
2538
|
-
*/this._title
|
|
2538
|
+
*/if(s.bind(this)(),this._title){let{fontFamily:t,fontSize:n,lineHeight:e}=this._titleConfig;var l=si().fontFamily("function"==typeof t?t():t).fontSize("function"==typeof n?n():n).lineHeight("function"==typeof e?e():e).width(x[x.length-1]-x[0]-2*_).height(this["_"+u]-this._tickSize-2*_),h=l(this._title).lines.length;v[this._orient]=h*l.lineHeight()+_}let k="Circle"===this._shape?"function"==typeof this._shapeConfig.r?this._shapeConfig.r({tick:!0}):this._shapeConfig.r:"Rect"===this._shape?"function"==typeof this._shapeConfig[u]?this._shapeConfig[u]({tick:!0}):this._shapeConfig[u]:this._tickSize,C=y({tick:!0});"function"==typeof k&&(k=Ot(w.map(k))),"Rect"===this._shape&&(k/=2),"function"==typeof C&&(C=Ot(w.map(C))),"Circle"!==this._shape&&(C/=2)
|
|
2539
2539
|
/**
|
|
2540
2540
|
* Calculates the text wrapping and size of a given textData object.
|
|
2541
2541
|
* @param {Object} datum
|
|
2542
|
-
*/;let
|
|
2542
|
+
*/;let M=[];function A(t=1){let o=this._shapeConfig.labelConfig.fontSize,s=this._shapeConfig.labelConfig.fontFamily||Te,l=this._shapeConfig.labelConfig.padding,e=(
|
|
2543
2543
|
/**
|
|
2544
2544
|
* Calculates the space each label would take up, given
|
|
2545
2545
|
* the provided this._space size.
|
|
2546
|
-
*/
|
|
2547
|
-
/** Calculates label offsets */.bind(this)(t);return Object.assign(n,t)})).slice().reverse();
|
|
2546
|
+
*/M=b.map((t,n)=>{var e="function"==typeof s?s(t,n):s,i="function"==typeof l?l(t,n):l,a="function"==typeof o?o(t,n):o,r=this._getPosition(t);return{d:t,i:n,fF:e,fP:i,fS:a,lineHeight:this._shapeConfig.lineHeight?this._shapeConfig.lineHeight(t,n):1.4*a,position:r,rotate:this._labelRotation}}),"band"===this._scale?this._d3Scale.bandwidth():M.reduce((t,n,e)=>{var n=n.position,i=e?n-(n-M[e-1].position):1===M.length?m[0]:n-(M[e+1].position-n),i=Math.abs(n-i),e=e==M.length-1?1===M.length?m[1]:n+(n-M[e-1].position):n-(n-M[e+1].position),n=Math.abs(n-e),e="point"===this._scale?1:2;return Ot([Ot([i,n])*e,t])},0)),h=(M=M.map(t=>{t.space=e-2*t.fP;var n=function(t){var{d:t,i:n,fF:e,fP:i,fS:a,rotate:r,space:o}=t,s=r?"width":"height",r=r?"height":"width",l=Dt([this._maxSize,this._width]),h=Dt([this._maxSize,this._height]);return(e=si().fontFamily(e).fontSize(a).lineHeight(this._shapeConfig.lineHeight?this._shapeConfig.lineHeight(t,n):void 0))[r](d?o:l-k-_-this._margin.left-this._margin.right),e[s](d?h-k-_-this._margin.top-this._margin.bottom:o),(a=e(S(t))).lines=a.lines.filter(t=>""!==t),a.width=a.lines.length?Math.ceil(Ot(a.widths)):0,a.height=a.lines.length?Math.ceil(a.lines.length*e.lineHeight())+i:0,a}
|
|
2547
|
+
/** Calculates label offsets */.bind(this)(t);return Object.assign(n,t)})).slice().reverse();M.forEach(t=>{let{fP:n,i:e,position:i}=t;var a=d?"width":"height";let r=!!e&&h.find(t=>t.i<e&&!t.truncated);if(e===M.length-1)for(;r&&i-t[a]/2-n<r.position+r[a]/2;)r.truncated=!0,r=h.find(t=>t.i<e&&!t.truncated);t.truncated=!!r&&i-t[a]/2-n<r.position+r[a]/2}),1<t&&function(a=[]){let r=0;a.forEach(t=>{var n=a[t.i-1],e=t.rotate&&d||!t.rotate&&!d?"width":"height",i=t.rotate&&d||!t.rotate&&!d?"height":"width";n?n.position+n[i]/2>t.position-t[i]/2&&(r=r?(t.offset=n[e],0):1):r=1})}.bind(this)(M)}A.bind(this)();var h=this._labelOffset&&M.some(t=>t.truncated),l=(h&&A.bind(this)(2)
|
|
2548
2548
|
/**
|
|
2549
2549
|
* "spillover" will contain the pixel spillover of the first and last label,
|
|
2550
2550
|
* and then adjust the scale range accordingly.
|
|
2551
|
-
*/,[0,1].map(t=>{var n,e,i,a=
|
|
2551
|
+
*/,[0,1].map(t=>{var n,e,i,a=M[t?M.length-1:0];return!a||({height:a,position:n,rotate:i,width:e}=a,t=t?m[1]:m[0],i=(i||!d?a:e)/2,Math.abs(n-t)>=i)?0:Math.abs(i-(n-t))})),[z,T]=x,l=[z+l[0],T-l[1]];this._range&&(void 0!==this._range[0]&&(l[0]=this._range[0]),void 0!==this._range[this._range.length-1])&&(l[1]=this._range[this._range.length-1]),l[0]===z&&l[1]===T||(s.bind(this)(l),A.bind(this)(h?2:1));let E=Ot(M,t=>t.height)||0,P=(this._labelRotation=d&&void 0===this._labelRotation?M.some(t=>{var{i:t,height:n,position:e,truncated:i}=t,a=M[t-1];return i||t&&a.position+a.height/2>e-n/2}):this._labelRotation,this._labelOffset?Ot(M,t=>t.offset||0):0);M.forEach(t=>t.offset=t.offset?P:0);z="Line"===this._shape?0:k;let N=this._outerBounds={[u]:(Ot(M,t=>Math.ceil(t[t.rotate||!d?"width":"height"]+t.offset))||0)+(M.length?_:0),[n]:m[m.length-1]-m[0],[c]:m[0]};N[u]=Ot([this._minSize,N[u]]),v[this._orient]+=k,v[f]=void 0!==this._gridSize?Ot([this._gridSize,z]):this["_"+u]-v[this._orient]-N[u]-_,N[u]+=v[f]+v[this._orient],N[g]="start"===this._align?this._padding:"end"===this._align?this["_"+u]-N[u]-this._padding:this["_"+u]/2-N[u]/2;T=Nt("g#d3plus-Axis-"+this._uuid,{parent:i}),l=Nt("g.grid",{parent:this._group=T}).selectAll("line").data((0!==this._gridSize?this._grid||"log"===this._scale&&!this._gridLog?b:w:[]).map(t=>({id:t})),t=>t.id),l.exit().transition(a).attr("opacity",0).call(this._gridPosition.bind(this)).remove(),l.enter().append("line").attr("opacity",0).attr("clip-path",`url(#${e})`).call(this._gridPosition.bind(this),!0).merge(l).transition(a).attr("opacity",1).call(this._gridPosition.bind(this)),h=b.filter((t,n)=>M[n].lines.length&&!w.includes(t));let L=M.some(t=>t.rotate),B=w.concat(h).map(n=>{var t=M.find(t=>t.d===n),e=this._getPosition(n),i=t?t.space:0,a=t?t.lines.length:1,r=t?t.lineHeight:1,o=t?t.fP:0,s=t&&this._labelOffset?t.offset:0,l=d?i:N.width-v[this._position.opposite]-k-v[this._orient]+_,h=v[f],s=(k+s)*(p?-1:1),h=p?N[g]+N[u]-h:N[g]+h;return{id:n,labelBounds:L&&t?{x:-t.width/2+t.fS/4,y:"bottom"===this._orient?s+(t.width-r*a)/2+o:2*s-(t.width+r*a)/2+o,width:t.width,height:t.height}:{x:d?-i/2:"left"===this._orient?-l-_+s:s+_,y:d?"bottom"===this._orient?s+o:s-E-o:-i/2,width:d?i:l,height:d?E:i},rotate:!!t&&t.rotate,size:b.includes(n)||"log"===this._scale&&Math.log10(Math.abs(n))%1==0?s:w.includes(n)?Math.ceil(s/2):this._data.find(t=>+t===n)?Math.ceil(s/4):0,text:!((t||{}).truncated||!b.includes(n))&&S(n),tick:w.includes(n),[c]:e+("band"===this._scale?this._d3Scale.bandwidth()/2:0),[g]:h}});"Line"===this._shape&&(B=B.concat(B.map(t=>{var n=Object.assign({},t);return n[g]+=t.size,n}))),(new Tc[this._shape]).data(B).duration(this._duration).labelConfig({ellipsis:t=>t&&t.length?t+"...":"",rotate:t=>t.rotate?-90:0}).select(Nt("g.ticks",{parent:T}).node()).config(Lt.bind(this)(this._shapeConfig)).labelConfig({padding:0}).render();z=T.selectAll("line.bar").data([null]);return z.enter().append("line").attr("class","bar").attr("opacity",0).call(this._barPosition.bind(this)).merge(z).transition(a).attr("opacity",1).call(this._barPosition.bind(this)),this._titleClass.data(this._title?[{text:this._title}]:[]).duration(this._duration).height(v[this._orient]).rotate("left"===this._orient?-90:"right"===this._orient?90:0).select(Nt("g.d3plus-Axis-title",{parent:T}).node()).text(t=>t.text).verticalAlign("middle").width(x[x.length-1]-x[0]).x(d?x[0]:"left"===this._orient?N.x+v.left/2-(x[x.length-1]-x[0])/2:N.x+N.width-v.right/2-(x[x.length-1]-x[0])/2).y(d?"bottom"===this._orient?N.y+N.height-v.bottom:N.y:x[0]+(x[x.length-1]-x[0])/2-v[this._orient]/2).config(Lt.bind(this)(this._titleConfig)).render(),this._lastScale=this._getPosition.bind(this),t&&setTimeout(t,this._duration+100),this}
|
|
2552
2552
|
/**
|
|
2553
2553
|
@memberof Axis
|
|
2554
2554
|
@desc If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance.
|
|
@@ -4332,7 +4332,7 @@ return H("body").on("touchstart."+this._uuid,
|
|
|
4332
4332
|
function value(d) {
|
|
4333
4333
|
return d.id;
|
|
4334
4334
|
}
|
|
4335
|
-
*/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,n)=>{t=pu(t.map(n)
|
|
4335
|
+
*/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,n)=>{t=pu(t.map(n));return 1===t.length?t[0]:t}),p(t))),this):this._groupBy}
|
|
4336
4336
|
/**
|
|
4337
4337
|
@memberof Viz
|
|
4338
4338
|
@desc If *value* is specified, sets the overall height to the specified number and returns the current class instance.
|
|
@@ -5120,7 +5120,7 @@ this._aggs[n]||this._discrete!==t||(this._aggs[n]=(t,n)=>{t=Array.from(new Set(t
|
|
|
5120
5120
|
@memberof Plot
|
|
5121
5121
|
@desc Invoked when creating a new class instance, and sets any default parameters.
|
|
5122
5122
|
@private
|
|
5123
|
-
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Et({},Df,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(t,n)=>"function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,n):this._shapeConfig.Line.stroke,fillOpacity:Bt(.5)},this._discreteCutoff=100,this._groupPadding=5,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=Bt("auto"),this._lineMarkerConfig={fill:(t,n)=>Fh(this._id(t,n)),r:Bt(3)},this._lineMarkers=!1,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this._shape=Bt("Circle"),this._shapeConfig=Et(this._shapeConfig,{Area:{label:(t,n)=>!!this._stacked&&this._drawLabel(t,n),labelBounds:(t,n,e)=>{let i=Gu(e.points,{angle:jt(-20,20,5)});if(!(i=!i||i.height<20||i.width<50?Gu(e.points,{angle:jt(-80,80,5)}):i))return null;let a=Dt(e.points,t=>t[0]);e=Ot(e.points.filter(t=>t[0]===a),t=>t[1]);return{angle:i.angle,width:i.width,height:i.height,x:i.cx-i.width/2-a,y:i.cy-i.height/2-e}},labelConfig:{fontMin:6,fontResize:!0,padding:10}},ariaLabel:(t,n)=>{let e="";return t.nested?e=""+this._drawLabel(t.data,t.i):(e=""+this._drawLabel(t,n),void 0!==this._x(t,n)&&(e+=", x: "+this._x(t,n)),void 0!==this._y(t,n)&&(e+=", y: "+this._y(t,n)),void 0!==this._x2(t,n)&&(e+=", x2: "+this._x2(t,n)),void 0!==this._y2(t,n)&&(e+=", y2: "+this._y2(t,n))),e+"."},Bar:{labelBounds(t,n,e){var i="y"===this._discrete?"width":"height",a="y"===this._discrete?"height":"width",r="x"===this._discrete.charAt(0)?"y":"x",o="y"==r,r=this._discrete.replace(this._discrete.charAt(0),r),s=this[`_${r}Axis`]._d3Scale.range(),s=Math.abs(s[1]-s[0]),r=this["_"+r](t,n)<0;return Gf.bind(this)(t,n)?{[i]:s-e[i],[a]:e[a],x:o?-e.width/2:r?-s:e.width+1,y:o?r?e.height+1:-s:-e.height/2+1}:{[i]:e[i],[a]:e[a],x:o?-e.width/2:r?(this._stacked,1-e.width):-1,y:o?r?(this._stacked,1):1-e.height:-e.height/2+1}},labelConfig:{fontMax:16,fontMin:6,fontResize:!0,fontColor(t,n){return Gf.bind(this)(t,n)?"transparent"===this._backgroundConfig.fill?Rh.dark:Hh(this._backgroundConfig.fill):Hh("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,n):this._shapeConfig.fill)},fontStroke(t,n){return Gf.bind(this)(t,n)?"transparent"===this._backgroundConfig.fill?Rh.dark:Hh(this._backgroundConfig.fill):"transparent"},fontStrokeWidth(t,n){return Gf.bind(this)(t,n)?.1:0},padding:3,textAnchor(t,n){var e="x"===this._discrete.charAt(0)?"y":"x",i="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,n)<0,i=i?"middle":Gf.bind(this)(t,n)?e?"end":"start":e?"start":"end";return yi()?"start"==i?"end":"end"==i?"start":i:i},verticalAlign(t,n){var e="x"===this._discrete.charAt(0)?"y":"x",i="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,n)<0;return i?Gf.bind(this)(t,n)?e?"top":"bottom":e?"bottom":"top":"middle"}}},Circle:{r:jf.bind(this)},Line:{curve:()=>this._discrete?"monotone"+this._discrete.charAt(0).toUpperCase():"linear",fill:Bt("none"),labelConfig:{fontColor:(t,n)=>Gh("function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,n):this._shapeConfig.Line.stroke),fontResize:!1,padding:5,textAnchor:"start",verticalAlign:"middle"},strokeWidth:Bt(2)},Rect:{height:t=>2*jf.bind(this)(t),width:t=>2*jf.bind(this)(t)}}),this._shapeOrder=["Area","Path","Bar","Box","Line","Rect","Circle"],this._shapeSort=(t,n)=>this._shapeOrder.indexOf(t)-this._shapeOrder.indexOf(n),this._sizeMax=20,this._sizeMin=5,this._sizeScale="sqrt",this._stackOffset=Hf,this._stackOrder=If,this._timelineConfig=Et(this._timelineConfig,{brushing:!0,brushMin:()=>this._xTime||this._yTime||this._x2Time||this._y2Time?2:1}),this._x=p("x"),this._xKey="x",this._xAxis=(new jc).align("end"),this._xTest=(new jc).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":Lf.colors.gray[200]}},this._xCutoff=150,this._x2=p("x2"),this._x2Key="x2",this._x2Axis=(new Fc).align("start"),this._x2Test=(new Fc).align("start").gridSize(0),this._x2Config={
|
|
5123
|
+
*/constructor(){super(),this._axisPersist=!1,this._annotations=[],this._backgroundConfig={duration:0,fill:"transparent"},this._barPadding=0,this._buffer=Et({},Df,{Bar:!1,Line:!1}),this._confidenceConfig={fill:(t,n)=>"function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,n):this._shapeConfig.Line.stroke,fillOpacity:Bt(.5)},this._discreteCutoff=100,this._groupPadding=5,this._labelConnectorConfig={strokeDasharray:"1 1"},this._labelPosition=Bt("auto"),this._lineMarkerConfig={fill:(t,n)=>Fh(this._id(t,n)),r:Bt(3)},this._lineMarkers=!1,this._previousAnnotations={back:[],front:[]},this._previousShapes=[],this._shape=Bt("Circle"),this._shapeConfig=Et(this._shapeConfig,{Area:{label:(t,n)=>!!this._stacked&&this._drawLabel(t,n),labelBounds:(t,n,e)=>{let i=Gu(e.points,{angle:jt(-20,20,5)});if(!(i=!i||i.height<20||i.width<50?Gu(e.points,{angle:jt(-80,80,5)}):i))return null;let a=Dt(e.points,t=>t[0]);e=Ot(e.points.filter(t=>t[0]===a),t=>t[1]);return{angle:i.angle,width:i.width,height:i.height,x:i.cx-i.width/2-a,y:i.cy-i.height/2-e}},labelConfig:{fontMin:6,fontResize:!0,padding:10}},ariaLabel:(t,n)=>{let e="";return t.nested?e=""+this._drawLabel(t.data,t.i):(e=""+this._drawLabel(t,n),void 0!==this._x(t,n)&&(e+=", x: "+this._x(t,n)),void 0!==this._y(t,n)&&(e+=", y: "+this._y(t,n)),void 0!==this._x2(t,n)&&(e+=", x2: "+this._x2(t,n)),void 0!==this._y2(t,n)&&(e+=", y2: "+this._y2(t,n))),e+"."},Bar:{labelBounds(t,n,e){var i="y"===this._discrete?"width":"height",a="y"===this._discrete?"height":"width",r="x"===this._discrete.charAt(0)?"y":"x",o="y"==r,r=this._discrete.replace(this._discrete.charAt(0),r),s=this[`_${r}Axis`]._d3Scale.range(),s=Math.abs(s[1]-s[0]),r=this["_"+r](t,n)<0;return Gf.bind(this)(t,n)?{[i]:s-e[i],[a]:e[a],x:o?-e.width/2:r?-s:e.width+1,y:o?r?e.height+1:-s:-e.height/2+1}:{[i]:e[i],[a]:e[a],x:o?-e.width/2:r?(this._stacked,1-e.width):-1,y:o?r?(this._stacked,1):1-e.height:-e.height/2+1}},labelConfig:{fontMax:16,fontMin:6,fontResize:!0,fontColor(t,n){return Gf.bind(this)(t,n)?"transparent"===this._backgroundConfig.fill?Rh.dark:Hh(this._backgroundConfig.fill):Hh("function"==typeof this._shapeConfig.fill?this._shapeConfig.fill(t,n):this._shapeConfig.fill)},fontStroke(t,n){return Gf.bind(this)(t,n)?"transparent"===this._backgroundConfig.fill?Rh.dark:Hh(this._backgroundConfig.fill):"transparent"},fontStrokeWidth(t,n){return Gf.bind(this)(t,n)?.1:0},padding:3,textAnchor(t,n){var e="x"===this._discrete.charAt(0)?"y":"x",i="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,n)<0,i=i?"middle":Gf.bind(this)(t,n)?e?"end":"start":e?"start":"end";return yi()?"start"==i?"end":"end"==i?"start":i:i},verticalAlign(t,n){var e="x"===this._discrete.charAt(0)?"y":"x",i="y"==e,e=this._discrete.replace(this._discrete.charAt(0),e),e=this["_"+e](t,n)<0;return i?Gf.bind(this)(t,n)?e?"top":"bottom":e?"bottom":"top":"middle"}}},Circle:{r:jf.bind(this)},Line:{curve:()=>this._discrete?"monotone"+this._discrete.charAt(0).toUpperCase():"linear",fill:Bt("none"),labelConfig:{fontColor:(t,n)=>Gh("function"==typeof this._shapeConfig.Line.stroke?this._shapeConfig.Line.stroke(t,n):this._shapeConfig.Line.stroke),fontResize:!1,padding:5,textAnchor:"start",verticalAlign:"middle"},strokeWidth:Bt(2)},Rect:{height:t=>2*jf.bind(this)(t),width:t=>2*jf.bind(this)(t)}}),this._shapeOrder=["Area","Path","Bar","Box","Line","Rect","Circle"],this._shapeSort=(t,n)=>this._shapeOrder.indexOf(t)-this._shapeOrder.indexOf(n),this._sizeMax=20,this._sizeMin=5,this._sizeScale="sqrt",this._stackOffset=Hf,this._stackOrder=If,this._timelineConfig=Et(this._timelineConfig,{brushing:!0,brushMin:()=>this._xTime||this._yTime||this._x2Time||this._y2Time?2:1}),this._x=p("x"),this._xKey="x",this._xAxis=(new jc).align("end"),this._xTest=(new jc).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":Lf.colors.gray[200]}},this._xCutoff=150,this._x2=p("x2"),this._x2Key="x2",this._x2Axis=(new Fc).align("start"),this._x2Test=(new Fc).align("start").gridSize(0),this._x2Config={},this._y=p("y"),this._yKey="y",this._yAxis=(new Rc).align("start"),this._yKey="y",this._yTest=(new Rc).align("start").gridSize(0),this._yConfig={gridConfig:{stroke:t=>{var n;return this._discrete&&"y"===this._discrete.charAt(0)||(n=this._yAxis.range())[n.length-1]===this._yAxis._getPosition.bind(this._yAxis)(t.id)?"transparent":Lf.colors.gray[200]}}},this._yCutoff=150,this._y2=p("y2"),this._y2Key="y2",this._y2Axis=(new Ic).align("end"),this._y2Test=(new Rc).align("end").gridSize(0),this._y2Config={}}}class Uf extends Kf{
|
|
5124
5124
|
/**
|
|
5125
5125
|
@memberof AreaPlot
|
|
5126
5126
|
@desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.
|
package/umd/d3plus-core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.
|
|
2
|
+
@d3plus/core v3.0.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) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -3247,7 +3247,8 @@
|
|
|
3247
3247
|
}
|
|
3248
3248
|
let textData = [];
|
|
3249
3249
|
function createTextData(offset = 1) {
|
|
3250
|
-
const {
|
|
3250
|
+
const { fontSize } = this._shapeConfig.labelConfig;
|
|
3251
|
+
const fontFamily = this._shapeConfig.labelConfig.fontFamily || text.fontFamily;
|
|
3251
3252
|
const fontPadding = this._shapeConfig.labelConfig.padding;
|
|
3252
3253
|
/**
|
|
3253
3254
|
* Calculates the space each label would take up, given
|
|
@@ -8127,7 +8128,7 @@
|
|
|
8127
8128
|
else {
|
|
8128
8129
|
if (!this._aggs[k]) {
|
|
8129
8130
|
this._aggs[k] = (a, c)=>{
|
|
8130
|
-
const v = data.unique(a.map(c)
|
|
8131
|
+
const v = data.unique(a.map(c));
|
|
8131
8132
|
return v.length === 1 ? v[0] : v;
|
|
8132
8133
|
};
|
|
8133
8134
|
}
|
|
@@ -10834,9 +10835,7 @@
|
|
|
10834
10835
|
this._x2Key = "x2";
|
|
10835
10836
|
this._x2Axis = new AxisTop().align("start");
|
|
10836
10837
|
this._x2Test = new AxisTop().align("start").gridSize(0);
|
|
10837
|
-
this._x2Config = {
|
|
10838
|
-
padding: 0
|
|
10839
|
-
};
|
|
10838
|
+
this._x2Config = {};
|
|
10840
10839
|
this._y = accessor("y");
|
|
10841
10840
|
this._yKey = "y";
|
|
10842
10841
|
this._yAxis = new AxisLeft().align("start");
|