@d3plus/core 3.0.8 → 3.0.10

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.8
2
+ @d3plus/core v3.0.10
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
@@ -3327,7 +3327,7 @@ this._on[t].toString()!==i),o=this._on["click.legend"]&&this._on["click.legend"]
3327
3327
  this._select.style("cursor",r||o&&l?"pointer":"auto"),this._legendFilterInvert.bind(this)()),l=this._solo.includes(t),_=this._hidden.includes(t);
3328
3328
  // does the legend still have our default "click.legend" event?
3329
3329
  // (if the user only sets "click", both functions will fire)
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}}
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={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}}
3331
3331
  /**
3332
3332
  @module discreteBuffer
3333
3333
  @desc Adds left/right padding to a point or time scale.
@@ -3706,7 +3706,7 @@ this._aggs[i]||this._discrete!==t||(this._aggs[i]=(t,i)=>{t=Array.from(new Set(t
3706
3706
  @memberof Plot
3707
3707
  @desc Invoked when creating a new class instance, and sets any default parameters.
3708
3708
  @private
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{
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,{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{
3710
3710
  /**
3711
3711
  @memberof AreaPlot
3712
3712
  @desc Invoked when creating a new class instance, and overrides any default parameters inherited from Plot.